Commit 3ee8d6e3 authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org

Merge sinisa@work.mysql.com:/home/bk/mysql-4.1

into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents 4d4ac0ed e372311e
......@@ -107,6 +107,7 @@ vva@eagle.mysql.r18.ru
vva@genie.(none)
walrus@kishkin.ru
walrus@mysql.com
wax@kishkin.ru
wax@mysql.com
worm@altair.is.lan
zak@balfor.local
......
......@@ -511,16 +511,55 @@ SHOW FIELDS FROM t1;
Field Type Collation Null Key Default Extra
latin1_f char(32) latin1_bin YES NULL
SET NAMES 'latin1';
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SET NAMES latin1;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1 2 1
SET NAMES latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SET NAMES 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_bin 2 0
SET NAMES koi8r;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
koi8r koi8r 2 1
SET COLLATION koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
koi8r koi8r_bin 2 0
SET COLLATION DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
koi8r koi8r 2 1
SET NAMES DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1 2 1
......
......@@ -128,12 +128,27 @@ SHOW CREATE TABLE t1;
SHOW FIELDS FROM t1;
SET NAMES 'latin1';
SHOW VARIABLES LIKE 'client_collation';
SET NAMES latin1;
SHOW VARIABLES LIKE 'client_collation';
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation';
SET NAMES 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES koi8r;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET COLLATION koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET COLLATION DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
--error 1251
SET NAMES latin1 COLLATE koi8r;
......
......@@ -11,7 +11,6 @@ CP="cp -p"
DEBUG=0
SILENT=0
TMP=/tmp
SUFFIX=""
OUTTAR=0
......@@ -34,33 +33,33 @@ if [ ! -f sql/sql_yacc.cc ]; then
exit 1
fi
#
# Assign the tmp directory if it was set from the environment variables
# Debug print of the status
#
for i in $TMPDIR $TEMPDIR $TEMP
do
if [ $i ]; then
TMP=$i
break
fi
done
print_debug()
{
for statement
do
if [ "$DEBUG" = "1" ] ; then
echo $statement
fi
done
}
#
# Usage of the script
#
show_usage() {
show_usage()
{
echo "MySQL utility script to create a Windows src package, and it takes"
echo "the following arguments:"
echo ""
echo " --debug Debug, without creating the package"
echo " --tmp Specify the temporary location"
echo " --silent Do not list verbosely files processed"
echo " --tar Create a tar.gz package instead of .zip"
echo " --tar Create tar.gz package instead of .zip"
echo " --help Show this help message"
exit 0
......@@ -89,6 +88,22 @@ parse_arguments() {
parse_arguments "$@"
#
# Assign the tmp directory if it was set from the environment variables
#
for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
do
if [ "$i" ]; then
print_debug "Setting TMP to '$i'"
TMP=$i
break
fi
done
#
#
# Create a tmp dest directory to copy files
#
......@@ -96,30 +111,23 @@ parse_arguments "$@"
BASE=$TMP/my_win_dist$SUFFIX
if [ -d $BASE ] ; then
if [ x$DEBUG = x1 ]; then
echo "Destination directory '$BASE' already exists, deleting it"
fi
print_debug "Destination directory '$BASE' already exists, deleting it"
rm -r -f $BASE
fi
$CP -r $SOURCE/VC++Files $BASE
(
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
)|(
while read v
do
if [ x$DEBUG = x1 ]; then
echo "Replacing LF -> CRLF from '$v'"
fi
# ^M -> type CTRL V + CTRL M
cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v
mv $v.tmp $v
while read v
do
print_debug "Replacing LF -> CRLF from '$v'"
# awk '!/r\r$/ {print $0"\r"} /r\r$/ {print $0}' $v > $v
done
# ^M -> type CTRL V + CTRL M
cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v
mv $v.tmp $v
done
)
#
......@@ -127,6 +135,9 @@ done
#
$CP -r $SOURCE/sql/share $BASE/
rm -r -f "$BASE/share/Makefile"
rm -r -f "$BASE/share/Makefile.in"
rm -r -f "$BASE/share/Makefile.am"
#
# Clean up if we did this from a bk tree
......@@ -135,7 +146,7 @@ $CP -r $SOURCE/sql/share $BASE/
if [ -d $BASE/SCCS ]
then
find $BASE/ -name SCCS -print | xargs rm -r -f
rm -rf "$BASE/InstallShield/Script Files/SCCS"
rm -r -f "$BASE/InstallShield/Script Files/SCCS"
fi
mkdir $BASE/Docs $BASE/extra $BASE/include
......@@ -148,9 +159,7 @@ mkdir $BASE/Docs $BASE/extra $BASE/include
copy_dir_files() {
for arg do
if [ x$DEBUG = x1 ]; then
echo "Copying files from directory '$arg'"
fi
print_debug "Copying files from directory '$arg'"
cd $SOURCE/$arg/
for i in *.c *.h *.ih *.i *.ic *.asm \
README INSTALL* LICENSE
......@@ -183,7 +192,8 @@ copy_dir_dirs() {
if [ ! -d $BASE/$arg ]; then
mkdir $BASE/$arg
fi
fi
copy_dir_files $arg
cd $SOURCE/$arg/
......@@ -242,9 +252,7 @@ for i in COPYING ChangeLog README \
Docs/mysqld_error.txt Docs/INSTALL-BINARY
do
if [ x$DEBUG = x1 ]; then
echo "Copying file '$i'"
fi
print_debug "Copying file '$i'"
if [ -f $i ]
then
$CP $i $BASE/$i
......@@ -256,10 +264,8 @@ done
#
if [ -f scripts/mysql_install_db ]; then
if [ x$DEBUG = x1 ]; then
echo "Initializing the 'data' directory"
fi
scripts/mysql_install_db -WINDOWS --datadir=$BASE/data
print_debug "Initializing the 'data' directory"
scripts/mysql_install_db --windows --datadir=$BASE/data
fi
......@@ -267,8 +273,10 @@ fi
# Specify the distribution package name and copy it
#
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX-win-src
BASE2=$TMP/$NEW_NAME
NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
NEW_NAME=$NEW_DIR_NAME-win-src
BASE2=$TMP/$NEW_DIR_NAME
rm -r -f $BASE2
mv $BASE $BASE2
BASE=$BASE2
......@@ -277,7 +285,7 @@ BASE=$BASE2
# If debugging, don't create a zip/tar/gz
#
if [ x$DEBUG = x1 ] ; then
if [ "$DEBUG" = "1" ] ; then
echo "Please check the distribution files from $BASE"
echo "Exiting (without creating the package).."
exit
......@@ -316,13 +324,13 @@ set_tarzip_options()
{
for arg
do
if [ x$arg = x"tar" ]; then
if [ "$arg" = "tar" ]; then
ZIPFILE1=gnutar
ZIPFILE2=gtar
OPT=cvf
EXT=".tar"
NEED_COMPRESS=1
if [ x$SILENT = x1 ] ; then
if [ "$SILENT" = "1" ] ; then
OPT=cf
fi
else
......@@ -331,14 +339,14 @@ set_tarzip_options()
OPT="-vr"
EXT=".zip"
NEED_COMPRESS=0
if [ x$SILENT = x1 ] ; then
if [ "$SILENT" = "1" ] ; then
OPT="-r"
fi
fi
done
}
if [ x$OUTTAR = x1 ]; then
if [ "$OUTTAR" = "1" ]; then
set_tarzip_options 'tar'
else
set_tarzip_options 'zip'
......@@ -347,6 +355,7 @@ fi
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = ""
then
print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
tar=tar
set_tarzip_options 'tar'
fi
......@@ -355,27 +364,21 @@ fi
# Create the archive
#
if [ xDEBUG = x1 ]; then
echo "Using $tar to create archive"
fi
print_debug "Using $tar to create archive"
cd $TMP
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_NAME
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
cd $SOURCE
if [ x$NEED_COMPRESS = x1 ]
if [ "$NEED_COMPRESS" = "1" ]
then
if [ xDEBUG = x1 ]; then
echo "Compressing archive"
fi
print_debug "Compressing archive"
gzip -9 $NEW_NAME$EXT
EXT="$EXT.gz"
fi
if [ xDEBUG = x1 ]; then
echo "Removing temporary directory"
fi
print_debug "Removing temporary directory"
rm -r -f $BASE
echo "$NEW_NAME$EXT created successfully !!"
......
......@@ -7,15 +7,15 @@
#
# All unrecognized arguments to this script are passed to mysqld.
IN_RPM=0
in_rpm=0
case "$1" in
-IN-RPM)
IN_RPM="1"; shift
--rpm)
in_rpm="1"; shift
;;
esac
windows=0
case "$1" in
-WINDOWS)
--windows)
windows="1"; shift
;;
esac
......@@ -102,7 +102,7 @@ mdata=$ldata/mysql
if test "$windows" -eq 0 -a ! -x $execdir/mysqld
then
if test "$IN_RPM" -eq 1
if test "$in_rpm" -eq 1
then
echo "FATAL ERROR $execdir/mysqld not found!"
exit 1
......@@ -116,7 +116,7 @@ fi
hostname=`@HOSTNAME@` # Install this too in the user table
# Check if hostname is valid
if test "$windows" -eq 0 -a "$IN_RPM" -eq 0 -a $force -eq 0
if test "$windows" -eq 0 -a "$in_rpm" -eq 0 -a $force -eq 0
then
resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ]
......@@ -140,7 +140,7 @@ then
fi
# Create database directories mysql & test
if test "$IN_RPM" -eq 0 || "$windows" -eq 0
if test "$in_rpm" -eq 0 || "$windows" -eq 0
then
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi
......@@ -342,7 +342,7 @@ END_OF_DATA
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then
echo ""
if test "$IN_RPM" -eq 0 || "$windows" -eq 0
if test "$in_rpm" -eq 0 || "$windows" -eq 0
then
echo "To start mysqld at boot time you have to copy support-files/mysql.server"
echo "to the right place for your system"
......@@ -363,7 +363,7 @@ then
echo "able to use the new GRANT command!"
fi
echo
if test "$IN_RPM" -eq 0 -a "$windows" -eq 0
if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then
echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &"
......
......@@ -42,6 +42,7 @@ class hash_filo
const hash_get_key get_key;
hash_free_key free_element;
bool init;
CHARSET_INFO *hash_charset;
hash_filo_element *first_link,*last_link;
public:
......@@ -49,9 +50,11 @@ public:
HASH cache;
hash_filo(uint size_arg, uint key_offset_arg , uint key_length_arg,
hash_get_key get_key_arg, hash_free_key free_element_arg)
hash_get_key get_key_arg, hash_free_key free_element_arg,
CHARSET_INFO *hash_charset_arg)
:size(size_arg), key_offset(key_offset_arg), key_length(key_length_arg),
get_key(get_key_arg), free_element(free_element_arg),init(0)
get_key(get_key_arg), free_element(free_element_arg),init(0),
hash_charset(hash_charset_arg)
{
bzero((char*) &cache,sizeof(cache));
}
......@@ -75,7 +78,7 @@ public:
if (!locked)
(void) pthread_mutex_lock(&lock);
(void) hash_free(&cache);
(void) hash_init(&cache,system_charset_info,size,key_offset,
(void) hash_init(&cache,hash_charset,size,key_offset,
key_length, get_key, free_element,0);
if (!locked)
(void) pthread_mutex_unlock(&lock);
......
......@@ -65,7 +65,8 @@ bool hostname_cache_init()
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
sizeof(struct in_addr),NULL,
(hash_free_key) free)))
(hash_free_key) free,
&my_charset_latin1)))
return 1;
hostname_cache->clear();
return 0;
......
......@@ -393,8 +393,7 @@ public:
bool eq(const Item *item, bool binary_cmp) const;
Item *new_item()
{
return new Item_string(name, str_value.ptr(), max_length,
default_charset_info);
return new Item_string(name, str_value.ptr(), max_length, &my_charset_bin);
}
String *const_string() { return &str_value; }
inline void append(char *str, uint length) { str_value.append(str, length); }
......@@ -406,7 +405,8 @@ public:
class Item_datetime :public Item_string
{
public:
Item_datetime(const char *item_name): Item_string(item_name,"",0,default_charset_info)
Item_datetime(const char *item_name): Item_string(item_name,"",0,
&my_charset_bin)
{ max_length=19;}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
};
......@@ -414,7 +414,8 @@ public:
class Item_empty_string :public Item_string
{
public:
Item_empty_string(const char *header,uint length) :Item_string("",0,default_charset_info)
Item_empty_string(const char *header,uint length) :Item_string("",0,
&my_charset_bin)
{ name=(char*) header; max_length=length;}
};
......
......@@ -1114,7 +1114,7 @@ int in_vector::find(Item *item)
in_string::in_string(uint elements,qsort_cmp cmp_func)
:in_vector(elements, sizeof(String), cmp_func),
tmp(buff, sizeof(buff), default_charset_info)
tmp(buff, sizeof(buff), &my_charset_bin)
{}
in_string::~in_string()
......@@ -1137,7 +1137,7 @@ void in_string::set(uint pos,Item *item)
{
CHARSET_INFO *cs;
if (!(cs= item->charset()))
cs= default_charset_info; // Should never happen for STR items
cs= &my_charset_bin; // Should never happen for STR items
str->set_charset(cs);
}
}
......@@ -1840,7 +1840,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (!regex_compiled && args[1]->const_item())
{
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),default_charset_info);
String tmp(buff,sizeof(buff),&my_charset_bin);
String *res=args[1]->val_str(&tmp);
if (args[1]->null_value)
{ // Will always return NULL
......@@ -1870,7 +1870,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
longlong Item_func_regex::val_int()
{
char buff[MAX_FIELD_WIDTH];
String *res, tmp(buff,sizeof(buff),default_charset_info);
String *res, tmp(buff,sizeof(buff),&my_charset_bin);
res=args[0]->val_str(&tmp);
if (args[0]->null_value)
......@@ -1881,7 +1881,7 @@ longlong Item_func_regex::val_int()
if (!regex_is_const)
{
char buff2[MAX_FIELD_WIDTH];
String *res2, tmp2(buff2,sizeof(buff2),default_charset_info);
String *res2, tmp2(buff2,sizeof(buff2),&my_charset_bin);
res2= args[1]->val_str(&tmp2);
if (args[1]->null_value)
......
......@@ -482,7 +482,7 @@ public:
int cmp(Item *arg)
{
char buff[80];
String tmp(buff, sizeof(buff), default_charset_info), *res;
String tmp(buff, sizeof(buff), cmp_charset), *res;
if (!(res= arg->val_str(&tmp)))
return 1; /* Can't be right */
return sortcmp(value_res, res, cmp_charset);
......
......@@ -1545,7 +1545,7 @@ String *udf_handler::val_str(String *str,String *save_str)
str->length(res_length);
return str;
}
save_str->set(res, res_length, default_charset_info);
save_str->set(res, res_length, str->charset());
return save_str;
}
......
......@@ -62,7 +62,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#endif
#endif
#define my_thd_charset default_charset_info
#define files_charset_info system_charset_info
/***************************************************************************
......
......@@ -3344,7 +3344,9 @@ error:
if (!event_connect_answer) CloseHandle(event_connect_answer);
if (!event_connect_request) CloseHandle(event_connect_request);
pthread_mutex_lock(&LOCK_thread_count);
handler_count--;
pthread_mutex_unlock(&LOCK_thread_count);
pthread_cond_signal(&COND_handler_count);
DBUG_RETURN(0);
}
#endif /* HAVE_SMEM */
......
......@@ -97,7 +97,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
if (!acl_cache)
acl_cache=new hash_filo(ACL_CACHE_SIZE,0,0,
(hash_get_key) acl_entry_get_key,
(hash_free_key) free);
(hash_free_key) free, system_charset_info);
if (dont_read_acl_tables)
{
DBUG_RETURN(0); /* purecov: tested */
......
......@@ -21,6 +21,8 @@
#pragma interface /* gcc class implementation */
#endif
#define my_thd_charset default_charset_info
#define DEC_IN_AVG 4
typedef struct st_number_info
......
......@@ -2292,8 +2292,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
DBUG_ENTER("mysql_create_index");
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
/* TODO: Fix to use database character set */
create_info.table_charset=default_charset_info;
create_info.table_charset= thd->db_charset;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, FALSE,
......@@ -2310,7 +2309,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
DBUG_ENTER("mysql_drop_index");
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
create_info.table_charset=default_charset_info;
create_info.table_charset= thd->db_charset;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, FALSE,
......
......@@ -41,8 +41,9 @@ public:
bool error,line_cuted,found_null,enclosed;
byte *row_start, /* Found row starts here */
*row_end; /* Found row ends here */
CHARSET_INFO *read_charset;
READ_INFO(File file,uint tot_length,
READ_INFO(File file,uint tot_length,CHARSET_INFO *cs,
String &field_term,String &line_start,String &line_term,
String &enclosed,int escape,bool get_it_from_net, bool is_fifo);
~READ_INFO();
......@@ -214,8 +215,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
info.handle_duplicates=handle_duplicates;
info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
READ_INFO read_info(file,tot_length,*field_term,
*ex->line_start, *ex->line_term, *enclosed,
READ_INFO read_info(file,tot_length,thd->db_charset,
*field_term,*ex->line_start, *ex->line_term, *enclosed,
info.escape_char, read_file_from_client, is_fifo);
if (read_info.error)
{
......@@ -402,7 +403,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
field->field_length)
length=field->field_length;
save_chr=pos[length]; pos[length]='\0'; // Safeguard aganst malloc
field->store((char*) pos,length,default_charset_info);
field->store((char*) pos,length,read_info.read_charset);
pos[length]=save_chr;
if ((pos+=length) > read_info.row_end)
pos= read_info.row_end; /* Fills rest with space */
......@@ -483,7 +484,7 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
}
field->set_notnull();
read_info.row_end[0]=0; // Safe to change end marker
field->store((char*) read_info.row_start,length,default_charset_info);
field->store((char*) read_info.row_start,length,read_info.read_charset);
}
if (read_info.error)
break;
......@@ -547,12 +548,13 @@ READ_INFO::unescape(char chr)
*/
READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
String &line_start, String &line_term,
READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
String &field_term, String &line_start, String &line_term,
String &enclosed_par, int escape, bool get_it_from_net,
bool is_fifo)
:file(file_par),escape_char(escape)
{
read_charset= cs;
field_term_ptr=(char*) field_term.ptr();
field_term_length= field_term.length();
line_term_ptr=(char*) line_term.ptr();
......@@ -699,13 +701,13 @@ int READ_INFO::read_field()
{
chr = GET;
#ifdef USE_MB
if (use_mb(default_charset_info) &&
my_ismbhead(default_charset_info, chr) &&
to+my_mbcharlen(default_charset_info, chr) <= end_of_buff)
if (use_mb(read_charset) &&
my_ismbhead(read_charset, chr) &&
to+my_mbcharlen(read_charset, chr) <= end_of_buff)
{
uchar* p = (uchar*)to;
*to++ = chr;
int ml = my_mbcharlen(default_charset_info, chr);
int ml = my_mbcharlen(read_charset, chr);
int i;
for (i=1; i<ml; i++) {
chr = GET;
......@@ -713,7 +715,7 @@ int READ_INFO::read_field()
goto found_eof;
*to++ = chr;
}
if (my_ismbchar(default_charset_info,
if (my_ismbchar(read_charset,
(const char *)p,
(const char *)to))
continue;
......@@ -882,10 +884,10 @@ int READ_INFO::next_line()
{
int chr = GET;
#ifdef USE_MB
if (use_mb(default_charset_info) && my_ismbhead(default_charset_info, chr))
if (use_mb(read_charset) && my_ismbhead(read_charset, chr))
{
for (int i=1;
chr != my_b_EOF && i<my_mbcharlen(default_charset_info, chr);
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);
i++)
chr = GET;
if (chr == escape_char)
......
......@@ -4224,7 +4224,6 @@ option_value:
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
system_variables vars= thd->variables;
CHARSET_INFO *cs= $2 ? $2 : thd->db_charset;
CHARSET_INFO *cl= $3 ? $3 : cs;
......@@ -4241,6 +4240,35 @@ option_value:
find_sys_var("client_collation"),
csname));
}
| COLLATION_SYM collation_name_or_default
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
system_variables *vars= &thd->variables;
CHARSET_INFO *cs= vars->thd_charset;
CHARSET_INFO *cl= $2;
if (!cl)
{
if (!(cl=get_charset_by_csname(cs->csname,MY_CS_PRIMARY,MYF(0))))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"DEFAULT");
YYABORT;
}
}
else if ((cl != cs) && strcmp(cs->csname,cl->csname))
{
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
cl->name,cs->csname);
YYABORT;
}
Item_string *csname= new Item_string(cl->name,
strlen(cl->name),
&my_charset_latin1);
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("client_collation"),
csname));
}
| PASSWORD equal text_or_password
{
THD *thd=YYTHD;
......
......@@ -1162,7 +1162,7 @@ rename_file_ext(const char * from,const char * to,const char * ext)
char *get_field(MEM_ROOT *mem, Field *field)
{
char buff[MAX_FIELD_WIDTH];
String str(buff,sizeof(buff),default_charset_info);
String str(buff,sizeof(buff),&my_charset_bin);
field->val_str(&str,&str);
uint length=str.length();
if (!length)
......
......@@ -486,7 +486,7 @@ static bool pack_fields(File file,List<create_field> &create_fields)
/* Write intervals */
if (int_count)
{
String tmp((char*) buff,sizeof(buff), default_charset_info);
String tmp((char*) buff,sizeof(buff), &my_charset_bin);
tmp.length(0);
it.rewind();
int_count=0;
......@@ -598,9 +598,9 @@ static bool make_empty_rec(File file,enum db_type table_type,
regfield->store((longlong) 1);
}
else if (type == Field::YES) // Old unireg type
regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)),default_charset_info);
regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)),system_charset_info);
else if (type == Field::NO) // Old unireg type
regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)),default_charset_info);
regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)),system_charset_info);
else
regfield->reset();
delete regfield;
......
......@@ -368,7 +368,7 @@ useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" mysql 2> /dev/nul
chown -R mysql $mysql_datadir
# Initiate databases
mysql_install_db -IN-RPM
mysql_install_db --rpm
# Change permissions again to fix any new files.
chown -R mysql $mysql_datadir
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment