mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-derived-4.1 sql/item.cc: Auto merged
This commit is contained in:
commit
5895f3772e
48 changed files with 341 additions and 227 deletions
|
@ -21,6 +21,7 @@ heikki@donna.mysql.fi
|
|||
heikki@hundin.mysql.fi
|
||||
heikki@rescue.
|
||||
heikki@work.mysql.com
|
||||
hf@deer.mysql.r18.ru
|
||||
hf@genie.(none)
|
||||
jani@dsl-jkl1657.dial.inet.fi
|
||||
jani@hynda.(none)
|
||||
|
|
|
@ -57,6 +57,7 @@ enum enum_server_command
|
|||
#define BLOB_FLAG 16 /* Field is a blob */
|
||||
#define UNSIGNED_FLAG 32 /* Field is unsigned */
|
||||
#define ZEROFILL_FLAG 64 /* Field is zerofill */
|
||||
#define BINARY_FLAG 128 /* Field is binary */
|
||||
|
||||
/* The following are only sent to new clients */
|
||||
#define ENUM_FLAG 256 /* field is an enum */
|
||||
|
@ -292,11 +293,11 @@ int get_password_length(my_bool force_old_scramble);
|
|||
char get_password_version(const char* password);
|
||||
void create_random_string(int length,struct rand_struct *rand_st,char* target);
|
||||
my_bool validate_password(const char* password, const char* message,
|
||||
ulong* salt);
|
||||
unsigned long* salt);
|
||||
void password_hash_stage1(char *to, const char *password);
|
||||
void password_hash_stage2(char *to,const char *salt);
|
||||
void password_crypt(const char* from,char* to, const char* password,int length);
|
||||
void get_hash_and_password(ulong* salt, unsigned char pversion,char* hash,
|
||||
void get_hash_and_password(unsigned long* salt, unsigned char pversion,char* hash,
|
||||
unsigned char* bin_password);
|
||||
void get_salt_from_password(unsigned long *res,const char *password);
|
||||
void create_key_from_old_password(const char* password,char* key);
|
||||
|
|
|
@ -937,7 +937,7 @@ static TYPELIB option_types={array_elements(default_options)-1,
|
|||
|
||||
static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
||||
{
|
||||
char **ptr, *tmp;
|
||||
char *tmp;
|
||||
|
||||
if (!options->init_commands)
|
||||
{
|
||||
|
@ -947,7 +947,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
|||
}
|
||||
|
||||
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
|
||||
insert_dynamic(options->init_commands, &tmp))
|
||||
insert_dynamic(options->init_commands, (gptr)&tmp))
|
||||
{
|
||||
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
|
||||
return 1;
|
||||
|
@ -2623,8 +2623,13 @@ mysql_close(MYSQL *mysql)
|
|||
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
|
||||
if (mysql->options.init_commands)
|
||||
{
|
||||
delete_dynamic(mysql->options.init_commands);
|
||||
my_free((char*)mysql->options.init_commands,MYF(MY_WME));
|
||||
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
|
||||
char **ptr= (char**)init_commands->buffer;
|
||||
char **end= ptr + init_commands->elements;
|
||||
for (; ptr<end; ptr++)
|
||||
my_free(*ptr,MYF(MY_WME));
|
||||
delete_dynamic(init_commands);
|
||||
my_free((char*)init_commands,MYF(MY_WME));
|
||||
}
|
||||
#ifdef HAVE_OPENSSL
|
||||
mysql_ssl_free(mysql);
|
||||
|
|
|
@ -453,7 +453,7 @@ static TYPELIB option_types={array_elements(default_options)-1,
|
|||
|
||||
static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
||||
{
|
||||
char **ptr, *tmp;
|
||||
char *tmp;
|
||||
|
||||
if (!options->init_commands)
|
||||
{
|
||||
|
@ -463,7 +463,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
|||
}
|
||||
|
||||
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
|
||||
insert_dynamic(options->init_commands, &tmp))
|
||||
insert_dynamic(options->init_commands, (gptr)&tmp))
|
||||
{
|
||||
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
|
||||
return 1;
|
||||
|
@ -1152,8 +1152,13 @@ mysql_close(MYSQL *mysql)
|
|||
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
|
||||
if (mysql->options.init_commands)
|
||||
{
|
||||
delete_dynamic(mysql->options.init_commands);
|
||||
my_free((char*)mysql->options.init_commands,MYF(MY_WME));
|
||||
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
|
||||
char **ptr= (char**)init_commands->buffer;
|
||||
char **end= ptr + init_commands->elements;
|
||||
for (; ptr<end; ptr++)
|
||||
my_free(*ptr,MYF(MY_WME));
|
||||
delete_dynamic(init_commands);
|
||||
my_free((char*)init_commands,MYF(MY_WME));
|
||||
}
|
||||
/* Clear pointers for better safety */
|
||||
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (
|
||||
comment CHAR(32) CHARACTER SET latin1 NOT NULL,
|
||||
comment CHAR(32) ASCII NOT NULL,
|
||||
koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL
|
||||
) CHARSET=latin5;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
@ -336,6 +336,11 @@ CYR CAPIT SOFT SIGN
|
|||
CYR CAPIT E ü Đ
|
||||
CYR CAPIT YU ŕ ĐŽ
|
||||
CYR CAPIT YA ń ĐŻ
|
||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
|
||||
COUNT(DISTINCT bin_f) COUNT(DISTINCT koi8_ru_f) COUNT(DISTINCT utf8_f)
|
||||
116 58 57
|
||||
SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
|
||||
koi8_ru_f MIN(comment)
|
||||
a LAT CAPIT A
|
||||
|
@ -1291,7 +1296,8 @@ CYR CAPIT YA CYR CAPIT YA
|
|||
CYR CAPIT YA CYR SMALL YA
|
||||
CYR SMALL YA CYR CAPIT YA
|
||||
CYR SMALL YA CYR SMALL YA
|
||||
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2 NOT NULL;
|
||||
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
|
||||
ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
|
||||
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
|
||||
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
|
||||
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
|
||||
|
|
|
@ -32,7 +32,7 @@ a
|
|||
1
|
||||
SELECT 1 FROM (SELECT (SELECT a) b) c;
|
||||
Unknown column 'a' in 'field list'
|
||||
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1);
|
||||
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
|
||||
id
|
||||
1
|
||||
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
|
||||
|
@ -705,3 +705,9 @@ select 10.5 > ANY (SELECT * from t);
|
|||
10.5 > ANY (SELECT * from t)
|
||||
1
|
||||
drop table t;
|
||||
create table t (a float);
|
||||
select 10.5 IN (SELECT * from t LIMIT 1);
|
||||
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
|
||||
select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5);
|
||||
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
|
||||
drop table t;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
comment CHAR(32) CHARACTER SET latin1 NOT NULL,
|
||||
comment CHAR(32) ASCII NOT NULL,
|
||||
koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL
|
||||
) CHARSET=latin5;
|
||||
|
||||
|
@ -137,9 +137,12 @@ SELECT CONVERT(koi8_ru_f USING utf8),MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
|
|||
|
||||
ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL;
|
||||
UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
|
||||
|
||||
SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
|
||||
SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
|
||||
SELECT DISTINCT koi8_ru_f FROM t1;
|
||||
|
@ -156,7 +159,8 @@ FROM t1 t11,t1 t12
|
|||
WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru)
|
||||
ORDER BY t12.utf8_f,t11.comment,t12.comment;
|
||||
|
||||
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2 NOT NULL;
|
||||
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
|
||||
ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
|
||||
|
||||
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
|
||||
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
|
||||
|
|
|
@ -15,7 +15,7 @@ SELECT (SELECT 1), a;
|
|||
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
|
||||
-- error 1054
|
||||
SELECT 1 FROM (SELECT (SELECT a) b) c;
|
||||
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1);
|
||||
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
|
||||
-- error 1239
|
||||
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
|
||||
SELECT 1 IN (SELECT 1);
|
||||
|
@ -409,3 +409,11 @@ select 10.5 > ALL (SELECT * from t);
|
|||
select 1.5 > ANY (SELECT * from t);
|
||||
select 10.5 > ANY (SELECT * from t);
|
||||
drop table t;
|
||||
|
||||
#LIMIT is not supported now
|
||||
create table t (a float);
|
||||
-- error 1235
|
||||
select 10.5 IN (SELECT * from t LIMIT 1);
|
||||
-- error 1235
|
||||
select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5);
|
||||
drop table t;
|
|
@ -52,7 +52,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
|
|||
field.h handler.h \
|
||||
ha_isammrg.h ha_isam.h ha_myisammrg.h\
|
||||
ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \
|
||||
opt_range.h opt_ft.h \
|
||||
opt_range.h opt_ft.h protocol.h \
|
||||
sql_select.h structs.h table.h sql_udf.h hash_filo.h\
|
||||
lex.h lex_symbol.h sql_acl.h sql_crypt.h \
|
||||
log_event.h mini_client.h sql_repl.h slave.h \
|
||||
|
|
|
@ -34,6 +34,8 @@ static int initialized;
|
|||
1 Error
|
||||
*/
|
||||
|
||||
#define des_cs my_charset_latin1
|
||||
|
||||
bool
|
||||
load_des_key_file(const char *file_name)
|
||||
{
|
||||
|
@ -70,10 +72,10 @@ load_des_key_file(const char *file_name)
|
|||
{
|
||||
offset=(char) (offset - '0');
|
||||
// Remove newline and possible other control characters
|
||||
for (start=buf+1 ; my_isspace(system_charset_info, *start) ; start++) ;
|
||||
for (start=buf+1 ; my_isspace(des_cs, *start) ; start++) ;
|
||||
end=buf+length;
|
||||
for (end=strend(buf) ;
|
||||
end > start && !my_isgraph(system_charset_info, end[-1]) ; end--) ;
|
||||
end > start && !my_isgraph(des_cs, end[-1]) ; end--) ;
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
|
|
61
sql/field.cc
61
sql/field.cc
|
@ -287,7 +287,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
|
|||
bool Field::get_date(TIME *ltime,bool fuzzydate)
|
||||
{
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),tmp2,*res;
|
||||
String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res;
|
||||
if (!(res=val_str(&tmp,&tmp2)) ||
|
||||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
|
||||
return 1;
|
||||
|
@ -297,7 +297,7 @@ bool Field::get_date(TIME *ltime,bool fuzzydate)
|
|||
bool Field::get_time(TIME *ltime)
|
||||
{
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),tmp2,*res;
|
||||
String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res;
|
||||
if (!(res=val_str(&tmp,&tmp2)) ||
|
||||
str_to_time(res->ptr(),res->length(),ltime))
|
||||
return 1;
|
||||
|
@ -404,6 +404,12 @@ void Field_decimal::overflow(bool negative)
|
|||
|
||||
int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
||||
{
|
||||
String l1from;
|
||||
|
||||
l1from.copy(from,len,cs,my_charset_latin1);
|
||||
from=l1from.ptr();
|
||||
len=l1from.length();
|
||||
|
||||
const char *end= from+len;
|
||||
/* The pointer where the field value starts (i.e., "where to write") */
|
||||
char *to=ptr;
|
||||
|
@ -463,7 +469,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||
tmp_dec++;
|
||||
|
||||
/* skip pre-space */
|
||||
while (from != end && my_isspace(system_charset_info,*from))
|
||||
while (from != end && my_isspace(my_charset_latin1,*from))
|
||||
from++;
|
||||
if (from == end)
|
||||
{
|
||||
|
@ -500,13 +506,13 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||
for (; from!=end && *from == '0'; from++) ; // Read prezeros
|
||||
pre_zeros_end=int_digits_from=from;
|
||||
/* Read non zero digits at the left of '.'*/
|
||||
for (; from != end && my_isdigit(system_charset_info, *from) ; from++) ;
|
||||
for (; from != end && my_isdigit(my_charset_latin1, *from) ; from++) ;
|
||||
int_digits_end=from;
|
||||
if (from!=end && *from == '.') // Some '.' ?
|
||||
from++;
|
||||
frac_digits_from= from;
|
||||
/* Read digits at the right of '.' */
|
||||
for (;from!=end && my_isdigit(system_charset_info, *from); from++) ;
|
||||
for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) ;
|
||||
frac_digits_end=from;
|
||||
// Some exponentiation symbol ?
|
||||
if (from != end && (*from == 'e' || *from == 'E'))
|
||||
|
@ -522,7 +528,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||
exponents will become small (e.g. 1e4294967296 will become 1e0, and the
|
||||
field will finally contain 1 instead of its max possible value).
|
||||
*/
|
||||
for (;from!=end && my_isdigit(system_charset_info, *from); from++)
|
||||
for (;from!=end && my_isdigit(my_charset_latin1, *from); from++)
|
||||
{
|
||||
exponent=10*exponent+(*from-'0');
|
||||
if (exponent>MAX_EXPONENT)
|
||||
|
@ -540,7 +546,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||
if (current_thd->count_cuted_fields)
|
||||
{
|
||||
// Skip end spaces
|
||||
for (;from != end && my_isspace(system_charset_info, *from); from++) ;
|
||||
for (;from != end && my_isspace(my_charset_latin1, *from); from++) ;
|
||||
if (from != end) // If still something left, warn
|
||||
{
|
||||
current_thd->cuted_fields++;
|
||||
|
@ -849,12 +855,13 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
|
|||
String *val_ptr)
|
||||
{
|
||||
char *str;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
for (str=ptr ; *str == ' ' ; str++) ;
|
||||
uint tmp_length=(uint) (str-ptr);
|
||||
if (field_length < tmp_length) // Error in data
|
||||
val_ptr->length(0);
|
||||
else
|
||||
val_ptr->set((const char*) str,field_length-tmp_length,default_charset_info);
|
||||
val_ptr->copy((const char*) str,field_length-tmp_length,my_charset_latin1,cs);
|
||||
return val_ptr;
|
||||
}
|
||||
|
||||
|
@ -871,9 +878,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr)
|
|||
for (end=a_ptr+field_length;
|
||||
a_ptr != end &&
|
||||
(*a_ptr == *b_ptr ||
|
||||
((my_isspace(system_charset_info,*a_ptr) || *a_ptr == '+' ||
|
||||
((my_isspace(my_charset_latin1,*a_ptr) || *a_ptr == '+' ||
|
||||
*a_ptr == '0') &&
|
||||
(my_isspace(system_charset_info,*b_ptr) || *b_ptr == '+' ||
|
||||
(my_isspace(my_charset_latin1,*b_ptr) || *b_ptr == '+' ||
|
||||
*b_ptr == '0')));
|
||||
a_ptr++,b_ptr++)
|
||||
{
|
||||
|
@ -901,7 +908,7 @@ void Field_decimal::sort_string(char *to,uint length)
|
|||
char *str,*end;
|
||||
for (str=ptr,end=ptr+length;
|
||||
str != end &&
|
||||
((my_isspace(system_charset_info,*str) || *str == '+' ||
|
||||
((my_isspace(my_charset_latin1,*str) || *str == '+' ||
|
||||
*str == '0')) ;
|
||||
str++)
|
||||
*to++=' ';
|
||||
|
@ -913,7 +920,7 @@ void Field_decimal::sort_string(char *to,uint length)
|
|||
*to++=1; // Smaller than any number
|
||||
str++;
|
||||
while (str != end)
|
||||
if (my_isdigit(system_charset_info,*str))
|
||||
if (my_isdigit(my_charset_latin1,*str))
|
||||
*to++= (char) ('9' - *str++);
|
||||
else
|
||||
*to++= *str++;
|
||||
|
@ -1091,7 +1098,7 @@ longlong Field_tiny::val_int(void)
|
|||
String *Field_tiny::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,5*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -1330,7 +1337,7 @@ longlong Field_short::val_int(void)
|
|||
String *Field_short::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,7*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -1574,7 +1581,7 @@ longlong Field_medium::val_int(void)
|
|||
String *Field_medium::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,10*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -1810,7 +1817,7 @@ longlong Field_long::val_int(void)
|
|||
String *Field_long::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,12*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -2035,7 +2042,7 @@ longlong Field_longlong::val_int(void)
|
|||
String *Field_longlong::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,22*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -4269,7 +4276,7 @@ uint Field_varstring::max_packed_col_length(uint max_length)
|
|||
return (max_length > 255 ? 2 : 1)+max_length;
|
||||
}
|
||||
|
||||
void Field_varstring::get_key_image(char *buff, uint length, imagetype type)
|
||||
void Field_varstring::get_key_image(char *buff, uint length, CHARSET_INFO *cs,imagetype type)
|
||||
{
|
||||
length-= HA_KEY_BLOB_LENGTH;
|
||||
uint f_length=uint2korr(ptr);
|
||||
|
@ -4283,10 +4290,10 @@ void Field_varstring::get_key_image(char *buff, uint length, imagetype type)
|
|||
#endif
|
||||
}
|
||||
|
||||
void Field_varstring::set_key_image(char *buff,uint length)
|
||||
void Field_varstring::set_key_image(char *buff,uint length, CHARSET_INFO *cs)
|
||||
{
|
||||
length=uint2korr(buff); // Real length is here
|
||||
(void) Field_varstring::store(buff+2, length, default_charset_info);
|
||||
(void) Field_varstring::store(buff+2, length, cs);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4432,14 +4439,14 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_blob::store(double nr)
|
||||
{
|
||||
value.set(nr,2,current_thd->thd_charset);
|
||||
value.set(nr,2,current_thd->variables.thd_charset);
|
||||
return Field_blob::store(value.ptr(),(uint) value.length(), value.charset());
|
||||
}
|
||||
|
||||
|
||||
int Field_blob::store(longlong nr)
|
||||
{
|
||||
value.set(nr,current_thd->thd_charset);
|
||||
value.set(nr,current_thd->variables.thd_charset);
|
||||
return Field_blob::store(value.ptr(), (uint) value.length(), value.charset());
|
||||
}
|
||||
|
||||
|
@ -4535,7 +4542,7 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
|
|||
|
||||
/* The following is used only when comparing a key */
|
||||
|
||||
void Field_blob::get_key_image(char *buff,uint length, imagetype type)
|
||||
void Field_blob::get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type)
|
||||
{
|
||||
length-= HA_KEY_BLOB_LENGTH;
|
||||
uint32 blob_length= get_length(ptr);
|
||||
|
@ -4570,14 +4577,14 @@ void Field_blob::get_key_image(char *buff,uint length, imagetype type)
|
|||
memcpy(buff+2,blob,length);
|
||||
}
|
||||
|
||||
void Field_blob::set_key_image(char *buff,uint length)
|
||||
void Field_blob::set_key_image(char *buff,uint length, CHARSET_INFO *cs)
|
||||
{
|
||||
length=uint2korr(buff);
|
||||
(void) Field_blob::store(buff+2,length, default_charset_info);
|
||||
(void) Field_blob::store(buff+2,length,cs);
|
||||
}
|
||||
|
||||
|
||||
void Field_geom::get_key_image(char *buff,uint length, imagetype type)
|
||||
void Field_geom::get_key_image(char *buff,uint length,CHARSET_INFO *cs, imagetype type)
|
||||
{
|
||||
length-=HA_KEY_BLOB_LENGTH;
|
||||
ulong blob_length=get_length(ptr);
|
||||
|
@ -4596,7 +4603,7 @@ void Field_geom::get_key_image(char *buff,uint length, imagetype type)
|
|||
return;
|
||||
}
|
||||
|
||||
void Field_geom::set_key_image(char *buff,uint length)
|
||||
void Field_geom::set_key_image(char *buff,uint length,CHARSET_INFO *cs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
32
sql/field.h
32
sql/field.h
|
@ -132,7 +132,7 @@ public:
|
|||
tmp->key_start= tmp->part_of_key= tmp->part_of_sortkey= 0;
|
||||
tmp->unireg_check=Field::NONE;
|
||||
tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG |
|
||||
ZEROFILL_FLAG | ENUM_FLAG | SET_FLAG);
|
||||
ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG);
|
||||
tmp->table_name= new_table->table_name;
|
||||
tmp->reset_fields();
|
||||
}
|
||||
|
@ -149,14 +149,14 @@ public:
|
|||
if (null_ptr)
|
||||
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*);
|
||||
}
|
||||
inline void get_image(char *buff,uint length)
|
||||
inline void get_image(char *buff,uint length, CHARSET_INFO *cs)
|
||||
{ memcpy(buff,ptr,length); }
|
||||
inline void set_image(char *buff,uint length)
|
||||
inline void set_image(char *buff,uint length, CHARSET_INFO *cs)
|
||||
{ memcpy(ptr,buff,length); }
|
||||
virtual void get_key_image(char *buff,uint length, imagetype type)
|
||||
{ get_image(buff,length); }
|
||||
virtual void set_key_image(char *buff,uint length)
|
||||
{ set_image(buff,length); }
|
||||
virtual void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type)
|
||||
{ get_image(buff,length,cs); }
|
||||
virtual void set_key_image(char *buff,uint length, CHARSET_INFO *cs)
|
||||
{ set_image(buff,length,cs); }
|
||||
inline int cmp_image(char *buff,uint length)
|
||||
{ return memcmp(ptr,buff,length); }
|
||||
inline longlong val_int_offset(uint row_offset)
|
||||
|
@ -260,7 +260,11 @@ public:
|
|||
struct st_table *table_arg,CHARSET_INFO *charset)
|
||||
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, table_arg)
|
||||
{ field_charset=charset; }
|
||||
{
|
||||
field_charset=charset;
|
||||
if (binary())
|
||||
flags|=BINARY_FLAG;
|
||||
}
|
||||
Item_result result_type () const { return STRING_RESULT; }
|
||||
void add_binary_or_charset(String &res) const;
|
||||
uint decimals() const { return NOT_FIXED_DEC; }
|
||||
|
@ -832,8 +836,8 @@ public:
|
|||
bool send_binary(Protocol *protocol);
|
||||
int cmp(const char *,const char*);
|
||||
void sort_string(char *buff,uint length);
|
||||
void get_key_image(char *buff,uint length, imagetype type);
|
||||
void set_key_image(char *buff,uint length);
|
||||
void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type);
|
||||
void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
|
||||
void sql_type(String &str) const;
|
||||
char *pack(char *to, const char *from, uint max_length=~(uint) 0);
|
||||
const char *unpack(char* to, const char *from);
|
||||
|
@ -904,8 +908,8 @@ public:
|
|||
store_length(length);
|
||||
memcpy_fixed(ptr+packlength,&data,sizeof(char*));
|
||||
}
|
||||
void get_key_image(char *buff,uint length, imagetype type);
|
||||
void set_key_image(char *buff,uint length);
|
||||
void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type);
|
||||
void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
|
||||
void sql_type(String &str) const;
|
||||
inline bool copy()
|
||||
{ char *tmp;
|
||||
|
@ -946,8 +950,8 @@ public:
|
|||
table_arg, my_charset_bin) {}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; }
|
||||
|
||||
void get_key_image(char *buff,uint length, imagetype type);
|
||||
void set_key_image(char *buff,uint length);
|
||||
void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type);
|
||||
void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ static void do_conv_blob(Copy_field *copy)
|
|||
static void do_save_blob(Copy_field *copy)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String res(buff,sizeof(buff),default_charset_info);
|
||||
String res(buff,sizeof(buff),copy->tmp.charset());
|
||||
copy->from_field->val_str(&res,&res);
|
||||
copy->tmp.copy(res);
|
||||
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(),
|
||||
|
@ -284,7 +284,7 @@ static void do_save_blob(Copy_field *copy)
|
|||
static void do_field_string(Copy_field *copy)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
copy->tmp.set_quick(buff,sizeof(buff),default_charset_info);
|
||||
copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset());
|
||||
copy->from_field->val_str(©->tmp,©->tmp);
|
||||
copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(),copy->tmp.charset());
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ static void do_cut_string(Copy_field *copy)
|
|||
ptr != end ;
|
||||
ptr++)
|
||||
{
|
||||
if (!my_isspace(system_charset_info, *ptr))
|
||||
if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible
|
||||
{
|
||||
current_thd->cuted_fields++; // Give a warning
|
||||
break;
|
||||
|
@ -555,7 +555,7 @@ void field_conv(Field *to,Field *from)
|
|||
to->type() == FIELD_TYPE_DECIMAL)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String result(buff,sizeof(buff),default_charset_info);
|
||||
String result(buff,sizeof(buff),from->charset());
|
||||
from->val_str(&result,&result);
|
||||
to->store(result.c_ptr_quick(),result.length(),to->charset());
|
||||
// QQ: what to do if "from" and "to" are of dirrent charsets?
|
||||
|
|
|
@ -470,10 +470,11 @@ static void make_sortkey(register SORTPARAM *param,
|
|||
switch (sort_field->result_type) {
|
||||
case STRING_RESULT:
|
||||
{
|
||||
CHARSET_INFO *cs=item->charset();
|
||||
if (item->maybe_null)
|
||||
*to++=1;
|
||||
/* All item->str() to use some extra byte for end null.. */
|
||||
String tmp((char*) to,sort_field->length+4,default_charset_info);
|
||||
String tmp((char*) to,sort_field->length+4,cs);
|
||||
String *res=item->val_str(&tmp);
|
||||
if (!res)
|
||||
{
|
||||
|
@ -488,7 +489,6 @@ static void make_sortkey(register SORTPARAM *param,
|
|||
break;
|
||||
}
|
||||
length=res->length();
|
||||
CHARSET_INFO *cs=res->charset();
|
||||
int diff=(int) (sort_field->length-length);
|
||||
if (diff < 0)
|
||||
{
|
||||
|
|
|
@ -221,10 +221,10 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
|
|||
|
||||
/* Don't accept hostnames that starts with digits because they may be
|
||||
false ip:s */
|
||||
if (my_isdigit(system_charset_info,name[0]))
|
||||
if (my_isdigit(my_charset_latin1,name[0]))
|
||||
{
|
||||
char *pos;
|
||||
for (pos= name+1 ; my_isdigit(system_charset_info,*pos); pos++) ;
|
||||
for (pos= name+1 ; my_isdigit(my_charset_latin1,*pos); pos++) ;
|
||||
if (*pos == '.')
|
||||
{
|
||||
DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'"));
|
||||
|
|
14
sql/item.cc
14
sql/item.cc
|
@ -121,7 +121,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
|
|||
bool Item::get_date(TIME *ltime,bool fuzzydate)
|
||||
{
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),*res;
|
||||
String tmp(buff,sizeof(buff),NULL),*res;
|
||||
if (!(res=val_str(&tmp)) ||
|
||||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate)
|
|||
bool Item::get_time(TIME *ltime)
|
||||
{
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),*res;
|
||||
String tmp(buff,sizeof(buff),NULL),*res;
|
||||
if (!(res=val_str(&tmp)) ||
|
||||
str_to_time(res->ptr(),res->length(),ltime))
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ bool Item::get_time(TIME *ltime)
|
|||
|
||||
CHARSET_INFO * Item::thd_charset() const
|
||||
{
|
||||
return current_thd->thd_charset;
|
||||
return current_thd->variables.thd_charset;
|
||||
}
|
||||
|
||||
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
|
||||
|
@ -1150,7 +1150,7 @@ Item *resolve_const_item(Item *item,Item *comp_item)
|
|||
if (res_type == STRING_RESULT)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),*result;
|
||||
String tmp(buff,sizeof(buff),NULL),*result;
|
||||
result=item->val_str(&tmp);
|
||||
if (item->null_value)
|
||||
{
|
||||
|
@ -1164,7 +1164,7 @@ Item *resolve_const_item(Item *item,Item *comp_item)
|
|||
#ifdef DELETE_ITEMS
|
||||
delete item;
|
||||
#endif
|
||||
return new Item_string(name,tmp_str,length,default_charset_info);
|
||||
return new Item_string(name,tmp_str,length,result->charset());
|
||||
}
|
||||
if (res_type == INT_RESULT)
|
||||
{
|
||||
|
@ -1205,8 +1205,8 @@ bool field_is_equal_to_item(Field *field,Item *item)
|
|||
{
|
||||
char item_buff[MAX_FIELD_WIDTH];
|
||||
char field_buff[MAX_FIELD_WIDTH];
|
||||
String item_tmp(item_buff,sizeof(item_buff),default_charset_info),*item_result;
|
||||
String field_tmp(field_buff,sizeof(field_buff),default_charset_info);
|
||||
String item_tmp(item_buff,sizeof(item_buff),NULL),*item_result;
|
||||
String field_tmp(field_buff,sizeof(field_buff),NULL);
|
||||
item_result=item->val_str(&item_tmp);
|
||||
if (item->null_value)
|
||||
return 1; // This must be true
|
||||
|
|
|
@ -99,7 +99,7 @@ bool Item_field_buff::cmp(void)
|
|||
{
|
||||
bool tmp= field->cmp(buff) != 0; // This is not a blob!
|
||||
if (tmp)
|
||||
field->get_image(buff,length);
|
||||
field->get_image(buff,length,field->charset());
|
||||
if (null_value != field->is_null())
|
||||
{
|
||||
null_value= !null_value;
|
||||
|
|
|
@ -878,7 +878,7 @@ String *Item_func_case::val_str(String *str)
|
|||
longlong Item_func_case::val_int()
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String dummy_str(buff,sizeof(buff),default_charset_info);
|
||||
String dummy_str(buff,sizeof(buff),thd_charset());
|
||||
Item *item=find_item(&dummy_str);
|
||||
longlong res;
|
||||
|
||||
|
@ -895,7 +895,7 @@ longlong Item_func_case::val_int()
|
|||
double Item_func_case::val()
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String dummy_str(buff,sizeof(buff),default_charset_info);
|
||||
String dummy_str(buff,sizeof(buff),thd_charset());
|
||||
Item *item=find_item(&dummy_str);
|
||||
double res;
|
||||
|
||||
|
|
|
@ -1883,7 +1883,7 @@ longlong Item_func_set_last_insert_id::val_int()
|
|||
longlong Item_func_benchmark::val_int()
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff), default_charset_info);
|
||||
String tmp(buff,sizeof(buff), NULL);
|
||||
THD *thd=current_thd;
|
||||
|
||||
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
|
||||
|
@ -2029,7 +2029,7 @@ Item_func_set_user_var::update()
|
|||
case STRING_RESULT:
|
||||
{
|
||||
char buffer[MAX_FIELD_WIDTH];
|
||||
String tmp(buffer,sizeof(buffer),default_charset_info);
|
||||
String tmp(buffer,sizeof(buffer),NULL);
|
||||
(void) val_str(&tmp);
|
||||
break;
|
||||
}
|
||||
|
@ -2221,7 +2221,7 @@ longlong Item_func_inet_aton::val_int()
|
|||
char c = '.'; // we mark c to indicate invalid IP in case length is 0
|
||||
char buff[36];
|
||||
|
||||
String *s,tmp(buff,sizeof(buff),default_charset_info);
|
||||
String *s,tmp(buff,sizeof(buff),NULL);
|
||||
if (!(s = args[0]->val_str(&tmp))) // If null value
|
||||
goto err;
|
||||
null_value=0;
|
||||
|
@ -2275,7 +2275,7 @@ void Item_func_match::init_search(bool no_order)
|
|||
|
||||
String *ft_tmp= 0;
|
||||
char tmp1[FT_QUERY_MAXLEN];
|
||||
String tmp2(tmp1,sizeof(tmp1),default_charset_info);
|
||||
String tmp2(tmp1,sizeof(tmp1),NULL);
|
||||
|
||||
// MATCH ... AGAINST (NULL) is meaningless, but possible
|
||||
if (!(ft_tmp=key_item()->val_str(&tmp2)))
|
||||
|
|
|
@ -1383,14 +1383,14 @@ String *Item_func_database::val_str(String *str)
|
|||
str->length(0);
|
||||
else
|
||||
str->copy((const char*) thd->db,(uint) strlen(thd->db),
|
||||
system_charset_info, thd->thd_charset);
|
||||
system_charset_info, thd->variables.thd_charset);
|
||||
return str;
|
||||
}
|
||||
|
||||
String *Item_func_user::val_str(String *str)
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
CHARSET_INFO *cs=thd->thd_charset;
|
||||
CHARSET_INFO *cs=thd->variables.thd_charset;
|
||||
const char *host=thd->host ? thd->host : thd->ip ? thd->ip : "";
|
||||
uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen;
|
||||
|
||||
|
@ -1438,6 +1438,8 @@ String *Item_func_soundex::val_str(String *str)
|
|||
{
|
||||
String *res =args[0]->val_str(str);
|
||||
char last_ch,ch;
|
||||
CHARSET_INFO *cs=my_charset_latin1;
|
||||
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
|
||||
|
@ -1445,22 +1447,23 @@ String *Item_func_soundex::val_str(String *str)
|
|||
return str; /* purecov: inspected */
|
||||
char *to= (char *) tmp_value.ptr();
|
||||
char *from= (char *) res->ptr(), *end=from+res->length();
|
||||
|
||||
while (from != end && my_isspace(str->charset(),*from)) // Skip pre-space
|
||||
tmp_value.set_charset(cs);
|
||||
|
||||
while (from != end && my_isspace(cs,*from)) // Skip pre-space
|
||||
from++; /* purecov: inspected */
|
||||
if (from == end)
|
||||
return &empty_string; // No alpha characters.
|
||||
*to++ = my_toupper(str->charset(),*from);// Copy first letter
|
||||
last_ch = get_scode(str->charset(),from);// code of the first letter
|
||||
*to++ = my_toupper(cs,*from); // Copy first letter
|
||||
last_ch = get_scode(cs,from); // code of the first letter
|
||||
// for the first 'double-letter check.
|
||||
// Loop on input letters until
|
||||
// end of input (null) or output
|
||||
// letter code count = 3
|
||||
for (from++ ; from < end ; from++)
|
||||
{
|
||||
if (!my_isalpha(str->charset(),*from))
|
||||
if (!my_isalpha(cs,*from))
|
||||
continue;
|
||||
ch=get_scode(str->charset(),from);
|
||||
ch=get_scode(cs,from);
|
||||
if ((ch != '0') && (ch != last_ch)) // if not skipped or double
|
||||
{
|
||||
*to++ = ch; // letter, copy to output
|
||||
|
@ -2436,7 +2439,8 @@ General functions for spatial objects
|
|||
String *Item_func_geometry_from_text::val_str(String *str)
|
||||
{
|
||||
Geometry geom;
|
||||
String *wkt = args[0]->val_str(str);
|
||||
String arg_val;
|
||||
String *wkt = args[0]->val_str(&arg_val);
|
||||
GTextReadStream trs(wkt->ptr(), wkt->length());
|
||||
|
||||
str->length(0);
|
||||
|
@ -2454,7 +2458,8 @@ void Item_func_geometry_from_text::fix_length_and_dec()
|
|||
|
||||
String *Item_func_as_text::val_str(String *str)
|
||||
{
|
||||
String *wkt = args[0]->val_str(str);
|
||||
String arg_val;
|
||||
String *wkt = args[0]->val_str(&arg_val);
|
||||
Geometry geom;
|
||||
|
||||
if ((null_value=(args[0]->null_value ||
|
||||
|
@ -2491,7 +2496,8 @@ String *Item_func_geometry_type::val_str(String *str)
|
|||
|
||||
String *Item_func_envelope::val_str(String *str)
|
||||
{
|
||||
String *wkb = args[0]->val_str(str);
|
||||
String arg_val;
|
||||
String *wkb = args[0]->val_str(&arg_val);
|
||||
Geometry geom;
|
||||
|
||||
null_value = args[0]->null_value ||
|
||||
|
@ -2504,7 +2510,8 @@ String *Item_func_envelope::val_str(String *str)
|
|||
|
||||
String *Item_func_centroid::val_str(String *str)
|
||||
{
|
||||
String *wkb = args[0]->val_str(str);
|
||||
String arg_val;
|
||||
String *wkb = args[0]->val_str(&arg_val);
|
||||
Geometry geom;
|
||||
|
||||
null_value = args[0]->null_value ||
|
||||
|
@ -2522,7 +2529,8 @@ String *Item_func_centroid::val_str(String *str)
|
|||
|
||||
String *Item_func_spatial_decomp::val_str(String *str)
|
||||
{
|
||||
String *wkb = args[0]->val_str(str);
|
||||
String arg_val;
|
||||
String *wkb = args[0]->val_str(&arg_val);
|
||||
Geometry geom;
|
||||
|
||||
if ((null_value = (args[0]->null_value ||
|
||||
|
@ -2530,6 +2538,7 @@ String *Item_func_spatial_decomp::val_str(String *str)
|
|||
return 0;
|
||||
|
||||
null_value=1;
|
||||
str->length(0);
|
||||
switch(decomp_func)
|
||||
{
|
||||
case SP_STARTPOINT:
|
||||
|
@ -2559,7 +2568,8 @@ ret:
|
|||
|
||||
String *Item_func_spatial_decomp_n::val_str(String *str)
|
||||
{
|
||||
String *wkb = args[0]->val_str(str);
|
||||
String arg_val;
|
||||
String *wkb = args[0]->val_str(&arg_val);
|
||||
long n = (long) args[1]->val_int();
|
||||
Geometry geom;
|
||||
|
||||
|
@ -2639,6 +2649,7 @@ String *Item_func_point::val_str(String *str)
|
|||
|
||||
String *Item_func_spatial_collection::val_str(String *str)
|
||||
{
|
||||
String arg_value;
|
||||
uint i;
|
||||
|
||||
null_value=1;
|
||||
|
@ -2656,7 +2667,7 @@ String *Item_func_spatial_collection::val_str(String *str)
|
|||
if (args[i]->null_value)
|
||||
goto ret;
|
||||
|
||||
String *res = args[i]->val_str(str);
|
||||
String *res = args[i]->val_str(&arg_value);
|
||||
|
||||
if ( coll_type == Geometry::wkbGeometryCollection )
|
||||
{
|
||||
|
|
|
@ -318,6 +318,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
|
|||
compare_func_creator func)
|
||||
{
|
||||
DBUG_ENTER("Item_in_subselect::single_value_transformer");
|
||||
if (select_lex->master_unit()->global_parameters->select_limit !=
|
||||
HA_POS_ERROR)
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
|
||||
"LIMIT & IN/ALL/ANY/SOME subquery");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
Item_in_optimizer *optimizer;
|
||||
substitution= optimizer= new Item_in_optimizer(left_expr, this);
|
||||
if (!optimizer)
|
||||
|
@ -334,6 +341,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
|
|||
select_lex->master_unit()->dependent= 1;
|
||||
for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select())
|
||||
{
|
||||
if (select_lex->select_limit != HA_POS_ERROR)
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
|
||||
"LIMIT & IN/ALL/ANY/SOME subquery");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
select_lex->dependent= 1;
|
||||
Item *item;
|
||||
if (sl->item_list.elements > 1)
|
||||
|
|
|
@ -542,7 +542,7 @@ void Item_sum_hybrid::reset_field()
|
|||
if (hybrid_type == STRING_RESULT)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),*res;
|
||||
String tmp(buff,sizeof(buff),result_field->charset()),*res;
|
||||
|
||||
res=args[0]->val_str(&tmp);
|
||||
if (args[0]->null_value)
|
||||
|
@ -897,17 +897,17 @@ String *Item_variance_field::val_str(String *str)
|
|||
|
||||
#include "sql_select.h"
|
||||
|
||||
static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2)
|
||||
int simple_raw_key_cmp(void* arg, byte* key1, byte* key2)
|
||||
{
|
||||
return memcmp(key1, key2, *(uint*) arg);
|
||||
}
|
||||
|
||||
static int simple_str_key_cmp(void* arg, byte* key1, byte* key2)
|
||||
int simple_str_key_cmp(void* arg, byte* key1, byte* key2)
|
||||
{
|
||||
/* BAR TODO: remove default_charset_info */
|
||||
return my_strnncoll(default_charset_info,
|
||||
(const uchar*) key1, *(uint*) arg,
|
||||
(const uchar*) key2, *(uint*) arg);
|
||||
Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg;
|
||||
CHARSET_INFO *cs=item->key_charset;
|
||||
uint len=item->key_length;
|
||||
return my_strnncoll(cs, (const uchar*) key1, len, (const uchar*) key2, len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1037,14 +1037,22 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
|||
Field* field = table->field[0];
|
||||
switch(field->type())
|
||||
{
|
||||
/*
|
||||
If we have a string, we must take care of charsets and case
|
||||
sensitivity
|
||||
*/
|
||||
case FIELD_TYPE_STRING:
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
compare_key = (qsort_cmp2)(field->binary() ? simple_raw_key_cmp:
|
||||
simple_str_key_cmp);
|
||||
if (field->binary())
|
||||
{
|
||||
compare_key = (qsort_cmp2)simple_raw_key_cmp;
|
||||
cmp_arg = (void*) &key_length;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
If we have a string, we must take care of charsets and case
|
||||
sensitivity
|
||||
*/
|
||||
compare_key = (qsort_cmp2)simple_str_key_cmp;
|
||||
cmp_arg = (void*) this;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
|
@ -1052,11 +1060,12 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
|||
be compared with memcmp
|
||||
*/
|
||||
compare_key = (qsort_cmp2)simple_raw_key_cmp;
|
||||
cmp_arg = (void*) &key_length;
|
||||
break;
|
||||
}
|
||||
key_length = field->pack_length();
|
||||
cmp_arg = (void*) &key_length;
|
||||
rec_offset = 1;
|
||||
key_charset = field->charset();
|
||||
key_length = field->pack_length();
|
||||
rec_offset = 1;
|
||||
}
|
||||
else // too bad, cannot cheat - there is more than one field
|
||||
{
|
||||
|
|
|
@ -156,7 +156,8 @@ class Item_sum_count_distinct :public Item_sum_int
|
|||
TMP_TABLE_PARAM *tmp_table_param;
|
||||
TREE tree;
|
||||
uint key_length;
|
||||
|
||||
CHARSET_INFO *key_charset;
|
||||
|
||||
// calculated based on max_heap_table_size. If reached,
|
||||
// walk the tree and dump it into MyISAM table
|
||||
uint max_elements_in_tree;
|
||||
|
@ -175,6 +176,8 @@ class Item_sum_count_distinct :public Item_sum_int
|
|||
int tree_to_myisam();
|
||||
|
||||
friend int composite_key_cmp(void* arg, byte* key1, byte* key2);
|
||||
friend int simple_str_key_cmp(void* arg, byte* key1, byte* key2);
|
||||
friend int simple_raw_key_cmp(void* arg, byte* key1, byte* key2);
|
||||
friend int dump_leaf(byte* key, uint32 count __attribute__((unused)),
|
||||
Item_sum_count_distinct* item);
|
||||
|
||||
|
|
|
@ -64,21 +64,21 @@ static String day_names[] =
|
|||
** DAY_TO_SECOND as "D MM:HH:SS", "MM:HH:SS" "HH:SS" or as seconds.
|
||||
*/
|
||||
|
||||
bool get_interval_info(const char *str,uint length,uint count,
|
||||
long *values)
|
||||
bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
|
||||
uint count, long *values)
|
||||
{
|
||||
const char *end=str+length;
|
||||
uint i;
|
||||
while (str != end && !my_isdigit(system_charset_info,*str))
|
||||
while (str != end && !my_isdigit(cs,*str))
|
||||
str++;
|
||||
|
||||
for (i=0 ; i < count ; i++)
|
||||
{
|
||||
long value;
|
||||
for (value=0; str != end && my_isdigit(system_charset_info,*str) ; str++)
|
||||
for (value=0; str != end && my_isdigit(cs,*str) ; str++)
|
||||
value=value*10L + (long) (*str - '0');
|
||||
values[i]= value;
|
||||
while (str != end && !my_isdigit(system_charset_info,*str))
|
||||
while (str != end && !my_isdigit(cs,*str))
|
||||
str++;
|
||||
if (str == end && i != count-1)
|
||||
{
|
||||
|
@ -306,6 +306,7 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
const char *str;
|
||||
uint32 length;
|
||||
LINT_INIT(value); LINT_INIT(str); LINT_INIT(length);
|
||||
CHARSET_INFO *cs=str_value->charset();
|
||||
|
||||
bzero((char*) t,sizeof(*t));
|
||||
if ((int) int_type <= INTERVAL_SECOND)
|
||||
|
@ -328,7 +329,7 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
/* record negative intervalls in t->neg */
|
||||
str=res->ptr();
|
||||
const char *end=str+res->length();
|
||||
while (str != end && my_isspace(system_charset_info,*str))
|
||||
while (str != end && my_isspace(cs,*str))
|
||||
str++;
|
||||
if (str != end && *str == '-')
|
||||
{
|
||||
|
@ -358,26 +359,26 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->second=value;
|
||||
break;
|
||||
case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->year=array[0];
|
||||
t->month=array[1];
|
||||
break;
|
||||
case INTERVAL_DAY_HOUR:
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
break;
|
||||
case INTERVAL_DAY_MINUTE:
|
||||
if (get_interval_info(str,length,3,array))
|
||||
if (get_interval_info(str,length,cs,3,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
t->minute=array[2];
|
||||
break;
|
||||
case INTERVAL_DAY_SECOND:
|
||||
if (get_interval_info(str,length,4,array))
|
||||
if (get_interval_info(str,length,cs,4,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
|
@ -385,20 +386,20 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->second=array[3];
|
||||
break;
|
||||
case INTERVAL_HOUR_MINUTE:
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->hour=array[0];
|
||||
t->minute=array[1];
|
||||
break;
|
||||
case INTERVAL_HOUR_SECOND:
|
||||
if (get_interval_info(str,length,3,array))
|
||||
if (get_interval_info(str,length,cs,3,array))
|
||||
return (1);
|
||||
t->hour=array[0];
|
||||
t->minute=array[1];
|
||||
t->second=array[2];
|
||||
break;
|
||||
case INTERVAL_MINUTE_SECOND:
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->minute=array[0];
|
||||
t->second=array[1];
|
||||
|
|
|
@ -192,8 +192,7 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
|
|||
if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+
|
||||
FIELDFLAG_PACK)))
|
||||
{
|
||||
/* BAR TODO: I'm not sure this should be system_charset_info */
|
||||
if (my_strnncoll(system_charset_info,
|
||||
if (my_strnncoll(key_part->field->charset(),
|
||||
(const uchar*) key, length,
|
||||
(const uchar*) table->record[0]+key_part->offset,length))
|
||||
return 1;
|
||||
|
|
|
@ -59,6 +59,7 @@ static SYMBOL symbols[] = {
|
|||
{ "ANY", SYM(ANY_SYM),0,0},
|
||||
{ "AS", SYM(AS),0,0},
|
||||
{ "ASC", SYM(ASC),0,0},
|
||||
{ "ASCII", SYM(ASCII_SYM),0,0},
|
||||
{ "AVG", SYM(AVG_SYM),0,0},
|
||||
{ "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH),0,0},
|
||||
{ "AUTO_INCREMENT", SYM(AUTO_INC),0,0},
|
||||
|
@ -374,6 +375,7 @@ static SYMBOL symbols[] = {
|
|||
{ "TYPE", SYM(TYPE_SYM),0,0},
|
||||
{ "TYPES", SYM(TYPES_SYM),0,0},
|
||||
{ "UNCOMMITTED", SYM(UNCOMMITTED_SYM),0,0},
|
||||
{ "UNICODE", SYM(UNICODE_SYM),0,0},
|
||||
{ "UNION", SYM(UNION_SYM),0,0},
|
||||
{ "UNIQUE", SYM(UNIQUE_SYM),0,0},
|
||||
{ "UNLOCK", SYM(UNLOCK_SYM),0,0},
|
||||
|
@ -412,7 +414,6 @@ static SYMBOL sql_functions[] = {
|
|||
{ "AES_ENCRYPT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_aes_encrypt)},
|
||||
{ "AES_DECRYPT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_aes_decrypt)},
|
||||
{ "AREA", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_area)},
|
||||
{ "ASCII", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ascii)},
|
||||
{ "ASIN", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_asin)},
|
||||
{ "ASTEXT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_as_text)},
|
||||
{ "ATAN", SYM(ATAN),0,0},
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <m_ctype.h> // For test_if_number
|
||||
#include <assert.h>
|
||||
|
||||
#define files_charset_info my_charset_latin1
|
||||
|
||||
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||
|
||||
|
@ -1483,7 +1485,7 @@ static bool test_if_number(register const char *str,
|
|||
while (*str++ == ' ') ;
|
||||
if (*--str == '-' || *str == '+')
|
||||
str++;
|
||||
while (my_isdigit(system_charset_info,*str) || (allow_wildcards &&
|
||||
while (my_isdigit(files_charset_info,*str) || (allow_wildcards &&
|
||||
(*str == wild_many || *str == wild_one)))
|
||||
{
|
||||
flag=1;
|
||||
|
@ -1492,7 +1494,7 @@ static bool test_if_number(register const char *str,
|
|||
if (*str == '.')
|
||||
{
|
||||
for (str++ ;
|
||||
my_isdigit(system_charset_info,*str) ||
|
||||
my_isdigit(files_charset_info,*str) ||
|
||||
(allow_wildcards && (*str == wild_many || *str == wild_one)) ;
|
||||
str++, flag=1) ;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#define log_cs my_charset_latin1
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
my_b_safe_write()
|
||||
|
@ -676,7 +678,7 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
|
|||
void Query_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf[256];
|
||||
String tmp(buf, sizeof(buf), system_charset_info);
|
||||
String tmp(buf, sizeof(buf), log_cs);
|
||||
tmp.length(0);
|
||||
if (db && db_len)
|
||||
{
|
||||
|
@ -930,7 +932,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Start_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256];
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
char buf[22];
|
||||
|
||||
|
@ -1041,7 +1043,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Load_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf[256];
|
||||
String tmp(buf, sizeof(buf), system_charset_info);
|
||||
String tmp(buf, sizeof(buf), log_cs);
|
||||
tmp.length(0);
|
||||
if (db && db_len)
|
||||
{
|
||||
|
@ -1453,15 +1455,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
handle_dup = DUP_REPLACE;
|
||||
sql_exchange ex((char*)fname, sql_ex.opt_flags &&
|
||||
DUMPFILE_FLAG );
|
||||
String field_term(sql_ex.field_term,sql_ex.field_term_len,
|
||||
system_charset_info);
|
||||
String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,
|
||||
system_charset_info);
|
||||
String line_term(sql_ex.line_term,sql_ex.line_term_len,
|
||||
system_charset_info);
|
||||
String line_start(sql_ex.line_start,sql_ex.line_start_len,
|
||||
system_charset_info);
|
||||
String escaped(sql_ex.escaped,sql_ex.escaped_len, system_charset_info);
|
||||
String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs);
|
||||
String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,log_cs);
|
||||
String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs);
|
||||
String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs);
|
||||
String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs);
|
||||
|
||||
ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
|
||||
if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
|
||||
|
@ -1547,7 +1545,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
void Rotate_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256], buf[22];
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append(new_log_ident, ident_len);
|
||||
tmp.append(";pos=");
|
||||
|
@ -1685,7 +1683,7 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Intvar_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256], buf[22];
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append(get_var_type_name());
|
||||
tmp.append('=');
|
||||
|
@ -1893,7 +1891,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Slave_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256], buf[22], *end;
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append("host=");
|
||||
tmp.append(master_host);
|
||||
|
@ -2241,7 +2239,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
|
|||
void Create_file_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256],buf[22], *end;
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append("db=");
|
||||
tmp.append(db, db_len);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <ft_global.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define mysqld_charset my_charset_latin1
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
#define ONE_THREAD
|
||||
#endif
|
||||
|
@ -981,7 +983,7 @@ static void set_user(const char *user)
|
|||
{
|
||||
// allow a numeric uid to be used
|
||||
const char *pos;
|
||||
for (pos=user; my_isdigit(system_charset_info,*pos); pos++) ;
|
||||
for (pos=user; my_isdigit(mysqld_charset,*pos); pos++) ;
|
||||
if (*pos) // Not numeric id
|
||||
{
|
||||
fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
|
||||
|
@ -4373,7 +4375,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
exit(1);
|
||||
}
|
||||
val= p--;
|
||||
while (my_isspace(system_charset_info, *p) && p > argument)
|
||||
while (my_isspace(mysqld_charset, *p) && p > argument)
|
||||
*p-- = 0;
|
||||
if (p == argument)
|
||||
{
|
||||
|
@ -4383,7 +4385,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
}
|
||||
*val= 0;
|
||||
val+= 2;
|
||||
while (*val && my_isspace(system_charset_info, *val))
|
||||
while (*val && my_isspace(mysqld_charset, *val))
|
||||
*val++;
|
||||
if (!*val)
|
||||
{
|
||||
|
@ -4525,7 +4527,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
have_symlink=SHOW_OPTION_DISABLED;
|
||||
break;
|
||||
case (int) OPT_BIND_ADDRESS:
|
||||
if (argument && my_isdigit(system_charset_info, argument[0]))
|
||||
if (argument && my_isdigit(mysqld_charset, argument[0]))
|
||||
{
|
||||
my_bind_addr = (ulong) inet_addr(argument);
|
||||
}
|
||||
|
@ -4938,8 +4940,8 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
|
|||
j=pos;
|
||||
while (j != end)
|
||||
{
|
||||
if (my_toupper(system_charset_info,*i++) !=
|
||||
my_toupper(system_charset_info,*j++))
|
||||
if (my_toupper(mysqld_charset,*i++) !=
|
||||
my_toupper(mysqld_charset,*j++))
|
||||
goto skipp;
|
||||
}
|
||||
found_int=bit;
|
||||
|
|
|
@ -929,7 +929,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
|
|||
{
|
||||
bool like_error;
|
||||
char buff1[MAX_FIELD_WIDTH],*min_str,*max_str;
|
||||
String tmp(buff1,sizeof(buff1),default_charset_info),*res;
|
||||
String tmp(buff1,sizeof(buff1),value->charset()),*res;
|
||||
uint length,offset,min_length,max_length;
|
||||
|
||||
if (!field->optimize_range(param->real_keynr[key_part->key]))
|
||||
|
@ -1043,7 +1043,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
|
|||
if (maybe_null)
|
||||
*str= (char) field->is_real_null(); // Set to 1 if null
|
||||
field->get_key_image(str+maybe_null,key_part->part_length,
|
||||
key_part->image_type);
|
||||
field->charset(),key_part->image_type);
|
||||
if (!(tree=new SEL_ARG(field,str,str)))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -2793,7 +2793,7 @@ static void
|
|||
print_key(KEY_PART *key_part,const char *key,uint used_length)
|
||||
{
|
||||
char buff[1024];
|
||||
String tmp(buff,sizeof(buff),default_charset_info);
|
||||
String tmp(buff,sizeof(buff),NULL);
|
||||
|
||||
for (uint length=0;
|
||||
length < used_length ;
|
||||
|
@ -2813,7 +2813,8 @@ print_key(KEY_PART *key_part,const char *key,uint used_length)
|
|||
}
|
||||
field->set_key_image((char*) key,key_part->part_length -
|
||||
((field->type() == FIELD_TYPE_BLOB) ?
|
||||
HA_KEY_BLOB_LENGTH : 0));
|
||||
HA_KEY_BLOB_LENGTH : 0),
|
||||
field->charset());
|
||||
field->val_str(&tmp,&tmp);
|
||||
fwrite(tmp.ptr(),sizeof(char),tmp.length(),DBUG_FILE);
|
||||
}
|
||||
|
|
|
@ -364,7 +364,8 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond)
|
|||
// Save found constant
|
||||
if (part->null_bit)
|
||||
*key_ptr++= (byte) test(part->field->is_null());
|
||||
part->field->get_key_image((char*) key_ptr,part->length, Field::itRAW);
|
||||
part->field->get_key_image((char*) key_ptr,part->length,
|
||||
part->field->charset(), Field::itRAW);
|
||||
key_ptr+=part->store_length - test(part->null_bit);
|
||||
left_length-=part->store_length;
|
||||
}
|
||||
|
|
|
@ -687,7 +687,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
|
|||
DBUG_ASSERT(field_types == 0 ||
|
||||
field_types[field_pos++] == MYSQL_TYPE_FLOAT);
|
||||
#endif
|
||||
buffer->set((double) from, decimals, thd->thd_charset);
|
||||
buffer->set((double) from, decimals, thd->variables.thd_charset);
|
||||
return net_store_data(packet,(char*) buffer->ptr(), buffer->length());
|
||||
}
|
||||
|
||||
|
@ -697,7 +697,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
|
|||
DBUG_ASSERT(field_types == 0 ||
|
||||
field_types[field_pos++] == MYSQL_TYPE_DOUBLE);
|
||||
#endif
|
||||
buffer->set(from, decimals, thd->thd_charset);
|
||||
buffer->set(from, decimals, thd->variables.thd_charset);
|
||||
return net_store_data(packet,(char*) buffer->ptr(), buffer->length());
|
||||
}
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ public:
|
|||
{
|
||||
Item_field *item= (Item_field*) value_arg;
|
||||
if (!(value=new Item_string(item->field_name, strlen(item->field_name),
|
||||
system_charset_info)))
|
||||
item->charset())))
|
||||
value=value_arg; /* Give error message later */
|
||||
}
|
||||
else
|
||||
|
|
|
@ -44,7 +44,7 @@ static Geometry::GClassInfo ci_collection[] =
|
|||
IMPLEMENT_GEOM(GGeometryCollection, wkbGeometryCollection, "GEOMETRYCOLLECTION")
|
||||
};
|
||||
|
||||
static Geometry::GClassInfo *ci_collection_end = ci_collection + sizeof(ci_collection);
|
||||
static Geometry::GClassInfo *ci_collection_end = ci_collection + sizeof(ci_collection)/sizeof(ci_collection[0]);
|
||||
|
||||
/***************************** Geometry *******************************/
|
||||
|
||||
|
@ -66,7 +66,7 @@ Geometry::GClassInfo *Geometry::find_class(const char *name, size_t len)
|
|||
cur_rt < ci_collection_end; ++cur_rt)
|
||||
{
|
||||
if ((cur_rt->m_name[len] == 0) &&
|
||||
(strncmp(cur_rt->m_name, name, len) == 0))
|
||||
(strncasecmp(cur_rt->m_name, name, len) == 0))
|
||||
{
|
||||
return cur_rt;
|
||||
}
|
||||
|
|
|
@ -898,14 +898,14 @@ int collect_real(double *element, element_count count __attribute__((unused)),
|
|||
TREE_INFO *info)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String s(buff, sizeof(buff),current_thd->thd_charset);
|
||||
String s(buff, sizeof(buff),current_thd->variables.thd_charset);
|
||||
|
||||
if (info->found)
|
||||
info->str->append(',');
|
||||
else
|
||||
info->found = 1;
|
||||
info->str->append('\'');
|
||||
s.set(*element, info->item->decimals, current_thd->thd_charset);
|
||||
s.set(*element, info->item->decimals, current_thd->variables.thd_charset);
|
||||
info->str->append(s);
|
||||
info->str->append('\'');
|
||||
return 0;
|
||||
|
|
|
@ -105,7 +105,6 @@ THD::THD():user_time(0), fatal_error(0),
|
|||
cond_count=0;
|
||||
warn_id= 0;
|
||||
db_charset=default_charset_info;
|
||||
thd_charset=default_charset_info;
|
||||
mysys_var=0;
|
||||
#ifndef DBUG_OFF
|
||||
dbug_sentry=THD_SENTRY_MAGIC;
|
||||
|
@ -190,6 +189,7 @@ void THD::init(void)
|
|||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
variables= global_system_variables;
|
||||
variables.thd_charset=default_charset_info;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
server_status= SERVER_STATUS_AUTOCOMMIT;
|
||||
options= thd_startup_options;
|
||||
|
@ -526,7 +526,7 @@ bool select_send::send_data(List<Item> &items)
|
|||
List_iterator_fast<Item> li(items);
|
||||
Protocol *protocol= thd->protocol;
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String buffer(buff, sizeof(buff), system_charset_info);
|
||||
String buffer(buff, sizeof(buff), NULL);
|
||||
DBUG_ENTER("send_data");
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
|
@ -649,7 +649,7 @@ bool select_export::send_data(List<Item> &items)
|
|||
DBUG_ENTER("send_data");
|
||||
char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
|
||||
bool space_inited=0;
|
||||
String tmp(buff,sizeof(buff),default_charset_info),*res;
|
||||
String tmp(buff,sizeof(buff),NULL),*res;
|
||||
tmp.length(0);
|
||||
|
||||
if (unit->offset_limit_cnt)
|
||||
|
@ -710,10 +710,11 @@ bool select_export::send_data(List<Item> &items)
|
|||
pos++)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
if (use_mb(default_charset_info))
|
||||
CHARSET_INFO *res_charset=res->charset();
|
||||
if (use_mb(res_charset))
|
||||
{
|
||||
int l;
|
||||
if ((l=my_ismbchar(default_charset_info, pos, end)))
|
||||
if ((l=my_ismbchar(res_charset, pos, end)))
|
||||
{
|
||||
pos += l-1;
|
||||
continue;
|
||||
|
@ -856,7 +857,7 @@ bool select_dump::send_data(List<Item> &items)
|
|||
{
|
||||
List_iterator_fast<Item> li(items);
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff),default_charset_info),*res;
|
||||
String tmp(buff,sizeof(buff),NULL),*res;
|
||||
tmp.length(0);
|
||||
Item *item;
|
||||
DBUG_ENTER("send_data");
|
||||
|
|
|
@ -373,7 +373,8 @@ struct system_variables
|
|||
my_bool log_warnings;
|
||||
my_bool low_priority_updates;
|
||||
|
||||
CONVERT *convert_set;
|
||||
CONVERT *convert_set;
|
||||
CHARSET_INFO *thd_charset;
|
||||
};
|
||||
|
||||
|
||||
|
@ -487,7 +488,6 @@ public:
|
|||
table_map used_tables;
|
||||
USER_CONN *user_connect;
|
||||
CHARSET_INFO *db_charset;
|
||||
CHARSET_INFO *thd_charset;
|
||||
List<Item> *possible_loops; // Items that may cause loops in subselects
|
||||
List <MYSQL_ERROR> warn_list;
|
||||
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
||||
|
|
|
@ -599,7 +599,7 @@ bool mysql_change_db(THD *thd, const char *name)
|
|||
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
|
||||
load_db_opt(path, &create);
|
||||
thd->db_charset=create.table_charset;
|
||||
thd->thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
|
||||
thd->variables.thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
|||
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
create_info.auto_increment_value= table->file->auto_increment_value;
|
||||
create_info.table_charset=default_charset_info;
|
||||
create_info.table_charset=table->table_charset;
|
||||
|
||||
db_type table_type=table->db_type;
|
||||
strmov(path,table->path);
|
||||
|
@ -580,7 +580,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
|||
}
|
||||
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
create_info.table_charset=default_charset_info;
|
||||
create_info.table_charset=table_list->table->table_charset;
|
||||
|
||||
*fn_ext(path)=0; // Remove the .frm extension
|
||||
error= ha_create_table(path,&create_info,1) ? -1 : 0;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
** Get help on string
|
||||
***************************************************************************/
|
||||
|
||||
#define help_charset my_charset_latin1
|
||||
|
||||
MI_INFO *open_help_file(THD *thd, const char *name)
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
|
@ -104,21 +106,21 @@ int search_functions(MI_INFO *file_leafs, const char *mask,
|
|||
leaf.prepare_fields();
|
||||
|
||||
const char *lname= leaf.get_name();
|
||||
if (wild_case_compare(system_charset_info,lname,mask))
|
||||
if (wild_case_compare(help_charset,lname,mask))
|
||||
continue;
|
||||
count++;
|
||||
|
||||
if (count>2)
|
||||
{
|
||||
String *s= new String(lname,system_charset_info);
|
||||
String *s= new String(lname,help_charset);
|
||||
if (!s->copy())
|
||||
names->push_back(s);
|
||||
}
|
||||
else if (count==1)
|
||||
{
|
||||
*description= new String(leaf.get_description(),system_charset_info);
|
||||
*example= new String(leaf.get_example(),system_charset_info);
|
||||
*name= new String(lname,system_charset_info);
|
||||
*description= new String(leaf.get_description(),help_charset);
|
||||
*example= new String(leaf.get_example(),help_charset);
|
||||
*name= new String(lname,help_charset);
|
||||
(*description)->copy();
|
||||
(*example)->copy();
|
||||
(*name)->copy();
|
||||
|
@ -132,7 +134,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask,
|
|||
*description= 0;
|
||||
*example= 0;
|
||||
|
||||
String *s= new String(lname,system_charset_info);
|
||||
String *s= new String(lname,help_charset);
|
||||
if (!s->copy())
|
||||
names->push_back(s);
|
||||
}
|
||||
|
@ -203,14 +205,14 @@ int search_categories(THD *thd,
|
|||
category.prepare_fields();
|
||||
|
||||
const char *lname= category.get_name();
|
||||
if (mask && wild_case_compare(system_charset_info,lname,mask))
|
||||
if (mask && wild_case_compare(help_charset,lname,mask))
|
||||
continue;
|
||||
count++;
|
||||
|
||||
if (count==1 && res_id)
|
||||
*res_id= category.get_cat_id();
|
||||
|
||||
String *s= new String(lname,system_charset_info);
|
||||
String *s= new String(lname,help_charset);
|
||||
if (!s->copy())
|
||||
names->push_back(s);
|
||||
}
|
||||
|
@ -282,7 +284,7 @@ int get_all_names_for_category(THD *thd,MI_INFO *file_leafs,
|
|||
(const byte*)&leaf_id,4,HA_READ_KEY_EXACT))
|
||||
{
|
||||
leaf.prepare_fields();
|
||||
String *s= new String(leaf.get_name(),system_charset_info);
|
||||
String *s= new String(leaf.get_name(),help_charset);
|
||||
if (!s->copy())
|
||||
res->push_back(s);
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
|
|||
lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc;
|
||||
lex->current_select= &lex->select_lex;
|
||||
lex->convert_set= (lex->thd= thd)->variables.convert_set;
|
||||
lex->thd_charset= lex->thd->variables.thd_charset;
|
||||
lex->yacc_yyss=lex->yacc_yyvs=0;
|
||||
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
|
||||
lex->slave_thd_opt=0;
|
||||
|
|
|
@ -432,7 +432,7 @@ typedef struct st_lex
|
|||
create_field *last_field;
|
||||
Item *default_value, *comment;
|
||||
CONVERT *convert_set;
|
||||
CONVERT *thd_convert_set; // Set with SET CHAR SET
|
||||
CHARSET_INFO *thd_charset;
|
||||
LEX_USER *grant_user;
|
||||
gptr yacc_yyss,yacc_yyvs;
|
||||
THD *thd;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <my_dir.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define files_charset_info system_charset_info
|
||||
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
#endif
|
||||
|
@ -1222,7 +1224,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
break;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(system_charset_info, db);
|
||||
my_casedn_str(files_charset_info, db);
|
||||
if (check_access(thd,CREATE_ACL,db,0,1))
|
||||
break;
|
||||
mysql_log.write(thd,command,packet);
|
||||
|
@ -1240,7 +1242,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
break;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(system_charset_info, db);
|
||||
my_casedn_str(files_charset_info, db);
|
||||
if (thd->locked_tables || thd->active_transaction())
|
||||
{
|
||||
send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION);
|
||||
|
@ -2488,7 +2490,7 @@ mysql_execute_command(THD *thd)
|
|||
break;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(system_charset_info, lex->name);
|
||||
my_casedn_str(files_charset_info, lex->name);
|
||||
if (check_access(thd,CREATE_ACL,lex->name,0,1))
|
||||
break;
|
||||
res=mysql_create_db(thd,lex->name,&lex->create_info,0);
|
||||
|
@ -2502,7 +2504,7 @@ mysql_execute_command(THD *thd)
|
|||
break;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(system_charset_info, lex->name);
|
||||
my_casedn_str(files_charset_info, lex->name);
|
||||
if (check_access(thd,DROP_ACL,lex->name,0,1))
|
||||
break;
|
||||
if (thd->locked_tables || thd->active_transaction())
|
||||
|
@ -2590,7 +2592,7 @@ mysql_execute_command(THD *thd)
|
|||
if (user->password.str &&
|
||||
(strcmp(thd->user,user->user.str) ||
|
||||
user->host.str &&
|
||||
my_strcasecmp(system_charset_info,
|
||||
my_strcasecmp(my_charset_latin1,
|
||||
user->host.str, thd->host_or_ip)))
|
||||
{
|
||||
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
|
||||
|
@ -3581,8 +3583,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||
ptr->alias= alias_str;
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
my_casedn_str(system_charset_info,ptr->db);
|
||||
my_casedn_str(system_charset_info,table->table.str);
|
||||
my_casedn_str(files_charset_info,ptr->db);
|
||||
my_casedn_str(files_charset_info,table->table.str);
|
||||
}
|
||||
ptr->real_name=table->table.str;
|
||||
ptr->real_name_length=table->table.length;
|
||||
|
|
|
@ -6645,12 +6645,14 @@ store_record_in_cache(JOIN_CACHE *cache)
|
|||
{
|
||||
if (last_record)
|
||||
{
|
||||
copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*));
|
||||
copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*),
|
||||
copy->blob_field->charset());
|
||||
pos+=copy->length+sizeof(char*);
|
||||
}
|
||||
else
|
||||
{
|
||||
copy->blob_field->get_image((char*) pos,copy->length); // blob length
|
||||
copy->blob_field->get_image((char*) pos,copy->length, // blob length
|
||||
copy->blob_field->charset());
|
||||
memcpy(pos+copy->length,copy->str,copy->blob_length); // Blob data
|
||||
pos+=copy->length+copy->blob_length;
|
||||
}
|
||||
|
@ -6707,7 +6709,8 @@ read_cached_record(JOIN_TAB *tab)
|
|||
{
|
||||
if (last_record)
|
||||
{
|
||||
copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*));
|
||||
copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*),
|
||||
copy->blob_field->charset());
|
||||
pos+=copy->length+sizeof(char*);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -713,7 +713,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
{
|
||||
byte *pos;
|
||||
uint flags=field->flags;
|
||||
String type(tmp,sizeof(tmp),current_thd->thd_charset);
|
||||
String type(tmp,sizeof(tmp),current_thd->variables.thd_charset);
|
||||
uint col_access;
|
||||
bool null_default_value=0;
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ public:
|
|||
{
|
||||
Ptr[str_length++] = c;
|
||||
}
|
||||
void q_append(const uint32 &n)
|
||||
void q_append(const uint32 n)
|
||||
{
|
||||
int4store(Ptr + str_length, n);
|
||||
str_length += 4;
|
||||
|
|
|
@ -361,6 +361,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||
%token UDF_SYM
|
||||
%token UNCOMMITTED_SYM
|
||||
%token UNDERSCORE_CHARSET
|
||||
%token UNICODE_SYM
|
||||
%token UNION_SYM
|
||||
%token UNIQUE_SYM
|
||||
%token USAGE
|
||||
|
@ -380,6 +381,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||
%token ERRORS
|
||||
%token WARNINGS
|
||||
|
||||
%token ASCII_SYM
|
||||
%token BIGINT
|
||||
%token BLOB_SYM
|
||||
%token CHAR_SYM
|
||||
|
@ -1257,11 +1259,20 @@ opt_db_default_character_set:
|
|||
|
||||
opt_binary:
|
||||
/* empty */ { Lex->charset=NULL; }
|
||||
| ASCII_SYM { Lex->charset=my_charset_latin1; }
|
||||
| BYTE_SYM { Lex->charset=my_charset_bin; }
|
||||
| BINARY { Lex->charset=my_charset_bin; }
|
||||
| UNICODE_SYM
|
||||
{
|
||||
if (!(Lex->charset=get_charset_by_name("ucs2",MYF(0))))
|
||||
{
|
||||
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"ucs2");
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| COLLATE_SYM charset_name { Lex->charset=$2; }
|
||||
| CHAR_SYM SET charset_name { Lex->charset=$3; } ;
|
||||
|
||||
|
||||
opt_primary:
|
||||
/* empty */
|
||||
| PRIMARY_SYM
|
||||
|
@ -2014,6 +2025,7 @@ simple_expr:
|
|||
| MATCH ident_list_arg AGAINST '(' expr IN_SYM BOOLEAN_SYM MODE_SYM ')'
|
||||
{ Select->add_ftfunc_to_list((Item_func_match *)
|
||||
($$=new Item_func_match_bool(*$2,$5))); }
|
||||
| ASCII_SYM '(' expr ')' { $$= new Item_func_ascii($3); }
|
||||
| BINARY expr %prec NEG { $$= new Item_func_set_collation($2,my_charset_bin); }
|
||||
| CAST_SYM '(' expr AS cast_type ')' { $$= create_func_cast($3, $5); }
|
||||
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
|
||||
|
@ -3588,13 +3600,13 @@ opt_ignore_lines:
|
|||
/* Common definitions */
|
||||
|
||||
text_literal:
|
||||
TEXT_STRING { $$ = new Item_string($1.str,$1.length,YYTHD->thd_charset); }
|
||||
TEXT_STRING { $$ = new Item_string($1.str,$1.length,YYTHD->variables.thd_charset); }
|
||||
| UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); }
|
||||
| text_literal TEXT_STRING
|
||||
{ ((Item_string*) $1)->append($2.str,$2.length); };
|
||||
|
||||
text_string:
|
||||
TEXT_STRING { $$= new String($1.str,$1.length,YYTHD->thd_charset); }
|
||||
TEXT_STRING { $$= new String($1.str,$1.length,YYTHD->variables.thd_charset); }
|
||||
| HEX_NUM
|
||||
{
|
||||
Item *tmp = new Item_varbinary($1.str,$1.length);
|
||||
|
@ -3721,6 +3733,7 @@ keyword:
|
|||
| AGAINST {}
|
||||
| AGGREGATE_SYM {}
|
||||
| ANY_SYM {}
|
||||
| ASCII_SYM {}
|
||||
| AUTO_INC {}
|
||||
| AVG_ROW_LENGTH {}
|
||||
| AVG_SYM {}
|
||||
|
@ -3872,6 +3885,7 @@ keyword:
|
|||
| TYPE_SYM {}
|
||||
| UDF_SYM {}
|
||||
| UNCOMMITTED_SYM {}
|
||||
| UNICODE_SYM {}
|
||||
| USE_FRM {}
|
||||
| VARIABLES {}
|
||||
| VALUE_SYM {}
|
||||
|
|
48
sql/time.cc
48
sql/time.cc
|
@ -268,13 +268,13 @@ void find_date(string pos,uint *vek,uint flag)
|
|||
DBUG_PRINT("enter",("pos: '%s' flag: %d",pos,flag));
|
||||
|
||||
bzero((char*) vek,sizeof(int)*4);
|
||||
while (*pos && !my_isdigit(system_charset_info,*pos))
|
||||
while (*pos && !my_isdigit(my_charset_latin1,*pos))
|
||||
pos++;
|
||||
length=(uint) strlen(pos);
|
||||
for (uint i=0 ; i< 3; i++)
|
||||
{
|
||||
start=pos; value=0;
|
||||
while (my_isdigit(system_charset_info,pos[0]) &&
|
||||
while (my_isdigit(my_charset_latin1,pos[0]) &&
|
||||
((pos-start) < 2 || ((pos-start) < 4 && length >= 8 &&
|
||||
!(flag & 3))))
|
||||
{
|
||||
|
@ -282,8 +282,8 @@ void find_date(string pos,uint *vek,uint flag)
|
|||
pos++;
|
||||
}
|
||||
vek[flag & 3]=value; flag>>=2;
|
||||
while (*pos && (my_ispunct(system_charset_info,*pos) ||
|
||||
my_isspace(system_charset_info,*pos)))
|
||||
while (*pos && (my_ispunct(my_charset_latin1,*pos) ||
|
||||
my_isspace(my_charset_latin1,*pos)))
|
||||
pos++;
|
||||
}
|
||||
DBUG_PRINT("exit",("year: %d month: %d day: %d",vek[0],vek[1],vek[2]));
|
||||
|
@ -452,7 +452,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
|
|||
DBUG_PRINT("enter",("str: %.*s",length,str));
|
||||
|
||||
// Skip garbage
|
||||
for (; str != end && !my_isdigit(system_charset_info, *str) ; str++) ;
|
||||
for (; str != end && !my_isdigit(my_charset_latin1, *str) ; str++) ;
|
||||
if (str == end)
|
||||
DBUG_RETURN(TIMESTAMP_NONE);
|
||||
/*
|
||||
|
@ -460,15 +460,15 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
|
|||
If length= 8 or >= 14 then year is of format YYYY.
|
||||
(YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS)
|
||||
*/
|
||||
for (pos=str; pos != end && my_isdigit(system_charset_info,*pos) ; pos++) ;
|
||||
for (pos=str; pos != end && my_isdigit(my_charset_latin1,*pos) ; pos++) ;
|
||||
digits= (uint) (pos-str);
|
||||
year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
|
||||
field_length=year_length-1;
|
||||
not_zero_date= 0;
|
||||
for (i=0 ; i < 6 && str != end && my_isdigit(system_charset_info,*str) ; i++)
|
||||
for (i=0 ; i < 6 && str != end && my_isdigit(my_charset_latin1,*str) ; i++)
|
||||
{
|
||||
uint tmp_value=(uint) (uchar) (*str++ - '0');
|
||||
while (str != end && my_isdigit(system_charset_info,str[0]) &&
|
||||
while (str != end && my_isdigit(my_charset_latin1,str[0]) &&
|
||||
field_length--)
|
||||
{
|
||||
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
|
||||
|
@ -481,11 +481,11 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
|
|||
else if ( i != 5 ) // Skip inter-field delimiters
|
||||
{
|
||||
while (str != end &&
|
||||
(my_ispunct(system_charset_info,*str) ||
|
||||
my_isspace(system_charset_info,*str)))
|
||||
(my_ispunct(my_charset_latin1,*str) ||
|
||||
my_isspace(my_charset_latin1,*str)))
|
||||
{
|
||||
// Only allow space between days and hours
|
||||
if (my_isspace(system_charset_info,*str) && i != 2)
|
||||
if (my_isspace(my_charset_latin1,*str) && i != 2)
|
||||
DBUG_RETURN(TIMESTAMP_NONE);
|
||||
str++;
|
||||
}
|
||||
|
@ -494,12 +494,12 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
|
|||
}
|
||||
/* Handle second fractions */
|
||||
if (i == 6 && (uint) (end-str) >= 2 && *str == '.' &&
|
||||
my_isdigit(system_charset_info,str[1]))
|
||||
my_isdigit(my_charset_latin1,str[1]))
|
||||
{
|
||||
str++;
|
||||
uint tmp_value=(uint) (uchar) (*str - '0');
|
||||
field_length=3;
|
||||
while (str++ != end && my_isdigit(system_charset_info,str[0]) &&
|
||||
while (str++ != end && my_isdigit(my_charset_latin1,str[0]) &&
|
||||
field_length--)
|
||||
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
|
||||
date[6]=tmp_value;
|
||||
|
@ -522,7 +522,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
|
|||
{
|
||||
for (; str != end ; str++)
|
||||
{
|
||||
if (!my_isspace(system_charset_info, *str))
|
||||
if (!my_isspace(my_charset_latin1, *str))
|
||||
{
|
||||
not_zero_date= 1; // Give warning
|
||||
break;
|
||||
|
@ -537,7 +537,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
|
|||
{
|
||||
for (; str != end ; str++)
|
||||
{
|
||||
if (!my_isspace(system_charset_info,*str))
|
||||
if (!my_isspace(my_charset_latin1,*str))
|
||||
{
|
||||
current_thd->cuted_fields++;
|
||||
break;
|
||||
|
@ -599,7 +599,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
|
||||
l_time->neg=0;
|
||||
for (; str != end &&
|
||||
!my_isdigit(system_charset_info,*str) && *str != '-' ; str++)
|
||||
!my_isdigit(my_charset_latin1,*str) && *str != '-' ; str++)
|
||||
length--;
|
||||
if (str != end && *str == '-')
|
||||
{
|
||||
|
@ -618,7 +618,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
}
|
||||
|
||||
/* Not a timestamp. Try to get this as a DAYS_TO_SECOND string */
|
||||
for (value=0; str != end && my_isdigit(system_charset_info,*str) ; str++)
|
||||
for (value=0; str != end && my_isdigit(my_charset_latin1,*str) ; str++)
|
||||
value=value*10L + (long) (*str - '0');
|
||||
|
||||
if (*str == ' ')
|
||||
|
@ -630,7 +630,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
LINT_INIT(state);
|
||||
found_days=found_hours=0;
|
||||
if ((uint) (end-str) > 1 && (*str == ' ' &&
|
||||
my_isdigit(system_charset_info,str[1])))
|
||||
my_isdigit(my_charset_latin1,str[1])))
|
||||
{ // days !
|
||||
date[0]=value;
|
||||
state=1; // Assume next is hours
|
||||
|
@ -638,7 +638,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
str++; // Skip space;
|
||||
}
|
||||
else if ((end-str) > 1 && *str == ':' &&
|
||||
my_isdigit(system_charset_info,str[1]))
|
||||
my_isdigit(my_charset_latin1,str[1]))
|
||||
{
|
||||
date[0]=0; // Assume we found hours
|
||||
date[1]=value;
|
||||
|
@ -660,11 +660,11 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
/* Read hours, minutes and seconds */
|
||||
for (;;)
|
||||
{
|
||||
for (value=0; str != end && my_isdigit(system_charset_info,*str) ; str++)
|
||||
for (value=0; str != end && my_isdigit(my_charset_latin1,*str) ; str++)
|
||||
value=value*10L + (long) (*str - '0');
|
||||
date[state++]=value;
|
||||
if (state == 4 || (end-str) < 2 || *str != ':' ||
|
||||
!my_isdigit(system_charset_info,str[1]))
|
||||
!my_isdigit(my_charset_latin1,str[1]))
|
||||
break;
|
||||
str++; // Skip ':'
|
||||
}
|
||||
|
@ -684,12 +684,12 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
|
||||
fractional:
|
||||
/* Get fractional second part */
|
||||
if ((end-str) >= 2 && *str == '.' && my_isdigit(system_charset_info,str[1]))
|
||||
if ((end-str) >= 2 && *str == '.' && my_isdigit(my_charset_latin1,str[1]))
|
||||
{
|
||||
uint field_length=3;
|
||||
str++; value=(uint) (uchar) (*str - '0');
|
||||
while (++str != end &&
|
||||
my_isdigit(system_charset_info,str[0]) &&
|
||||
my_isdigit(my_charset_latin1,str[0]) &&
|
||||
field_length--)
|
||||
value=value*10 + (uint) (uchar) (*str - '0');
|
||||
date[4]=value;
|
||||
|
@ -715,7 +715,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
|
|||
{
|
||||
do
|
||||
{
|
||||
if (!my_isspace(system_charset_info,*str))
|
||||
if (!my_isspace(my_charset_latin1,*str))
|
||||
{
|
||||
current_thd->cuted_fields++;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue