Commit 978bcb57 authored by unknown's avatar unknown

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

into mishka.mysql.fi:/home/my/mysql-4.1


include/mysql.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
parents 0e93376e 104da10b
......@@ -565,6 +565,7 @@ typedef struct st_mysql_methods
MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt);
int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row);
void (STDCALL *free_embedded_thd)(MYSQL *mysql);
const char *(STDCALL *read_statistic)(MYSQL *mysql);
#endif
} MYSQL_METHODS;
......
......@@ -256,8 +256,8 @@
#define ER_SLAVE_IGNORED_TABLE 1237
#define ER_WRONG_FK_DEF 1238
#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1239
#define ER_CARDINALITY_COL 1240
#define ER_SUBSELECT_NO_1_ROW 1241
#define ER_OPERAND_COLUMNS 1240
#define ER_SUBQUERY_NO_1_ROW 1241
#define ER_UNKNOWN_STMT_HANDLER 1242
#define ER_CORRUPT_HELP_DB 1243
#define ER_CYCLIC_REFERENCE 1244
......
......@@ -145,8 +145,8 @@ ER_WRONG_TYPE_FOR_VAR, "42000", "",
ER_CANT_USE_OPTION_HERE, "42000", "",
ER_NOT_SUPPORTED_YET, "42000", "",
ER_WRONG_FK_DEF, "42000", "",
ER_CARDINALITY_COL, "21000", "",
ER_SUBSELECT_NO_1_ROW, "21000", "",
ER_OPERAND_COLUMNS, "21000", "",
ER_SUBQUERY_NO_1_ROW, "21000", "",
ER_ILLEGAL_REFERENCE, "42S22", "",
ER_DERIVED_MUST_HAVE_ALIAS, "42000", "",
ER_SELECT_REDUCED, "01000", "",
......
......@@ -57,3 +57,4 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
int STDCALL cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt);
int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row);
const char * STDCALL cli_read_statistic(MYSQL *mysql);
......@@ -1102,12 +1102,8 @@ mysql_dump_debug_info(MYSQL *mysql)
DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0));
}
const char * STDCALL
mysql_stat(MYSQL *mysql)
const char * STDCALL cli_read_statistic(MYSQL *mysql)
{
DBUG_ENTER("mysql_stat");
if (simple_command(mysql,COM_STATISTICS,0,0,0))
return mysql->net.last_error;
mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
if (!mysql->net.read_pos[0])
{
......@@ -1116,7 +1112,16 @@ mysql_stat(MYSQL *mysql)
strmov(mysql->net.last_error, ER(mysql->net.last_errno));
return mysql->net.last_error;
}
DBUG_RETURN((char*) mysql->net.read_pos);
return (char*) mysql->net.read_pos;
}
const char * STDCALL
mysql_stat(MYSQL *mysql)
{
DBUG_ENTER("mysql_stat");
if (simple_command(mysql,COM_STATISTICS,0,0,0))
return mysql->net.last_error;
DBUG_RETURN((*mysql->methods->read_statistic)(mysql));
}
......
......@@ -75,7 +75,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
client). So we have to call free_old_query here
*/
free_old_query(mysql);
if (!arg)
thd->extra_length= arg_length;
thd->extra_data= (char *)arg;
if (header)
{
arg= header;
arg_length= header_length;
......@@ -92,7 +95,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
memcpy(net->sqlstate, thd->net.sqlstate, sizeof(net->sqlstate));
}
else
{
net->last_error[0]= 0;
strmov(net->sqlstate, not_error_sqlstate);
}
mysql->warning_count= ((THD*)mysql->thd)->total_warn_count;
return result;
}
......@@ -128,6 +134,8 @@ static MYSQL_FIELD * STDCALL emb_list_fields(MYSQL *mysql)
static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{
THD *thd= (THD*)mysql->thd;
if (mysql->net.last_errno)
return 1;
stmt->stmt_id= thd->client_stmt_id;
stmt->param_count= thd->client_param_count;
stmt->field_count= mysql->field_count;
......@@ -176,6 +184,11 @@ static int STDCALL emb_stmt_execute(MYSQL_STMT *stmt)
THD *thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
if (thd->data)
{
free_rows(thd->data);
thd->data= 0;
}
if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
(const char*)&stmt->stmt_id,sizeof(stmt->stmt_id),1)
|| emb_mysql_read_query_result(stmt->mysql))
......@@ -217,9 +230,16 @@ static void STDCALL emb_free_embedded_thd(MYSQL *mysql)
THD *thd= (THD*)mysql->thd;
if (thd->data)
free_rows(thd->data);
thread_count--;
delete thd;
}
static const char * STDCALL emb_read_statistic(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
return thd->net.last_error;
}
MYSQL_METHODS embedded_methods=
{
emb_mysql_read_query_result,
......@@ -232,7 +252,8 @@ MYSQL_METHODS embedded_methods=
emb_stmt_execute,
emb_read_binary_rows,
emb_unbuffered_fetch,
emb_free_embedded_thd
emb_free_embedded_thd,
emb_read_statistic
};
C_MODE_END
......@@ -431,6 +452,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
{
THD *thd = (THD *)mysql->thd;
thd->mysql= mysql;
mysql->server_version= server_version;
}
void *create_embedded_thd(int client_flag, char *db)
......@@ -465,6 +487,7 @@ void *create_embedded_thd(int client_flag, char *db)
thd->data= 0;
thread_count++;
return thd;
}
......
......@@ -196,13 +196,22 @@ drop table t1,t2;
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
x
1
create table a1 select 1 as a;
select 2 as a from (select * from a1) b;
create table t1 select 1 as a;
select 2 as a from (select * from t1) b;
ERROR 3D000: No Database Selected
use test;
select 2 as a from (select * from a1) b;
select 2 as a from (select * from t1) b;
a
2
drop table a1;
drop table t1;
select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1
create table t1 (a int);
insert into t1 values (1),(2),(3);
update (select * from t1) as t1 set a = 5;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
delete from (select * from t1);
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1)' at line 1
insert into (select * from t1) values (5);
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1) values (5)' at line 1
drop table t1;
......@@ -36,7 +36,7 @@ select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)));
(1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)))
1
select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4));
ERROR 21000: Cardinality error (more/less than 2 columns)
ERROR 21000: Operand should contain 2 column(s)
select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))
NULL
......@@ -86,7 +86,7 @@ SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
ROW('test',2,3.33)=ROW('test',2,3.33)
1
SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
ERROR 21000: Cardinality error (more/less than 3 columns)
ERROR 21000: Operand should contain 3 column(s)
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33));
ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33))
1
......@@ -97,7 +97,7 @@ SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL));
ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL))
NULL
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4);
ERROR 21000: Cardinality error (more/less than 2 columns)
ERROR 21000: Operand should contain 2 column(s)
create table t1 ( a int, b int, c int);
insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL);
select * from t1 where ROW(1,2,3)=ROW(a,b,c);
......@@ -135,14 +135,14 @@ ROW(1,2,3) IN(row(a,b,c), row(1,2,3))
1
drop table t1;
select ROW(1,1);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
create table t1 (i int);
select 1 from t1 where ROW(1,1);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
select count(*) from t1 order by ROW(1,1);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
select count(*) from t1 having (1,1) order by i;
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
drop table t1;
create table t1 (a int, b int);
insert into t1 values (1, 4);
......
......@@ -10,9 +10,9 @@ reset slave;
start slave;
stop slave;
start slave;
select master_pos_wait('master-bin.001',3000,120)=-1;
master_pos_wait('master-bin.001',3000,120)=-1
0
select master_pos_wait('master-bin.001',3000)>=0;
master_pos_wait('master-bin.001',3000)>=0
1
select * from t1 where a=8000;
a
8000
......
......@@ -69,4 +69,4 @@ ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=561;
Warnings:
Note 1253 The slave was already running
Note 1253 Slave is already running
......@@ -21,6 +21,7 @@ set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
insert into t1 values (@a),(@a),(@a*5);
select * from t1;
n
12345678901234
......@@ -45,6 +46,36 @@ abcn1
abcn1n2
5
5
NULL
NULL
NULL
select * from t1;
n
12345678901234
-12345678901234
0
-1
12.5
-12.5
This is a test
abc'def
abc\def
abc'def
NULL
NULL
0
1
2
5
abc
abcn1
abcn1n2
5
5
NULL
NULL
NULL
show binlog events from 141;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000001 141 User var 2 141 @i1=12345678901234
......@@ -63,13 +94,16 @@ slave-bin.000001 719 User var 2 719 @s5='abc'def'
slave-bin.000001 761 Query 1 761 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 851 User var 2 851 @n1=NULL
slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1)
slave-bin.000001 939 Query 1 939 use `test`; insert into t1 values (@n2)
slave-bin.000001 1001 Query 1 1001 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1089 User var 2 1089 @a=2
slave-bin.000001 1131 Query 1 1131 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1203 User var 2 1203 @q='abc'
slave-bin.000001 1240 Query 1 1240 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1344 User var 2 1344 @a=5
slave-bin.000001 1386 Query 1 1386 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 939 User var 2 939 @n2=NULL
slave-bin.000001 965 Query 1 965 use `test`; insert into t1 values (@n2)
slave-bin.000001 1027 Query 1 1027 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1115 User var 2 1115 @a=2
slave-bin.000001 1157 Query 1 1157 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1229 User var 2 1229 @q='abc'
slave-bin.000001 1266 Query 1 1266 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1370 User var 2 1370 @a=5
slave-bin.000001 1412 Query 1 1412 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1478 User var 2 1478 @a=NULL
slave-bin.000001 1503 Query 1 1503 use `test`; insert into t1 values (@a),(@a),(@a*5)
drop table t1;
stop slave;
......@@ -59,7 +59,7 @@ SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c O
id
1
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
SELECT 1 IN (SELECT 1);
1 IN (SELECT 1)
1
......@@ -124,7 +124,7 @@ SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
0
SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
SELECT 1 as a,(SELECT a+a) b,(SELECT b);
a b (SELECT b)
1 2 2
......@@ -257,9 +257,9 @@ a
7
delete from t2 where a=100;
select * from t3 where a in (select a,b from t2);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
select * from t3 where a in (select * from t2);
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b);
b ma
......@@ -295,7 +295,7 @@ Warnings:
Note 1275 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
Note 1275 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
create table t7( uq int primary key, name char(25));
insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
......@@ -346,15 +346,15 @@ id select_type table type possible_keys key key_len ref rows Extra
3 SUBQUERY t8 const PRIMARY PRIMARY 35 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
CREATE TABLE `t1` (
`topic` mediumint(8) unsigned NOT NULL default '0',
......@@ -384,7 +384,7 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
1
1
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
EXPLAIN SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
......@@ -471,9 +471,9 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`)
) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
......@@ -486,7 +486,7 @@ drop table t1;
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL default '0',
......@@ -504,7 +504,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
......@@ -531,7 +531,7 @@ a b
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
a b
......@@ -554,7 +554,7 @@ a b
delete from t1 where b = (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
a b
......@@ -580,7 +580,7 @@ a b
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
select * from t11;
a b
......@@ -599,7 +599,7 @@ insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
......@@ -641,7 +641,7 @@ x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
x y
......@@ -712,7 +712,7 @@ id
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);
ERROR 21000: Subquery returns more than 1 record
ERROR 21000: Subquery returns more than 1 row
drop table t2, t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
......@@ -1186,7 +1186,7 @@ insert into t1 values (1,0), (2,0), (3,0);
insert into t2 values (1,1), (2,1), (3,1), (2,2);
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
Warnings:
Error 1241 Subquery returns more than 1 record
Error 1241 Subquery returns more than 1 row
select * from t1;
a b
1 1
......@@ -1377,7 +1377,7 @@ userid pmtotal pmnew calc_total calc_new
drop table t1, t2;
create table t1 (s1 char(5));
select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
ERROR 21000: Cardinality error (more/less than 1 columns)
ERROR 21000: Operand should contain 1 column(s)
insert into t1 values ('tttt');
select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
s1
......
......@@ -5,6 +5,10 @@ set @a := connection_id() + 3;
select @a - connection_id();
@a - connection_id()
3
set @b := 1;
select @b;
@b
1
CREATE TABLE t1 ( i int not null, v int not null,index (i));
insert into t1 values (1,1),(1,3),(2,1);
create table t2 (i int not null, unique (i));
......
......@@ -99,13 +99,26 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
# Test for select if database is not selected.
#
# Connect without a database
create table a1 select 1 as a;
create table t1 select 1 as a;
connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
connection con1;
--error 1046
select 2 as a from (select * from a1) b;
select 2 as a from (select * from t1) b;
use test;
select 2 as a from (select * from a1) b;
drop table a1;
select 2 as a from (select * from t1) b;
drop table t1;
--error 1064
select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
#
# UPDATE/DELETE/INSERT of derived tables
#
create table t1 (a int);
insert into t1 values (1),(2),(3);
-- error 1149
update (select * from t1) as t1 set a = 5;
-- error 1064
delete from (select * from t1);
-- error 1064
insert into (select * from t1) values (5);
drop table t1;
......@@ -40,6 +40,8 @@ start slave;
# Usually it stops when the SQL thread is around the 15th relay log.
# We cannot use MASTER_POS_WAIT() as master's position
# increases only when the slave executes the COMMIT.
# Note that except when using Valgrind, 1 second is enough for the I/O slave
# thread to fetch the whole master's binlog.
sleep 1;
stop slave;
# We suppose the SQL thread stopped before COMMIT.
......@@ -53,10 +55,7 @@ start slave;
# We must wait for the transaction to commit before
# reading, MASTER_POS_WAIT() will do it for sure
# (the only statement with position>=3000 is COMMIT).
# Older versions of MySQL would hang forever in MASTER_POS_WAIT
# because COMMIT was said to be position 0 in the master's log (bug).
# Detect this with timeout.
select master_pos_wait('master-bin.001',3000,120)=-1;
select master_pos_wait('master-bin.001',3000)>=0;
select * from t1 where a=8000;
# The following DROP is a very important cleaning task:
......
......@@ -29,13 +29,16 @@ insert into t1 values (@i1), (@i2), (@i3), (@i4);
insert into t1 values (@r1), (@r2);
insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
insert into t1 values (@n1);
insert into t1 values (@n2);
insert into t1 values (@n2); # not explicitely set before
insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
insert into t1 values (@a+(@b:=@a+1));
set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
connection master1; # see if variable is reset in binlog when thread changes
insert into t1 values (@a),(@a),(@a*5);
select * from t1;
save_master_pos;
connection slave;
sync_with_master;
......
......@@ -8,6 +8,9 @@ set @a := foo;
set @a := connection_id() + 3;
select @a - connection_id();
set @b := 1;
select @b;
# Check using and setting variables with SELECT DISTINCT
CREATE TABLE t1 ( i int not null, v int not null,index (i));
......
......@@ -1410,7 +1410,8 @@ static MYSQL_METHODS client_methods=
cli_stmt_execute,
cli_read_binary_rows,
cli_unbuffered_fetch,
NULL
NULL,
cli_read_statistic
#endif
};
......
......@@ -108,7 +108,7 @@ bool Item::check_cols(uint c)
{
if (c != 1)
{
my_error(ER_CARDINALITY_COL, MYF(0), c);
my_error(ER_OPERAND_COLUMNS, MYF(0), c);
return 1;
}
return 0;
......@@ -1784,7 +1784,7 @@ void Item_cache_row::illegal_method_call(const char *method)
DBUG_ENTER("Item_cache_row::illegal_method_call");
DBUG_PRINT("error", ("!!! %s method was called for row item", method));
DBUG_ASSERT(0);
my_error(ER_CARDINALITY_COL, MYF(0), 1);
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
DBUG_VOID_RETURN;
}
......@@ -1792,7 +1792,7 @@ bool Item_cache_row::check_cols(uint c)
{
if (c != item_count)
{
my_error(ER_CARDINALITY_COL, MYF(0), c);
my_error(ER_OPERAND_COLUMNS, MYF(0), c);
return 1;
}
return 0;
......
......@@ -229,7 +229,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
uint n= (*a)->cols();
if (n != (*b)->cols())
{
my_error(ER_CARDINALITY_COL, MYF(0), n);
my_error(ER_OPERAND_COLUMNS, MYF(0), n);
comparators= 0;
return 1;
}
......@@ -239,7 +239,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
{
if ((*a)->el(i)->cols() != (*b)->el(i)->cols())
{
my_error(ER_CARDINALITY_COL, MYF(0), (*a)->el(i)->cols());
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->el(i)->cols());
return 1;
}
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
......@@ -423,7 +423,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
Item_in_subselect * sub= (Item_in_subselect *)args[1];
if (args[0]->cols() != sub->engine->cols())
{
my_error(ER_CARDINALITY_COL, MYF(0), args[0]->cols());
my_error(ER_OPERAND_COLUMNS, MYF(0), args[0]->cols());
return 1;
}
if (args[1]->maybe_null)
......@@ -1351,7 +1351,7 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
cmp_item_row *tmpl= (cmp_item_row*) t;
if (tmpl->n != item->cols())
{
my_error(ER_CARDINALITY_COL, MYF(0), tmpl->n);
my_error(ER_OPERAND_COLUMNS, MYF(0), tmpl->n);
return;
}
n= tmpl->n;
......@@ -1378,7 +1378,7 @@ int cmp_item_row::cmp(Item *arg)
arg->null_value= 0;
if (arg->cols() != n)
{
my_error(ER_CARDINALITY_COL, MYF(0), n);
my_error(ER_OPERAND_COLUMNS, MYF(0), n);
return 1;
}
bool was_null= 0;
......
......@@ -2071,6 +2071,16 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->value=0;
entry->length=0;
entry->update_query_id=0;
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
INSERT INTO t SELECT @a:=10, @a:=@a+1.
Then when we have a Item_func_get_user_var (because of the @a+1) so we
think we have to write the value of @a to the binlog. But before that,
we have a Item_func_set_user_var to create @a (@a:=10), in this we mark
the variable as "already logged" (line below) so that it won't be logged
by Item_func_get_user_var (because that's not necessary).
*/
entry->used_query_id=current_thd->query_id;
entry->type=STRING_RESULT;
memcpy(entry->name.str, name.str, name.length+1);
......@@ -2083,7 +2093,10 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
return entry;
}
/*
When a user variable is updated (in a SET command or a query like SELECT @a:=
).
*/
bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
Item **ref)
......@@ -2093,6 +2106,11 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
!(entry= get_variable(&thd->user_vars, name, 1)))
return 1;
entry->type= cached_result_type;
/*
Remember the last query which updated it, this way a query can later know
if this variable is a constant item in the query (it is if update_query_id
is different from query_id).
*/
entry->update_query_id=thd->query_id;
return 0;
}
......@@ -2315,53 +2333,92 @@ longlong Item_func_get_user_var::val_int()
}
/*
When a user variable is invoked from an update query (INSERT, UPDATE etc),
stores this variable and its value in thd->user_var_events, so that it can be
written to the binlog (will be written just before the query is written, see
log.cc).
*/
void Item_func_get_user_var::fix_length_and_dec()
{
BINLOG_USER_VAR_EVENT *user_var_event;
THD *thd=current_thd;
BINLOG_USER_VAR_EVENT *user_var_event;
maybe_null=1;
decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH;
if ((var_entry= get_variable(&thd->user_vars, name, 0)))
var_entry= get_variable(&thd->user_vars, name, 0);
if (!(opt_bin_log && is_update_query(thd->lex.sql_command)))
return;
if (!var_entry)
{
if (opt_bin_log && is_update_query(thd->lex.sql_command) &&
var_entry->used_query_id != thd->query_id)
{
uint size;
/*
First we need to store value of var_entry, when the next situation
appers:
> set @a:=1;
> insert into t1 values (@a), (@a:=@a+1), (@a:=@a+1);
We have to write to binlog value @a= 1;
*/
size= ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT)) + var_entry->length;
if (!(user_var_event= (BINLOG_USER_VAR_EVENT *) thd->alloc(size)))
goto err;
user_var_event->value= (char*) user_var_event +
ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT));
user_var_event->user_var_event= var_entry;
user_var_event->type= var_entry->type;
user_var_event->charset_number= var_entry->collation.collation->number;
if (!var_entry->value)
{
/* NULL value*/
user_var_event->length= 0;
user_var_event->value= 0;
}
else
{
user_var_event->length= var_entry->length;
memcpy(user_var_event->value, var_entry->value,
var_entry->length);
}
var_entry->used_query_id= thd->query_id;
if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event))
goto err;
}
/*
If the variable does not exist, it's NULL, but we want to create it so
that it gets into the binlog (if it didn't, the slave could be
influenced by a variable of the same name previously set by another
thread).
We create it like if it had been explicitely set with SET before.
The 'new' mimicks what sql_yacc.yy does when 'SET @a=10;'.
sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION'
in dispatch_command()). Instead of building a one-element list to pass to
sql_set_variables(), we could instead manually call check() and update();
this would save memory and time; but calling sql_set_variables() makes one
unique place to maintain (sql_set_variables()).
*/
List<set_var_base> tmp_var_list;
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
new Item_null())));
if (sql_set_variables(thd, &tmp_var_list)) /* this will create the variable */
goto err;
if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
goto err;
}
/*
If this variable was already stored in user_var_events by this query
(because it's used in more than one place in the query), don't store
it.
*/
else if (var_entry->used_query_id == thd->query_id)
return;
uint size;
/*
First we need to store value of var_entry, when the next situation
appers:
> set @a:=1;
> insert into t1 values (@a), (@a:=@a+1), (@a:=@a+1);
We have to write to binlog value @a= 1;
*/
size= ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT)) + var_entry->length;
if (!(user_var_event= (BINLOG_USER_VAR_EVENT *) thd->alloc(size)))
goto err;
user_var_event->value= (char*) user_var_event +
ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT));
user_var_event->user_var_event= var_entry;
user_var_event->type= var_entry->type;
user_var_event->charset_number= var_entry->collation.collation->number;
if (!var_entry->value)
{
/* NULL value*/
user_var_event->length= 0;
user_var_event->value= 0;
}
else
{
user_var_event->length= var_entry->length;
memcpy(user_var_event->value, var_entry->value,
var_entry->length);
}
/* Mark that this variable has been used by this query */
var_entry->used_query_id= thd->query_id;
if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event))
goto err;
return;
err:
......
......@@ -49,7 +49,7 @@ void Item_row::illegal_method_call(const char *method)
DBUG_ENTER("Item_row::illegal_method_call");
DBUG_PRINT("error", ("!!! %s method was called for row item", method));
DBUG_ASSERT(0);
my_error(ER_CARDINALITY_COL, MYF(0), 1);
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
DBUG_VOID_RETURN;
}
......@@ -112,7 +112,7 @@ bool Item_row::check_cols(uint c)
{
if (c != arg_count)
{
my_error(ER_CARDINALITY_COL, MYF(0), c);
my_error(ER_OPERAND_COLUMNS, MYF(0), c);
return 1;
}
return 0;
......
......@@ -105,7 +105,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
// Is it one field subselect?
if (engine->cols() > max_columns)
{
my_error(ER_CARDINALITY_COL, MYF(0), 1);
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
return 1;
}
fix_length_and_dec();
......@@ -262,7 +262,7 @@ bool Item_singlerow_subselect::check_cols(uint c)
{
if (c != engine->cols())
{
my_error(ER_CARDINALITY_COL, MYF(0), c);
my_error(ER_OPERAND_COLUMNS, MYF(0), c);
return 1;
}
return 0;
......@@ -527,7 +527,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
Item *item;
if (select_lex->item_list.elements > 1)
{
my_error(ER_CARDINALITY_COL, MYF(0), 1);
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
DBUG_RETURN(RES_ERROR);
}
......
......@@ -387,7 +387,7 @@ class Item_sum_hybrid :public Item_sum
Item_sum(thd, item), value(item.value), tmp_value(item.tmp_value),
sum(item.sum), sum_int(item.sum_int), hybrid_type(item.hybrid_type),
hybrid_field_type(item.hybrid_field_type),cmp_sign(item.cmp_sign),
used_table_cache(used_table_cache), cmp_charset(item.cmp_charset) {}
used_table_cache(item.used_table_cache), cmp_charset(item.cmp_charset) {}
bool fix_fields(THD *, TABLE_LIST *, Item **);
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
......
......@@ -1086,6 +1086,23 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
*/
close_temporary_tables(thd);
cleanup_load_tmpdir();
/*
As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died while
writing the transaction to the binary log, i.e. while flushing the binlog
cache to the binlog. As the write was started, the transaction had been
committed on the master, so we lack of information to replay this
transaction on the slave; all we can do is stop with error.
*/
if (thd->options & OPTION_BEGIN)
{
slave_print_error(rli, 0,
"there is an unfinished transaction in the relay log \
(could find neither COMMIT nor ROLLBACK in the relay log); it could be that \
the master died while writing the transaction to its binary log. Now the slave \
is rolling back the transaction.");
return(1);
}
break;
/*
......@@ -1845,25 +1862,6 @@ int Rotate_log_event::write_data(IO_CACHE* file)
We can't rotate the slave as this will cause infinitive rotations
in a A -> B -> A setup.
NOTES
As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died while
writing the transaction to the binary log, i.e. while flushing the binlog
cache to the binlog. As the write was started, the transaction had been
committed on the master, so we lack of information to replay this
transaction on the slave; all we can do is stop with error.
If we didn't detect it, then positions would start to become garbage (as we
are incrementing rli->relay_log_pos whereas we are in a transaction: the
new rli->relay_log_pos will be
relay_log_pos of the BEGIN + size of the Rotate event = garbage.
Since MySQL 4.0.14, the master ALWAYS sends a Rotate event when it starts
sending the next binlog, so we are sure to receive a Rotate event just
after the end of the "dead master"'s binlog; so this exec_event() is the
right place to catch the problem. If we would wait until
Start_log_event::exec_event() it would be too late, rli->relay_log_pos
would already be garbage.
RETURN VALUES
0 ok
*/
......@@ -1871,35 +1869,31 @@ int Rotate_log_event::write_data(IO_CACHE* file)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
{
char* log_name = rli->group_master_log_name;
DBUG_ENTER("Rotate_log_event::exec_event");
pthread_mutex_lock(&rli->data_lock);
if (thd->options & OPTION_BEGIN)
{
slave_print_error(rli, 0,
opt_using_transactions ?
"\
There is an unfinished transaction in the relay log (could find neither \
COMMIT nor ROLLBACK in the relay log); It could be that the master died while \
writing the transaction to its binary log. Now the slave is rolling back the \
transaction." :
"\
There is an unfinished transaction in the relay log (could find neither \
COMMIT nor ROLLBACK in the relay log); It could be that the master died while \
writing the transaction to its binary log.");
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
memcpy(log_name, new_log_ident, ident_len+1);
rli->notify_group_master_log_name_update();
rli->group_master_log_pos = pos;
rli->event_relay_log_pos += get_event_len();
rli->group_relay_log_pos = rli->event_relay_log_pos;
DBUG_PRINT("info", ("group_master_log_pos: %lu",
(ulong) rli->group_master_log_pos));
/*
If we are in a transaction: the only normal case is when the I/O thread was
copying a big transaction, then it was stopped and restarted: we have this
in the relay log:
BEGIN
...
ROTATE (a fake one)
...
COMMIT or ROLLBACK
In that case, we don't want to touch the coordinates which correspond to the
beginning of the transaction.
*/
if (!(thd->options & OPTION_BEGIN))
{
memcpy(rli->group_master_log_name, new_log_ident, ident_len+1);
rli->notify_group_master_log_name_update();
rli->group_master_log_pos = pos;
rli->group_relay_log_pos = rli->event_relay_log_pos;
DBUG_PRINT("info", ("group_master_log_pos: %lu",
(ulong) rli->group_master_log_pos));
}
pthread_mutex_unlock(&rli->data_lock);
pthread_cond_broadcast(&rli->data_cond);
flush_relay_log_info(rli);
......
......@@ -325,7 +325,9 @@ typedef compare_func_creator (*chooser_compare_func_creator)(bool invert);
struct Query_cache_query_flags
{
unsigned int client_long_flag:1;
uint charset_num;
uint character_set_client_num;
uint character_set_results_num;
uint collation_connection_num;
ha_rows limit;
};
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
......
......@@ -252,8 +252,8 @@ character-set=latin2
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -265,8 +265,8 @@ character-set=latin2
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -246,8 +246,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -259,8 +259,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -254,8 +254,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -267,8 +267,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -243,8 +243,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -256,8 +256,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client"
"All parts of a SPATIAL KEY must be NOT NULL"
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Slave is already running"
"Slave has already been stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
......
......@@ -248,8 +248,8 @@ character-set=latin7
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -261,8 +261,8 @@ character-set=latin7
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -243,8 +243,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -256,8 +256,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -252,7 +252,7 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Falsche Foreign-Key Definition für '%-64s': %s",
"Schlüssel- und Tabellenreferenz passen nicht zueinander.",
"Kardinalitäts-Fehler (mehr/oder weniger als %d Spalten).",
"Operand should contain %d column(s)",
"Unterabfrage lieferte mehr als einen Datensatz zurück.",
"Unbekannter prepared statement handler (%ld) für %s angegeben.",
"Die Hilfedatenbank ist beschädigt oder existiert nicht.",
......@@ -265,8 +265,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -243,8 +243,8 @@ character-set=greek
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -256,8 +256,8 @@ character-set=greek
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -245,8 +245,8 @@ character-set=latin2
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -258,8 +258,8 @@ character-set=latin2
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -243,8 +243,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -256,8 +256,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -245,8 +245,8 @@ character-set=ujis
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -258,8 +258,8 @@ character-set=ujis
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -243,8 +243,8 @@ character-set=euckr
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -256,8 +256,8 @@ character-set=euckr
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -245,8 +245,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -258,8 +258,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -245,8 +245,8 @@ character-set=latin1
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -258,8 +258,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -247,8 +247,8 @@ character-set=latin2
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -260,8 +260,8 @@ character-set=latin2
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -244,7 +244,7 @@ character-set=latin1
"Slave SQL thread ignorado a consulta devido às normas de replicação-*-tabela"
"Definição errada da chave estrangeira para '%-.64s': %s",
"Referência da chave e referência da tabela não coincidem",
"Error de cardinalidade (mais/menos que %d colunas)",
"Operand should contain %d column(s)",
"Subconsulta retorna mais que 1 registro",
"Desconhecido manipulador de declaração preparado (%ld) determinado para %s",
"Banco de dado de ajuda corrupto ou não existente",
......
......@@ -247,8 +247,8 @@ character-set=latin2
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -260,8 +260,8 @@ character-set=latin2
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -245,7 +245,7 @@ character-set=koi8r
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
" (/ %d )",
" %d ",
" ",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
......@@ -258,8 +258,8 @@ character-set=koi8r
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -238,8 +238,8 @@ character-set=cp1250
"User '%-.64s' has exceeded the '%s' resource (current value: %ld)",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -251,8 +251,8 @@ character-set=cp1250
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -251,8 +251,8 @@ character-set=latin2
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -264,8 +264,8 @@ character-set=latin2
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -245,8 +245,8 @@ character-set=latin1
"Slave SQL thread ignorado el query debido a las reglas de replicación-*-tabla"
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subquery returns more than 1 record",
"Operand should contain %d column(s)",
"Subquery returns more than 1 row",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......@@ -258,8 +258,8 @@ character-set=latin1
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -243,7 +243,7 @@ character-set=latin1
"Slav SQL tråden ignorerade frågan pga en replicate-*-table regel",
"Felaktig FOREIGN KEY-definition för '%-.64s': %s",
"Nyckelreferensen och tabellreferensen stämmer inte överens",
"Kardinalitetsfel (fler/färre än %d kolumner)",
"Operand should contain %d column(s)",
"Subquery returnerade mer än 1 rad",
"Okänd PREPARED STATEMENT id (%ld) var given till %s",
"Hjälpdatabasen finns inte eller är skadad",
......
......@@ -248,7 +248,7 @@ character-set=koi8u
"Slave SQL thread ignored the query because of replicate-*-table rules",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (¦/ Φ %d æ)",
" %d æ",
" ¦ i 1 ",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
......@@ -261,8 +261,8 @@ character-set=koi8u
"Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"The slave was already running",
"The slave was already stopped",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_BUF_ERROR: Not enough memory available for zlib",
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
......
......@@ -770,7 +770,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ?
1 : 0);
flags.charset_num= thd->charset()->number;
flags.character_set_client_num= thd->variables.character_set_client->number;
flags.character_set_results_num= thd->variables.character_set_results->number;
flags.collation_connection_num= thd->variables.collation_connection->number;
flags.limit= thd->variables.select_limit;
STRUCT_LOCK(&structure_guard_mutex);
......@@ -950,7 +952,9 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ?
1 : 0);
flags.charset_num= thd->charset()->number;
flags.character_set_client_num= thd->variables.character_set_client->number;
flags.character_set_results_num= thd->variables.character_set_results->number;
flags.collation_connection_num= thd->variables.collation_connection->number;
flags.limit= thd->variables.select_limit;
memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
&flags, QUERY_CACHE_FLAGS_SIZE);
......@@ -3105,7 +3109,7 @@ void Query_cache::queries_dump()
str[len]= 0; // make zero ending DB name
DBUG_PRINT("qcache", ("F:%u C:%u L:%lu (%u) '%s' '%s'",
flags.client_long_flag,
flags.charset_num, (ulong)flags.limit,
flags.character_set_client_num, (ulong)flags.limit,
len, str, strend(str)+1));
DBUG_PRINT("qcache", ("-b- 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx", (ulong) block,
(ulong) block->next, (ulong) block->prev,
......
......@@ -1023,7 +1023,7 @@ bool select_singlerow_subselect::send_data(List<Item> &items)
Item_singlerow_subselect *it= (Item_singlerow_subselect *)item;
if (it->assigned())
{
my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0));
my_message(ER_SUBQUERY_NO_1_ROW, ER(ER_SUBQUERY_NO_1_ROW), MYF(0));
DBUG_RETURN(1);
}
if (unit->offset_limit_cnt)
......
......@@ -430,6 +430,8 @@ class THD :public ilink
unsigned long client_stmt_id;
unsigned long client_param_count;
struct st_mysql_bind *client_params;
char *extra_data;
ulong extra_length;
#endif
NET net; // client connection descriptor
LEX lex; // parse tree descriptor
......
......@@ -1473,12 +1473,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
error=TRUE;
break;
#endif
#ifndef EMBEDDED_LIBRARY
case COM_STATISTICS:
{
mysql_log.write(thd,command,NullS);
statistic_increment(com_stat[SQLCOM_SHOW_STATUS],&LOCK_status);
#ifndef EMBEDDED_LIBRARY
char buff[200];
#else
char *buff= thd->net.last_error;
#endif
ulong uptime = (ulong) (thd->start_time - start_time);
sprintf((char*) buff,
"Uptime: %ld Threads: %d Questions: %lu Slow queries: %ld Opens: %ld Flush tables: %ld Open tables: %u Queries per second avg: %.3f",
......@@ -1491,12 +1494,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK",
(sf_malloc_cur_memory+1023L)/1024L,
(sf_malloc_max_memory+1023L)/1024L);
#endif
#endif
#ifndef EMBEDDED_LIBRARY
VOID(my_net_write(net, buff,(uint) strlen(buff)));
VOID(net_flush(net));
#endif
break;
}
#endif
case COM_PING:
statistic_increment(com_other,&LOCK_status);
send_ok(thd); // Tell client we are alive
......
......@@ -169,6 +169,7 @@ static bool send_prep_stmt(PREP_STMT *stmt, uint columns __attribute__((unused))
thd->client_stmt_id= stmt->stmt_id;
thd->client_param_count= stmt->param_count;
thd->net.last_errno= 0;
return 0;
}
......@@ -1087,16 +1088,17 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length)
PREP_STMT *stmt;
DBUG_ENTER("mysql_stmt_get_longdata");
#ifndef EMBEDDED_LIBRARY
/* The following should never happen */
if (packet_length < MYSQL_LONG_DATA_HEADER+1)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "get_longdata");
DBUG_VOID_RETURN;
}
#endif
ulong stmt_id= uint4korr(pos);
uint param_number= uint2korr(pos+4);
pos+= MYSQL_LONG_DATA_HEADER; // Point to data
if (!(stmt=find_prepared_statement(thd, stmt_id, "get_longdata")))
{
......@@ -1108,6 +1110,7 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length)
DBUG_VOID_RETURN;
}
#ifndef EMBEDDED_LIBRARY
if (param_number >= stmt->param_count)
{
/* Error will be sent in execute call */
......@@ -1116,8 +1119,15 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length)
sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS), "get_longdata");
DBUG_VOID_RETURN;
}
pos+= MYSQL_LONG_DATA_HEADER; // Point to data
#endif
Item_param *param= *(stmt->param+param_number);
#ifndef EMBEDDED_LIBRARY
param->set_longdata(pos, packet_length-MYSQL_LONG_DATA_HEADER-1);
#else
param->set_longdata(thd->extra_data, thd->extra_length);
#endif
stmt->long_data_used= 1;
DBUG_VOID_RETURN;
}
......
......@@ -3060,6 +3060,13 @@ join_table:
| '(' SELECT_SYM select_derived ')' opt_table_alias
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_UPDATE &&
&lex->select_lex == lex->current_select->outer_select())
{
send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
SELECT_LEX_UNIT *unit= lex->current_select->master_unit();
lex->current_select= unit->outer_select();
if (!($$= lex->current_select->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment