Commit 0c911187 authored by unknown's avatar unknown

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

into sinisa.nasamreza.org:/mnt/work/mysql-4.1


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