Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/dlenev/src/mysql-4.1-bg2248


include/mysql.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
This commit is contained in:
unknown 2004-02-11 16:09:33 +03:00
commit f2753fe9ac
14 changed files with 59 additions and 194 deletions

View file

@ -572,6 +572,7 @@ typedef struct st_mysql_methods
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
void (*free_embedded_thd)(MYSQL *mysql);
const char *(*read_statistic)(MYSQL *mysql);
int (*next_result)(MYSQL *mysql);
#endif
} MYSQL_METHODS;

View file

@ -3460,7 +3460,6 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
/*
Reads and returns the next query results
*/
int STDCALL mysql_next_result(MYSQL *mysql)
{
DBUG_ENTER("mysql_next_result");
@ -3479,8 +3478,8 @@ int STDCALL mysql_next_result(MYSQL *mysql)
mysql->affected_rows= ~(my_ulonglong) 0;
if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
DBUG_RETURN((*mysql->methods->next_result)(mysql));
DBUG_RETURN(-1); /* No more results */
}

View file

@ -245,6 +245,18 @@ static MYSQL_RES * emb_mysql_store_result(MYSQL *mysql)
return mysql_store_result(mysql);
}
int emb_next_result(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
DBUG_ENTER("emb_next_result");
if (emb_advanced_command(mysql, COM_QUERY,0,0,
thd->query_rest,thd->query_rest_length,1)
|| emb_mysql_read_query_result(mysql))
DBUG_RETURN(1);
DBUG_RETURN(0); /* No more results */
}
MYSQL_METHODS embedded_methods=
{
@ -259,7 +271,8 @@ MYSQL_METHODS embedded_methods=
emb_read_binary_rows,
emb_unbuffered_fetch,
emb_free_embedded_thd,
emb_read_statistic
emb_read_statistic,
emb_next_result
};
C_MODE_END
@ -749,6 +762,11 @@ bool Protocol::net_store_data(const char *from, uint length)
return false;
}
char *memdup_mysql(struct st_mysql *mysql, const char*data, int length)
{
return memdup_root(&mysql->field_alloc, data, length);
}
#if 0
/* The same as Protocol::net_store_data but does the converstion
*/

View file

@ -64,12 +64,6 @@ test
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
òåñò
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
test
select convert(_koi8r'ÔĹÓÔ', "koi8r_general_ci", "cp1251_general_ci");
convert(_koi8r'ÔĹÓÔ', "koi8r_general_ci", "cp1251_general_ci")
ňĺńň
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
Table Create Table

View file

@ -340,129 +340,6 @@ CYR CAPIT SOFT SIGN
CYR CAPIT E ü ü
CYR CAPIT YU à à
CYR CAPIT YA ñ ñ
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci') comment
a LAT SMALL A
b LAT SMALL B
c LAT SMALL C
d LAT SMALL D
e LAT SMALL E
f LAT SMALL F
g LAT SMALL G
h LAT SMALL H
i LAT SMALL I
j LAT SMALL J
k LAT SMALL K
l LAT SMALL L
m LAT SMALL M
n LAT SMALL N
o LAT SMALL O
p LAT SMALL P
q LAT SMALL Q
r LAT SMALL R
s LAT SMALL S
t LAT SMALL T
u LAT SMALL U
v LAT SMALL V
w LAT SMALL W
x LAT SMALL X
y LAT SMALL Y
z LAT SMALL Z
A LAT CAPIT A
B LAT CAPIT B
C LAT CAPIT C
D LAT CAPIT D
E LAT CAPIT E
F LAT CAPIT F
G LAT CAPIT G
H LAT CAPIT H
I LAT CAPIT I
J LAT CAPIT J
K LAT CAPIT K
L LAT CAPIT L
M LAT CAPIT M
N LAT CAPIT N
O LAT CAPIT O
P LAT CAPIT P
Q LAT CAPIT Q
R LAT CAPIT R
S LAT CAPIT S
T LAT CAPIT T
U LAT CAPIT U
V LAT CAPIT V
W LAT CAPIT W
X LAT CAPIT X
Y LAT CAPIT Y
Z LAT CAPIT Z
â CYR SMALL A
÷ CYR SMALL BE
ţ CYR SMALL VE
ú CYR SMALL GE
ä CYR SMALL DE
ĺ CYR SMALL IE
? CYR SMALL IO
ă CYR SMALL ZHE
˙ CYR SMALL ZE
ę CYR SMALL I
ě CYR SMALL KA
í CYR SMALL EL
î CYR SMALL EM
ď CYR SMALL EN
đ CYR SMALL O
ň CYR SMALL PE
ô CYR SMALL ER
ő CYR SMALL ES
ć CYR SMALL TE
č CYR SMALL U
ö CYR SMALL EF
é CYR SMALL HA
ç CYR SMALL TSE
ŕ CYR SMALL CHE
ů CYR SMALL SHA
ü CYR SMALL SCHA
ń CYR SMALL HARD SIGN
ý CYR SMALL YERU
ű CYR SMALL SOFT SIGN
ř CYR SMALL E
á CYR SMALL YU
ó CYR SMALL YA
 CYR CAPIT A
× CYR CAPIT BE
Ţ CYR CAPIT VE
Ú CYR CAPIT GE
Ä CYR CAPIT DE
Ĺ CYR CAPIT IE
? CYR CAPIT IO
Ă CYR CAPIT ZHE
ß CYR CAPIT ZE
Ę CYR CAPIT I
Ě CYR CAPIT KA
Í CYR CAPIT EL
Î CYR CAPIT EM
Ď CYR CAPIT EN
Đ CYR CAPIT O
Ň CYR CAPIT PE
Ô CYR CAPIT ER
Ő CYR CAPIT ES
Ć CYR CAPIT TE
Č CYR CAPIT U
Ö CYR CAPIT EF
É CYR CAPIT HA
Ç CYR CAPIT TSE
Ŕ CYR CAPIT CHE
Ů CYR CAPIT SHA
Ü CYR CAPIT SCHA
Ń CYR CAPIT HARD SIGN
Ý CYR CAPIT YERU
Ű CYR CAPIT SOFT SIGN
Ř CYR CAPIT E
Á CYR CAPIT YU
Ó CYR CAPIT YA
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 116
Warnings:
Note 1003 select high_priority convert(test.t1.koi8_ru_f,_latin1'utf8_general_ci',_latin1'cp1251_general_ci') AS `CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci')`,test.t1.comment AS `comment` from test.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;

View file

@ -51,6 +51,20 @@ t1 CREATE TABLE `t1` (
`version` char(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
charset(charset(_utf8'a')) charset(collation(_utf8'a'))
utf8 utf8
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
collation(charset(_utf8'a')) collation(collation(_utf8'a'))
utf8_general_ci utf8_general_ci
create table t1 select charset(_utf8'a'), collation(_utf8'a');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
`collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL

View file

@ -28,8 +28,6 @@ select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
set names binary;
select cast(_latin1'test' as char character set latin2);
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
select convert(_koi8r'ÔĹÓÔ', "koi8r_general_ci", "cp1251_general_ci");
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
drop table t1;

View file

@ -147,11 +147,6 @@ UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
SET CHARACTER SET koi8r;
SELECT * FROM t1;
#
# codecovarage for Item_func_conv_charset3
#
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
UPDATE t1 SET bin_f=koi8_ru_f;

View file

@ -23,4 +23,10 @@ create table t1 (version char(40)) select database(), user(), version() as 'vers
show create table t1;
drop table t1;
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
create table t1 select charset(_utf8'a'), collation(_utf8'a');
show create table t1;
drop table t1;
select TRUE,FALSE,NULL;

View file

@ -2124,42 +2124,6 @@ void Item_func_conv_charset::print(String *str)
str->append(')');
}
String *Item_func_conv_charset3::val_str(String *str)
{
char cs1[30], cs2[30];
String to_cs_buff(cs1, sizeof(cs1), default_charset_info);
String from_cs_buff(cs2, sizeof(cs2), default_charset_info);
String *arg= args[0]->val_str(str);
String *to_cs= args[1]->val_str(&to_cs_buff);
String *from_cs= args[2]->val_str(&from_cs_buff);
CHARSET_INFO *from_charset;
CHARSET_INFO *to_charset;
if (!arg || args[0]->null_value ||
!to_cs || args[1]->null_value ||
!from_cs || args[2]->null_value ||
!(from_charset=get_charset_by_name(from_cs->ptr(), MYF(MY_WME))) ||
!(to_charset=get_charset_by_name(to_cs->ptr(), MYF(MY_WME))))
{
null_value= 1;
return 0;
}
if (str_value.copy(arg->ptr(), arg->length(), from_charset, to_charset))
{
null_value= 1;
return 0;
}
null_value= 0;
return &str_value;
}
void Item_func_conv_charset3::fix_length_and_dec()
{
max_length = args[0]->max_length;
}
String *Item_func_set_collation::val_str(String *str)
{
str=args[0]->val_str(str);
@ -2226,7 +2190,7 @@ String *Item_func_charset::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->csname,strlen(res->charset()->csname),
&my_charset_latin1, default_charset());
&my_charset_latin1, collation.collation);
return str;
}
@ -2237,7 +2201,7 @@ String *Item_func_collation::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->name,strlen(res->charset()->name),
&my_charset_latin1, default_charset());
&my_charset_latin1, collation.collation);
return str;
}

View file

@ -619,16 +619,6 @@ public:
void print(String *str) { print_op(str); }
};
class Item_func_conv_charset3 :public Item_str_func
{
public:
Item_func_conv_charset3(Item *arg1,Item *arg2,Item *arg3)
:Item_str_func(arg1,arg2,arg3) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
};
class Item_func_charset :public Item_str_func
{
public:
@ -637,8 +627,8 @@ public:
const char *func_name() const { return "charset"; }
void fix_length_and_dec()
{
max_length=40; // should be enough
collation.set(system_charset_info);
max_length= 64 * collation.collation->mbmaxlen; // should be enough
};
};
@ -650,8 +640,8 @@ public:
const char *func_name() const { return "collation"; }
void fix_length_and_dec()
{
max_length=40; // should be enough
collation.set(system_charset_info);
max_length= 64 * collation.collation->mbmaxlen; // should be enough
};
};

View file

@ -565,6 +565,8 @@ public:
struct st_mysql_bind *client_params;
char *extra_data;
ulong extra_length;
char *query_rest;
uint32 query_rest_length;
#endif
NET net; // client connection descriptor
MEM_ROOT warn_root; // For warnings and errors

View file

@ -48,6 +48,7 @@
extern "C" int gethostname(char *name, int namelen);
#endif
char *memdup_mysql(struct st_mysql *mysql, const char*data, int length);
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
@ -1397,11 +1398,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char *packet= thd->lex->found_colon;
/*
Multiple queries exits, execute them individually
in embedded server - just store them to be executed later
*/
#ifndef EMBEDDED_LIBRARY
if (thd->lock || thd->open_tables || thd->derived_tables)
close_thread_tables(thd);
ulong length= thd->query_length-(ulong)(thd->lex->found_colon-thd->query);
#endif
ulong length= thd->query_length-(ulong)(packet-thd->query);
/* Remove garbage at start of query */
while (my_isspace(thd->charset(), *packet) && length > 0)
@ -1414,7 +1417,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
#ifndef EMBEDDED_LIBRARY
mysql_parse(thd, packet, length);
#else
thd->query_rest= (char*)memdup_mysql(thd->mysql, packet, length);
thd->query_rest_length= length;
break;
#endif /*EMBEDDED_LIBRARY*/
}
if (!(specialflag & SPECIAL_NO_PRIOR))

View file

@ -2574,8 +2574,6 @@ simple_expr:
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }
| CONVERT_SYM '(' expr ',' expr ',' expr ')'
{ $$= new Item_func_conv_charset3($3,$7,$5); }
| DEFAULT '(' simple_ident ')'
{ $$= new Item_default_value($3); }
| VALUES '(' simple_ident ')'