Commit a9856042 authored by unknown's avatar unknown

merged


mysql-test/r/ps_1general.result:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Auto merged
mysql-test/r/ps_3innodb.result:
  Auto merged
mysql-test/r/ps_4heap.result:
  Auto merged
mysql-test/r/ps_5merge.result:
  Auto merged
mysql-test/r/ps_6bdb.result:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 3efc721a 062ac038
......@@ -317,58 +317,59 @@
#define ER_UNKNOWN_TIME_ZONE 1298
#define ER_WARN_INVALID_TIMESTAMP 1299
#define ER_INVALID_CHARACTER_STRING 1300
#define ER_SP_NO_RECURSIVE_CREATE 1301
#define ER_SP_ALREADY_EXISTS 1302
#define ER_SP_DOES_NOT_EXIST 1303
#define ER_SP_DROP_FAILED 1304
#define ER_SP_STORE_FAILED 1305
#define ER_SP_LILABEL_MISMATCH 1306
#define ER_SP_LABEL_REDEFINE 1307
#define ER_SP_LABEL_MISMATCH 1308
#define ER_SP_UNINIT_VAR 1309
#define ER_SP_BADSELECT 1310
#define ER_SP_BADRETURN 1311
#define ER_SP_BADSTATEMENT 1312
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1313
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1314
#define ER_QUERY_INTERRUPTED 1315
#define ER_SP_WRONG_NO_OF_ARGS 1316
#define ER_SP_COND_MISMATCH 1317
#define ER_SP_NORETURN 1318
#define ER_SP_NORETURNEND 1319
#define ER_SP_BAD_CURSOR_QUERY 1320
#define ER_SP_BAD_CURSOR_SELECT 1321
#define ER_SP_CURSOR_MISMATCH 1322
#define ER_SP_CURSOR_ALREADY_OPEN 1323
#define ER_SP_CURSOR_NOT_OPEN 1324
#define ER_SP_UNDECLARED_VAR 1325
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1326
#define ER_SP_FETCH_NO_DATA 1327
#define ER_SP_DUP_PARAM 1328
#define ER_SP_DUP_VAR 1329
#define ER_SP_DUP_COND 1330
#define ER_SP_DUP_CURS 1331
#define ER_SP_CANT_ALTER 1332
#define ER_SP_SUBSELECT_NYI 1333
#define ER_SP_NO_USE 1334
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1335
#define ER_SP_CURSOR_AFTER_HANDLER 1336
#define ER_SP_CASE_NOT_FOUND 1337
#define ER_FPARSER_TOO_BIG_FILE 1338
#define ER_FPARSER_BAD_HEADER 1339
#define ER_FPARSER_EOF_IN_COMMENT 1340
#define ER_FPARSER_ERROR_IN_PARAMETER 1341
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1342
#define ER_VIEW_NO_EXPLAIN 1343
#define ER_FRM_UNKNOWN_TYPE 1344
#define ER_WRONG_OBJECT 1345
#define ER_NONUPDATEABLE_COLUMN 1346
#define ER_VIEW_SELECT_DERIVED 1347
#define ER_VIEW_SELECT_PROCEDURE 1348
#define ER_VIEW_SELECT_VARIABLE 1349
#define ER_VIEW_SELECT_TMPTABLE 1350
#define ER_VIEW_WRONG_LIST 1351
#define ER_WARN_VIEW_MERGE 1352
#define ER_WARN_VIEW_WITHOUT_KEY 1353
#define ER_VIEW_INVALID 1354
#define ER_ERROR_MESSAGES 355
#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
#define ER_SP_NO_RECURSIVE_CREATE 1302
#define ER_SP_ALREADY_EXISTS 1303
#define ER_SP_DOES_NOT_EXIST 1304
#define ER_SP_DROP_FAILED 1305
#define ER_SP_STORE_FAILED 1306
#define ER_SP_LILABEL_MISMATCH 1307
#define ER_SP_LABEL_REDEFINE 1308
#define ER_SP_LABEL_MISMATCH 1309
#define ER_SP_UNINIT_VAR 1310
#define ER_SP_BADSELECT 1311
#define ER_SP_BADRETURN 1312
#define ER_SP_BADSTATEMENT 1313
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1314
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1315
#define ER_QUERY_INTERRUPTED 1316
#define ER_SP_WRONG_NO_OF_ARGS 1317
#define ER_SP_COND_MISMATCH 1318
#define ER_SP_NORETURN 1319
#define ER_SP_NORETURNEND 1320
#define ER_SP_BAD_CURSOR_QUERY 1321
#define ER_SP_BAD_CURSOR_SELECT 1322
#define ER_SP_CURSOR_MISMATCH 1323
#define ER_SP_CURSOR_ALREADY_OPEN 1324
#define ER_SP_CURSOR_NOT_OPEN 1325
#define ER_SP_UNDECLARED_VAR 1326
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1327
#define ER_SP_FETCH_NO_DATA 1328
#define ER_SP_DUP_PARAM 1329
#define ER_SP_DUP_VAR 1330
#define ER_SP_DUP_COND 1331
#define ER_SP_DUP_CURS 1332
#define ER_SP_CANT_ALTER 1333
#define ER_SP_SUBSELECT_NYI 1334
#define ER_SP_NO_USE 1335
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1336
#define ER_SP_CURSOR_AFTER_HANDLER 1337
#define ER_SP_CASE_NOT_FOUND 1338
#define ER_FPARSER_TOO_BIG_FILE 1339
#define ER_FPARSER_BAD_HEADER 1340
#define ER_FPARSER_EOF_IN_COMMENT 1341
#define ER_FPARSER_ERROR_IN_PARAMETER 1342
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1343
#define ER_VIEW_NO_EXPLAIN 1344
#define ER_FRM_UNKNOWN_TYPE 1345
#define ER_WRONG_OBJECT 1346
#define ER_NONUPDATEABLE_COLUMN 1347
#define ER_VIEW_SELECT_DERIVED 1348
#define ER_VIEW_SELECT_PROCEDURE 1349
#define ER_VIEW_SELECT_VARIABLE 1350
#define ER_VIEW_SELECT_TMPTABLE 1351
#define ER_VIEW_WRONG_LIST 1352
#define ER_WARN_VIEW_MERGE 1353
#define ER_WARN_VIEW_WITHOUT_KEY 1354
#define ER_VIEW_INVALID 1355
#define ER_ERROR_MESSAGES 356
......@@ -246,6 +246,11 @@ select a,b from t1 order by 2 ;
prepare stmt1 from ' select a,b from t1
order by ? ';
execute stmt1 using @arg00;
set @arg00=1 ;
execute stmt1 using @arg00;
set @arg00=0 ;
--error 1054
execute stmt1 using @arg00;
##### parameter used in limit clause
set @arg00=1;
......
......@@ -225,6 +225,8 @@ substring_index("www.tcx.se","",3)
select length(repeat("a",100000000)),length(repeat("a",1000*64));
length(repeat("a",100000000)) length(repeat("a",1000*64))
NULL 64000
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql"));
position("0" in "baaa" in (1)) position("0" in "1" in (1,2,3)) position("sql" in ("mysql"))
1 0 3
......
......@@ -8,6 +8,8 @@ len
select repeat('a',2000);
repeat('a',2000)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
......
......@@ -334,6 +334,16 @@ a b
1 one
3 three
2 two
set @arg00=1 ;
execute stmt1 using @arg00;
a b
1 one
2 two
3 three
4 four
set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
......
......@@ -334,6 +334,16 @@ a b
1 one
3 three
2 two
set @arg00=1 ;
execute stmt1 using @arg00;
a b
1 one
2 two
3 three
4 four
set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
......
......@@ -335,6 +335,16 @@ a b
1 one
3 three
2 two
set @arg00=1 ;
execute stmt1 using @arg00;
a b
1 one
2 two
3 three
4 four
set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
......
......@@ -377,6 +377,16 @@ a b
1 one
3 three
2 two
set @arg00=1 ;
execute stmt1 using @arg00;
a b
1 one
2 two
3 three
4 four
set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
......@@ -1560,6 +1570,16 @@ a b
1 one
3 three
2 two
set @arg00=1 ;
execute stmt1 using @arg00;
a b
1 one
2 two
3 three
4 four
set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
......
......@@ -334,6 +334,16 @@ a b
1 one
3 three
2 two
set @arg00=1 ;
execute stmt1 using @arg00;
a b
1 one
2 two
3 three
4 four
set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
......
......@@ -116,10 +116,14 @@ static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table)
pthread_mutex_lock(&LOCK_mysql_create_db);
if (!archive_init)
{
archive_init++;
VOID(pthread_mutex_init(&archive_mutex,MY_MUTEX_INIT_FAST));
(void) hash_init(&archive_open_tables,system_charset_info,32,0,0,
(hash_get_key) archive_get_key,0,0);
if (!hash_init(&archive_open_tables,system_charset_info,32,0,0,
(hash_get_key) archive_get_key,0,0))
{
pthread_mutex_unlock(&LOCK_mysql_create_db);
return NULL;
}
archive_init++;
}
pthread_mutex_unlock(&LOCK_mysql_create_db);
}
......@@ -130,11 +134,10 @@ static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table)
(byte*) table_name,
length)))
{
if (!(share=(ARCHIVE_SHARE *)
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&share, sizeof(*share),
&tmp_name, length+1,
NullS)))
NullS))
{
pthread_mutex_unlock(&archive_mutex);
return NULL;
......@@ -238,11 +241,7 @@ int ha_archive::open(const char *name, int mode, uint test_if_locked)
int ha_archive::close(void)
{
DBUG_ENTER("ha_archive::close");
int rc= 0;
if (gzclose(archive) == Z_ERRNO)
rc =-1;
rc |= free_share(share);
DBUG_RETURN(rc);
DBUG_RETURN(((gzclose(archive) == Z_ERRNO || free_share(share)) ? -1 : 0));
}
......@@ -276,12 +275,7 @@ int ha_archive::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *creat
}
version= ARCHIVE_VERSION;
written= gzwrite(archive, &version, sizeof(version));
if (written == 0 || written != sizeof(version))
{
delete_table(name);
DBUG_RETURN(-1);
}
if (gzclose(archive))
if (written != sizeof(version) || gzclose(archive))
{
delete_table(name);
DBUG_RETURN(-1);
......@@ -305,7 +299,7 @@ int ha_archive::write_row(byte * buf)
update_timestamp(buf+table->timestamp_default_now-1);
written= gzwrite(share->archive_write, buf, table->reclength);
share->dirty= true;
if (written == 0 || written != table->reclength)
if (written != table->reclength)
DBUG_RETURN(-1);
for (Field_blob **field=table->blob_field ; *field ; field++)
......@@ -315,7 +309,7 @@ int ha_archive::write_row(byte * buf)
(*field)->get_ptr(&ptr);
written= gzwrite(share->archive_write, ptr, (unsigned)size);
if (written == 0 || written != size)
if (written != size)
DBUG_RETURN(-1);
}
......
......@@ -446,7 +446,13 @@ String *Item_func_spatial_collection::val_str(String *str)
}
}
if (str->length() > current_thd->variables.max_allowed_packet)
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), current_thd->variables.max_allowed_packet);
goto err;
}
null_value = 0;
return str;
......
......@@ -266,7 +266,13 @@ String *Item_func_concat::val_str(String *str)
continue;
if (res->length()+res2->length() >
current_thd->variables.max_allowed_packet)
goto null; // Error check
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
current_thd->variables.max_allowed_packet);
goto null;
}
if (res->alloced_length() >= res->length()+res2->length())
{ // Use old buffer
res->append(*res2);
......@@ -544,7 +550,13 @@ String *Item_func_concat_ws::val_str(String *str)
if (res->length() + sep_str->length() + res2->length() >
current_thd->variables.max_allowed_packet)
goto null; // Error check
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
current_thd->variables.max_allowed_packet);
goto null;
}
if (res->alloced_length() >=
res->length() + sep_str->length() + res2->length())
{ // Use old buffer
......@@ -801,7 +813,15 @@ String *Item_func_replace::val_str(String *str)
offset= (int) (ptr-res->ptr());
if (res->length()-from_length + to_length >
current_thd->variables.max_allowed_packet)
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(),
current_thd->variables.max_allowed_packet);
goto null;
}
if (!alloced)
{
alloced=1;
......@@ -822,7 +842,13 @@ String *Item_func_replace::val_str(String *str)
{
if (res->length()-from_length + to_length >
current_thd->variables.max_allowed_packet)
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
current_thd->variables.max_allowed_packet);
goto null;
}
if (!alloced)
{
alloced=1;
......@@ -882,7 +908,13 @@ String *Item_func_insert::val_str(String *str)
length=res->length()-start;
if (res->length() - length + res2->length() >
current_thd->variables.max_allowed_packet)
goto null; // OOM check
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), current_thd->variables.max_allowed_packet);
goto null;
}
res=copy_if_not_alloced(str,res,res->length());
res->replace(start,length,*res2);
return res;
......@@ -1934,7 +1966,13 @@ String *Item_func_repeat::val_str(String *str)
length=res->length();
// Safe length check
if (length > current_thd->variables.max_allowed_packet/count)
goto err; // Probably an error
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), current_thd->variables.max_allowed_packet);
goto err;
}
tot_length= length*(uint) count;
if (!(res= alloc_buffer(res,str,&tmp_value,tot_length)))
goto err;
......@@ -1999,8 +2037,15 @@ String *Item_func_rpad::val_str(String *str)
return (res);
}
pad_char_length= rpad->numchars();
if ((ulong) byte_count > current_thd->variables.max_allowed_packet ||
args[2]->null_value || !pad_char_length)
if ((ulong) byte_count > current_thd->variables.max_allowed_packet)
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), current_thd->variables.max_allowed_packet);
goto err;
}
if(args[2]->null_value || !pad_char_length)
goto err;
res_byte_length= res->length(); /* Must be done before alloc_buffer */
if (!(res= alloc_buffer(res,str,&tmp_value,byte_count)))
......@@ -2079,8 +2124,16 @@ String *Item_func_lpad::val_str(String *str)
pad_char_length= pad->numchars();
byte_count= count * collation.collation->mbmaxlen;
if (byte_count > current_thd->variables.max_allowed_packet ||
args[2]->null_value || !pad_char_length || str->alloc(byte_count))
if (byte_count > current_thd->variables.max_allowed_packet)
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), current_thd->variables.max_allowed_packet);
goto err;
}
if (args[2]->null_value || !pad_char_length || str->alloc(byte_count))
goto err;
str->length(0);
......@@ -2368,7 +2421,10 @@ String *Item_load_file::val_str(String *str)
}
if (stat_info.st_size > (long) current_thd->variables.max_allowed_packet)
{
/* my_error(ER_TOO_LONG_STRING, MYF(0), file_name->c_ptr()); */
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), current_thd->variables.max_allowed_packet);
goto err;
}
if (tmp_value.alloc(stat_info.st_size))
......
......@@ -2428,6 +2428,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
thd->query_length= 0; // Should not be needed
thd->query_error= 0;
clear_all_errors(thd, rli);
/*
Usually mysql_init_query() is called by mysql_parse(), but we need it here
as the present method does not call mysql_parse().
*/
mysql_init_query(thd, 0, 0);
if (!use_rli_only_for_errors)
{
/* Saved for InnoDB, see comment in Query_log_event::exec_event() */
......@@ -2457,6 +2462,13 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
/*
Initing thd->row_count is not necessary in theory as this variable has no
influence in the case of the slave SQL thread (it is used to generate a
"data truncated" warning but which is absorbed and never gets to the
error log); still we init it to avoid a Valgrind message.
*/
mysql_reset_errors(thd);
TABLE_LIST tables;
bzero((char*) &tables,sizeof(tables));
......
......@@ -478,7 +478,7 @@ bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
bool is_update_query(enum enum_sql_command command);
bool alloc_query(THD *thd, char *packet, ulong packet_length);
void mysql_init_select(LEX *lex);
void mysql_init_query(THD *thd, bool lexonly=0);
void mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly=0);
bool mysql_new_select(LEX *lex, bool move_down);
void create_select_for_variable(const char *var_name);
void mysql_init_multi_delete(LEX *lex);
......
......@@ -313,6 +313,7 @@ character-set=latin2
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -307,6 +307,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -315,6 +315,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -304,6 +304,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -307,8 +307,8 @@ character-set=latin7
"Got error %d '%-.100s' from %s",
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -304,6 +304,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -316,6 +316,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -304,6 +304,7 @@ character-set=greek
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -306,6 +306,7 @@ character-set=latin2
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -304,6 +304,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -306,6 +306,7 @@ character-set=ujis
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -304,6 +304,7 @@ character-set=euckr
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -306,6 +306,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -306,6 +306,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -308,6 +308,7 @@ character-set=latin2
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -305,6 +305,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -308,6 +308,7 @@ character-set=latin2
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -306,6 +306,7 @@ character-set=koi8r
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -310,6 +310,7 @@ character-set=cp1250
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -312,6 +312,7 @@ character-set=latin2
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -306,6 +306,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -304,6 +304,7 @@ character-set=latin1
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -309,6 +309,7 @@ character-set=koi8u
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%d) - truncated"
"Can't create a %s from within another stored routine"
"%s %s already exists"
"%s %s does not exist"
......
......@@ -106,7 +106,7 @@ void lex_free(void)
(We already do too much here)
*/
LEX *lex_start(THD *thd, uchar *buf,uint length)
void lex_start(THD *thd, uchar *buf,uint length)
{
LEX *lex= thd->lex;
lex->thd= thd;
......@@ -114,7 +114,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->buf= buf;
lex->end_of_query=(lex->ptr=buf)+length;
lex->yylineno = 1;
lex->select_lex.parsing_place= SELECT_LEX_NODE::NO_MATTER;
lex->in_comment=0;
lex->length=0;
lex->select_lex.in_sum_expr=0;
......@@ -136,7 +135,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
hash_init(&lex->spfuns, system_charset_info, 0, 0, 0,
sp_lex_spfuns_key, 0, 0);
return lex;
}
void lex_end(LEX *lex)
......@@ -1006,6 +1004,7 @@ void st_select_lex::init_query()
subquery_in_having= explicit_limit= 0;
first_execution= 1;
first_cond_optimization= 1;
parsing_place= SELECT_LEX_NODE::NO_MATTER;
}
void st_select_lex::init_select()
......@@ -1019,9 +1018,9 @@ void st_select_lex::init_select()
in_sum_expr= with_wild= 0;
options= 0;
braces= 0;
when_list.empty();
when_list.empty();
expr_list.empty();
interval_list.empty();
interval_list.empty();
use_index.empty();
ftfunc_list_alloc.empty();
ftfunc_list= &ftfunc_list_alloc;
......@@ -1032,7 +1031,6 @@ void st_select_lex::init_select()
select_limit= HA_POS_ERROR;
offset_limit= 0;
with_sum_func= 0;
parsing_place= SELECT_LEX_NODE::NO_MATTER;
}
/*
......@@ -1052,7 +1050,7 @@ void st_select_lex_node::include_down(st_select_lex_node *upper)
/*
include on level down (but do not link)
SYNOPSYS
st_select_lex_node::include_standalone()
upper - reference on node underr which this node should be included
......
......@@ -406,7 +406,7 @@ class st_select_lex_unit: public st_select_lex_node {
int change_result(select_subselect *result, select_subselect *old_result);
void set_limit(st_select_lex *values, st_select_lex *sl);
friend void mysql_init_query(THD *thd, bool lexonly);
friend void mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly);
friend int subselect_union_engine::exec();
};
typedef class st_select_lex_unit SELECT_LEX_UNIT;
......@@ -560,7 +560,7 @@ class st_select_lex: public st_select_lex_node
bool test_limit();
friend void mysql_init_query(THD *thd, bool lexonly);
friend void mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly);
st_select_lex() {}
void make_empty_select()
{
......@@ -765,7 +765,7 @@ struct st_lex_local: public st_lex
void lex_init(void);
void lex_free(void);
LEX *lex_start(THD *thd, uchar *buf,uint length);
void lex_start(THD *thd, uchar *buf,uint length);
void lex_end(LEX *lex);
extern pthread_key(LEX*,THR_LEX);
......
......@@ -4209,7 +4209,7 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
****************************************************************************/
void
mysql_init_query(THD *thd, bool lexonly)
mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly)
{
DBUG_ENTER("mysql_init_query");
LEX *lex= thd->lex;
......@@ -4243,6 +4243,7 @@ mysql_init_query(THD *thd, bool lexonly)
lex->variables_used= 0;
lex->select_lex.parent_lex= lex;
lex->empty_field_list_on_rset= 0;
lex_start(thd, buf, length);
if (! lexonly)
{
thd->select_number= lex->select_lex.select_number= 1;
......@@ -4391,10 +4392,10 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_ENTER("mysql_parse");
mysql_init_query(thd);
mysql_init_query(thd, (uchar*) inBuf, length);
if (query_cache_send_result_to_client(thd, inBuf, length) <= 0)
{
LEX *lex=lex_start(thd, (uchar*) inBuf, length);
LEX *lex= thd->lex;
if (!yyparse((void *)thd) && ! thd->is_fatal_error)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
......@@ -4460,12 +4461,11 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
{
LEX *lex;
LEX *lex= thd->lex;
bool error= 0;
DBUG_ENTER("mysql_test_parse_for_slave");
mysql_init_query(thd);
lex= lex_start(thd, (uchar*) inBuf, length);
mysql_init_query(thd, (uchar*) inBuf, length);
if (!yyparse((void*) thd) && ! thd->is_fatal_error &&
all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
error= 1; /* Ignore question */
......
......@@ -1611,8 +1611,8 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
mysql_log.write(thd, COM_PREPARE, "%s", packet);
thd->current_arena= stmt;
lex= lex_start(thd, (uchar *) thd->query, thd->query_length);
mysql_init_query(thd);
mysql_init_query(thd, (uchar *) thd->query, thd->query_length);
lex= thd->lex;
lex->safe_to_cache_query= 0;
error= yyparse((void *)thd) || thd->is_fatal_error ||
......
......@@ -9681,7 +9681,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
Item *itemptr=*order->item;
if (itemptr->type() == Item::INT_ITEM)
{ /* Order by position */
uint count= (uint) ((Item_int*)itemptr)->value;
uint count= itemptr->val_int();
if (!count || count > fields.elements)
{
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),
......
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