summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/Makefile.am3
-rw-r--r--sql/field.cc229
-rw-r--r--sql/field.h61
-rw-r--r--sql/filesort.cc11
-rw-r--r--sql/ha_archive.cc22
-rw-r--r--sql/ha_archive.h4
-rw-r--r--sql/ha_berkeley.cc16
-rw-r--r--sql/ha_berkeley.h8
-rw-r--r--sql/ha_federated.cc8
-rw-r--r--sql/ha_heap.cc30
-rw-r--r--sql/ha_innodb.cc9
-rw-r--r--sql/ha_myisam.cc125
-rw-r--r--sql/ha_myisammrg.cc28
-rw-r--r--sql/ha_myisammrg.h3
-rw-r--r--sql/ha_ndbcluster.cc137
-rw-r--r--sql/handler.cc9
-rw-r--r--sql/item.cc151
-rw-r--r--sql/item.h59
-rw-r--r--sql/item_cmpfunc.cc288
-rw-r--r--sql/item_cmpfunc.h131
-rw-r--r--sql/item_func.cc42
-rw-r--r--sql/item_geofunc.cc41
-rw-r--r--sql/item_geofunc.h37
-rw-r--r--sql/item_row.h2
-rw-r--r--sql/item_strfunc.cc41
-rw-r--r--sql/item_strfunc.h6
-rw-r--r--sql/item_subselect.cc78
-rw-r--r--sql/item_subselect.h26
-rw-r--r--sql/item_sum.cc25
-rw-r--r--sql/item_timefunc.cc12
-rw-r--r--sql/lock.cc2
-rw-r--r--sql/log.cc67
-rw-r--r--sql/log_event.cc99
-rw-r--r--sql/log_event.h9
-rw-r--r--sql/mysql_priv.h114
-rw-r--r--sql/mysqld.cc245
-rw-r--r--sql/net_serv.cc10
-rw-r--r--sql/opt_range.cc158
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/password.c7
-rw-r--r--sql/protocol.cc4
-rw-r--r--sql/repl_failsafe.cc12
-rw-r--r--sql/set_var.cc23
-rw-r--r--sql/set_var.h82
-rw-r--r--sql/share/errmsg.txt1082
-rw-r--r--sql/slave.cc115
-rw-r--r--sql/slave.h1
-rw-r--r--sql/sp.cc5
-rw-r--r--sql/sp_head.cc80
-rw-r--r--sql/sp_head.h33
-rw-r--r--sql/spatial.cc38
-rw-r--r--sql/spatial.h16
-rw-r--r--sql/sql_acl.cc6
-rw-r--r--sql/sql_base.cc357
-rw-r--r--sql/sql_cache.cc18
-rw-r--r--sql/sql_cache.h6
-rw-r--r--sql/sql_class.cc101
-rw-r--r--sql/sql_class.h171
-rw-r--r--sql/sql_delete.cc4
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_insert.cc76
-rw-r--r--sql/sql_lex.cc81
-rw-r--r--sql/sql_lex.h20
-rw-r--r--sql/sql_load.cc23
-rw-r--r--sql/sql_parse.cc276
-rw-r--r--sql/sql_prepare.cc66
-rw-r--r--sql/sql_repl.cc10
-rw-r--r--sql/sql_select.cc159
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/sql_show.cc43
-rw-r--r--sql/sql_string.cc19
-rw-r--r--sql/sql_string.h3
-rw-r--r--sql/sql_table.cc70
-rw-r--r--sql/sql_trigger.cc30
-rw-r--r--sql/sql_trigger.h9
-rw-r--r--sql/sql_union.cc95
-rw-r--r--sql/sql_update.cc9
-rw-r--r--sql/sql_view.cc10
-rw-r--r--sql/sql_yacc.yy908
-rw-r--r--sql/table.cc69
-rw-r--r--sql/table.h2
-rw-r--r--sql/tztime.cc27
-rw-r--r--sql/udf_example.def1
-rw-r--r--sql/unireg.cc17
84 files changed, 4119 insertions, 2417 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 1ac8602ebdf..4f84023724f 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -163,7 +163,8 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
# this avoid the rebuild of the built files in a source dist
lex_hash.h: gen_lex_hash.cc lex.h
$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
- ./gen_lex_hash$(EXEEXT) > $@
+ ./gen_lex_hash$(EXEEXT) > $@-t
+ $(MV) $@-t $@
# For testing of udf_example.so
noinst_LTLIBRARIES= udf_example.la
diff --git a/sql/field.cc b/sql/field.cc
index 74a5e742c06..fbb5fb520bc 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1011,6 +1011,7 @@ bool Field::type_can_have_key_part(enum enum_field_types type)
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_GEOMETRY:
return TRUE;
default:
return FALSE;
@@ -1393,12 +1394,12 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
Field_str::Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg,
- struct st_table *table_arg,CHARSET_INFO *charset)
+ struct st_table *table_arg, CHARSET_INFO *charset_arg)
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg)
{
- field_charset=charset;
- if (charset->state & MY_CS_BINSORT)
+ field_charset= charset_arg;
+ if (charset_arg->state & MY_CS_BINSORT)
flags|=BINARY_FLAG;
field_derivation= DERIVATION_IMPLICIT;
}
@@ -1503,7 +1504,7 @@ bool Field::get_time(TIME *ltime)
Needs to be changed if/when we want to support different time formats
*/
-int Field::store_time(TIME *ltime, timestamp_type type)
+int Field::store_time(TIME *ltime, timestamp_type type_arg)
{
char buff[MAX_DATE_STRING_REP_LENGTH];
uint length= (uint) my_TIME_to_str(ltime, buff);
@@ -2199,13 +2200,13 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg,
Field_new_decimal::Field_new_decimal(uint32 len_arg,
- bool maybe_null,
+ bool maybe_null_arg,
const char *name,
struct st_table *t_arg,
uint8 dec_arg,
bool unsigned_arg)
:Field_num((char*) 0, len_arg,
- maybe_null ? (uchar*) "": 0, 0,
+ maybe_null_arg ? (uchar*) "": 0, 0,
NONE, name, t_arg,
dec_arg,
0, unsigned_arg)
@@ -2309,7 +2310,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
int Field_new_decimal::store(const char *from, uint length,
- CHARSET_INFO *charset)
+ CHARSET_INFO *charset_arg)
{
int err;
my_decimal decimal_value;
@@ -2317,7 +2318,7 @@ int Field_new_decimal::store(const char *from, uint length,
if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
- from, length, charset, &decimal_value)) &&
+ from, length, charset_arg, &decimal_value)) &&
table->in_use->abort_on_warning)
{
/* Because "from" is not NUL-terminated and we use %s in the ER() */
@@ -3201,25 +3202,6 @@ void Field_medium::sql_type(String &res) const
** long int
****************************************************************************/
-/*
- A helper function to check whether the next character
- in the string "s" is MINUS SIGN.
-*/
-#ifdef HAVE_CHARSET_ucs2
-static bool test_if_minus(CHARSET_INFO *cs,
- const char *s, const char *e)
-{
- my_wc_t wc;
- return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-';
-}
-#else
-/*
- If not UCS2 support is compiled then it is easier
-*/
-#define test_if_minus(cs, s, e) (*s == '-')
-#endif
-
-
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
{
long store_tmp;
@@ -4810,7 +4792,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
}
-int Field_time::store_time(TIME *ltime, timestamp_type type)
+int Field_time::store_time(TIME *ltime, timestamp_type time_type)
{
long tmp= ((ltime->month ? 0 : ltime->day * 24L) + ltime->hour) * 10000L +
(ltime->minute * 100 + ltime->second);
@@ -5338,27 +5320,30 @@ void Field_date::sql_type(String &res) const
int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
{
TIME l_time;
- long tmp;
int error;
THD *thd= table ? table->in_use : current_thd;
- if (str_to_datetime(from, len, &l_time,
- (TIME_FUZZY_DATE |
- (thd->variables.sql_mode &
- (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
- MODE_INVALID_DATES))),
- &error) <= MYSQL_TIMESTAMP_ERROR)
+ enum enum_mysql_timestamp_type ret;
+ if ((ret= str_to_datetime(from, len, &l_time,
+ (TIME_FUZZY_DATE |
+ (thd->variables.sql_mode &
+ (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
+ MODE_INVALID_DATES))),
+ &error)) <= MYSQL_TIMESTAMP_ERROR)
{
- tmp= 0L;
+ int3store(ptr,0L);
error= 2;
}
else
- tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
+ {
+ int3store(ptr, l_time.day + l_time.month*32 + l_time.year*16*32);
+ if(!error && (ret != MYSQL_TIMESTAMP_DATE))
+ return 2;
+ }
if (error)
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
from, len, MYSQL_TIMESTAMP_DATE, 1);
- int3store(ptr,tmp);
return error;
}
@@ -5405,11 +5390,12 @@ int Field_newdate::store(longlong nr, bool unsigned_val)
}
-int Field_newdate::store_time(TIME *ltime,timestamp_type type)
+int Field_newdate::store_time(TIME *ltime, timestamp_type time_type)
{
long tmp;
int error= 0;
- if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
+ if (time_type == MYSQL_TIMESTAMP_DATE ||
+ time_type == MYSQL_TIMESTAMP_DATETIME)
{
tmp=ltime->year*16*32+ltime->month*32+ltime->day;
if (check_date(ltime, tmp != 0,
@@ -5624,7 +5610,7 @@ int Field_datetime::store(longlong nr, bool unsigned_val)
}
-int Field_datetime::store_time(TIME *ltime,timestamp_type type)
+int Field_datetime::store_time(TIME *ltime,timestamp_type time_type)
{
longlong tmp;
int error= 0;
@@ -5632,7 +5618,8 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
We don't perform range checking here since values stored in TIME
structure always fit into DATETIME range.
*/
- if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
+ if (time_type == MYSQL_TIMESTAMP_DATE ||
+ time_type == MYSQL_TIMESTAMP_DATETIME)
{
tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
(ltime->hour*10000L+ltime->minute*100+ltime->second));
@@ -6007,32 +5994,32 @@ int Field_str::store(double nr)
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
uint length;
bool use_scientific_notation= TRUE;
- uint char_length= field_length / charset()->mbmaxlen;
+ uint local_char_length= field_length / charset()->mbmaxlen;
/*
Check fabs(nr) against longest value that can be stored in field,
which depends on whether the value is < 1 or not, and negative or not
*/
double anr= fabs(nr);
int neg= (nr < 0.0) ? 1 : 0;
- if (char_length > 4 && char_length < 32 &&
- (anr < 1.0 ? anr > 1/(log_10[max(0,(int) char_length-neg-2)]) /* -2 for "0." */
- : anr < log_10[char_length-neg]-1))
+ if (local_char_length > 4 && local_char_length < 32 &&
+ (anr < 1.0 ? anr > 1/(log_10[max(0,(int) local_char_length-neg-2)]) /* -2 for "0." */
+ : anr < log_10[local_char_length-neg]-1))
use_scientific_notation= FALSE;
length= (uint) my_sprintf(buff, (buff, "%-.*g",
(use_scientific_notation ?
- max(0, (int)char_length-neg-5) :
- char_length),
+ max(0, (int)local_char_length-neg-5) :
+ local_char_length),
nr));
/*
+1 below is because "precision" in %g above means the
max. number of significant digits, not the output width.
Thus the width can be larger than number of significant digits by 1
(for decimal point)
- the test for char_length < 5 is for extreme cases,
+ the test for local_char_length < 5 is for extreme cases,
like inserting 500.0 in char(1)
*/
- DBUG_ASSERT(char_length < 5 || length <= char_length+1);
+ DBUG_ASSERT(local_char_length < 5 || length <= local_char_length+1);
return store((const char *) buff, length, charset());
}
@@ -6161,9 +6148,9 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
void Field_string::sort_string(char *to,uint length)
{
- uint tmp=my_strnxfrm(field_charset,
- (unsigned char *) to, length,
- (unsigned char *) ptr, field_length);
+ IF_DBUG(uint tmp=) my_strnxfrm(field_charset,
+ (unsigned char *) to, length,
+ (unsigned char *) ptr, field_length);
DBUG_ASSERT(tmp == length);
}
@@ -6191,10 +6178,11 @@ void Field_string::sql_type(String &res) const
char *Field_string::pack(char *to, const char *from, uint max_length)
{
uint length= min(field_length,max_length);
- uint char_length= max_length/field_charset->mbmaxlen;
- if (length > char_length)
- char_length= my_charpos(field_charset, from, from+length, char_length);
- set_if_smaller(length, char_length);
+ uint local_char_length= max_length/field_charset->mbmaxlen;
+ if (length > local_char_length)
+ local_char_length= my_charpos(field_charset, from, from+length,
+ local_char_length);
+ set_if_smaller(length, local_char_length);
while (length && from[length-1] == ' ')
length--;
*to++= (char) (uchar) length;
@@ -6278,15 +6266,15 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length,
int Field_string::pack_cmp(const char *key, uint length,
my_bool insert_or_update)
{
- uint row_length, key_length;
+ uint row_length, local_key_length;
char *end;
if (length > 255)
{
- key_length= uint2korr(key);
+ local_key_length= uint2korr(key);
key+= 2;
}
else
- key_length= (uint) (uchar) *key++;
+ local_key_length= (uint) (uchar) *key++;
/* Only use 'length' of key, not field_length */
end= ptr + length;
@@ -6296,7 +6284,7 @@ int Field_string::pack_cmp(const char *key, uint length,
return field_charset->coll->strnncollsp(field_charset,
(const uchar*) ptr, row_length,
- (const uchar*) key, key_length,
+ (const uchar*) key, local_key_length,
insert_or_update);
}
@@ -6318,10 +6306,10 @@ uint Field_string::max_packed_col_length(uint max_length)
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
bool keep_type)
{
- Field *new_field;
+ Field *field;
if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
- new_field= Field::new_field(root, new_table, keep_type);
+ field= Field::new_field(root, new_table, keep_type);
else
{
@@ -6330,7 +6318,7 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
This is done to ensure that ALTER TABLE will convert old VARCHAR fields
to now VARCHAR fields.
*/
- new_field= new Field_varstring(field_length, maybe_null(),
+ field= new Field_varstring(field_length, maybe_null(),
field_name, new_table, charset());
/*
Normally orig_table is different from table only if field was created
@@ -6338,9 +6326,9 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
not applicable. But we still need to preserve the original field
metadata for the client-server protocol.
*/
- new_field->orig_table= orig_table;
+ field->orig_table= orig_table;
}
- return new_field;
+ return field;
}
/****************************************************************************
@@ -6481,11 +6469,11 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length)
{
uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
- uint char_length= max_key_length / field_charset->mbmaxlen;
+ uint local_char_length= max_key_length / field_charset->mbmaxlen;
- char_length= my_charpos(field_charset, ptr + length_bytes,
- ptr + length_bytes + length, char_length);
- set_if_smaller(length, char_length);
+ local_char_length= my_charpos(field_charset, ptr + length_bytes,
+ ptr + length_bytes + length, local_char_length);
+ set_if_smaller(length, local_char_length);
return field_charset->coll->strnncollsp(field_charset,
(const uchar*) ptr + length_bytes,
length,
@@ -6595,13 +6583,14 @@ char *Field_varstring::pack(char *to, const char *from, uint max_length)
char *Field_varstring::pack_key(char *to, const char *key, uint max_length)
{
uint length= length_bytes == 1 ? (uint) (uchar) *key : uint2korr(key);
- uint char_length= ((field_charset->mbmaxlen > 1) ?
+ uint local_char_length= ((field_charset->mbmaxlen > 1) ?
max_length/field_charset->mbmaxlen : max_length);
key+= length_bytes;
- if (length > char_length)
+ if (length > local_char_length)
{
- char_length= my_charpos(field_charset, key, key+length, char_length);
- set_if_smaller(length, char_length);
+ local_char_length= my_charpos(field_charset, key, key+length,
+ local_char_length);
+ set_if_smaller(length, local_char_length);
}
*to++= (char) (length & 255);
if (max_length > 255)
@@ -6697,11 +6686,12 @@ const char *Field_varstring::unpack(char *to, const char *from)
}
-int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length,
+int Field_varstring::pack_cmp(const char *a, const char *b,
+ uint key_length_arg,
my_bool insert_or_update)
{
uint a_length, b_length;
- if (key_length > 255)
+ if (key_length_arg > 255)
{
a_length=uint2korr(a); a+= 2;
b_length=uint2korr(b); b+= 2;
@@ -6718,26 +6708,28 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length,
}
-int Field_varstring::pack_cmp(const char *b, uint key_length,
+int Field_varstring::pack_cmp(const char *b, uint key_length_arg,
my_bool insert_or_update)
{
char *a= ptr+ length_bytes;
uint a_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
uint b_length;
- uint char_length= ((field_charset->mbmaxlen > 1) ?
- key_length / field_charset->mbmaxlen : key_length);
+ uint local_char_length= ((field_charset->mbmaxlen > 1) ?
+ key_length_arg / field_charset->mbmaxlen :
+ key_length_arg);
- if (key_length > 255)
+ if (key_length_arg > 255)
{
b_length=uint2korr(b); b+= HA_KEY_BLOB_LENGTH;
}
else
b_length= (uint) (uchar) *b++;
- if (a_length > char_length)
+ if (a_length > local_char_length)
{
- char_length= my_charpos(field_charset, a, a+a_length, char_length);
- set_if_smaller(a_length, char_length);
+ local_char_length= my_charpos(field_charset, a, a+a_length,
+ local_char_length);
+ set_if_smaller(a_length, local_char_length);
}
return field_charset->coll->strnncollsp(field_charset,
@@ -6762,13 +6754,15 @@ uint Field_varstring::max_packed_col_length(uint max_length)
}
-void Field_varstring::get_key_image(char *buff, uint length, imagetype type)
+void Field_varstring::get_key_image(char *buff, uint length,
+ imagetype type_arg)
{
uint f_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
- uint char_length= length / field_charset->mbmaxlen;
+ uint local_char_length= length / field_charset->mbmaxlen;
char *pos= ptr+length_bytes;
- char_length= my_charpos(field_charset, pos, pos + f_length, char_length);
- set_if_smaller(f_length, char_length);
+ local_char_length= my_charpos(field_charset, pos, pos + f_length,
+ local_char_length);
+ set_if_smaller(f_length, local_char_length);
/* Key is always stored with 2 bytes */
int2store(buff,f_length);
memcpy(buff+HA_KEY_BLOB_LENGTH, pos, f_length);
@@ -7024,7 +7018,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
cannot_convert_error_pos, from + length))
return 2;
- if (copy_length < length)
+ if (from_end_pos < from + length)
{
report_data_too_long(this);
return 2;
@@ -7151,13 +7145,13 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
/* The following is used only when comparing a key */
-void Field_blob::get_key_image(char *buff, uint length, imagetype type)
+void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
{
uint32 blob_length= get_length(ptr);
char *blob;
#ifdef HAVE_SPATIAL
- if (type == itMBR)
+ if (type_arg == itMBR)
{
const char *dummy;
MBR mbr;
@@ -7185,10 +7179,10 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type)
#endif /*HAVE_SPATIAL*/
get_ptr(&blob);
- uint char_length= length / field_charset->mbmaxlen;
- char_length= my_charpos(field_charset, blob, blob + blob_length,
- char_length);
- set_if_smaller(blob_length, char_length);
+ uint local_char_length= length / field_charset->mbmaxlen;
+ local_char_length= my_charpos(field_charset, blob, blob + blob_length,
+ local_char_length);
+ set_if_smaller(blob_length, local_char_length);
if ((uint32) length > blob_length)
{
@@ -7217,9 +7211,10 @@ int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length)
uint blob_length=get_length(ptr);
memcpy_fixed(&blob1,ptr+packlength,sizeof(char*));
CHARSET_INFO *cs= charset();
- uint char_length= max_key_length / cs->mbmaxlen;
- char_length= my_charpos(cs, blob1, blob1+blob_length, char_length);
- set_if_smaller(blob_length, char_length);
+ uint local_char_length= max_key_length / cs->mbmaxlen;
+ local_char_length= my_charpos(cs, blob1, blob1+blob_length,
+ local_char_length);
+ set_if_smaller(blob_length, local_char_length);
return Field_blob::cmp(blob1, blob_length,
(char*) key_ptr+HA_KEY_BLOB_LENGTH,
uint2korr(key_ptr));
@@ -7341,11 +7336,11 @@ const char *Field_blob::unpack(char *to, const char *from)
/* Keys for blobs are like keys on varchars */
-int Field_blob::pack_cmp(const char *a, const char *b, uint key_length,
+int Field_blob::pack_cmp(const char *a, const char *b, uint key_length_arg,
my_bool insert_or_update)
{
uint a_length, b_length;
- if (key_length > 255)
+ if (key_length_arg > 255)
{
a_length=uint2korr(a); a+=2;
b_length=uint2korr(b); b+=2;
@@ -7362,19 +7357,19 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length,
}
-int Field_blob::pack_cmp(const char *b, uint key_length,
+int Field_blob::pack_cmp(const char *b, uint key_length_arg,
my_bool insert_or_update)
{
char *a;
+ uint a_length, b_length;
memcpy_fixed(&a,ptr+packlength,sizeof(char*));
if (!a)
- return key_length > 0 ? -1 : 0;
- uint a_length=get_length(ptr);
- uint b_length;
+ return key_length_arg > 0 ? -1 : 0;
- if (key_length > 255)
+ a_length= get_length(ptr);
+ if (key_length_arg > 255)
{
- b_length=uint2korr(b); b+=2;
+ b_length= uint2korr(b); b+=2;
}
else
b_length= (uint) (uchar) *b++;
@@ -7391,13 +7386,14 @@ char *Field_blob::pack_key(char *to, const char *from, uint max_length)
char *save=ptr;
ptr=(char*) from;
uint32 length=get_length(); // Length of from string
- uint char_length= ((field_charset->mbmaxlen > 1) ?
+ uint local_char_length= ((field_charset->mbmaxlen > 1) ?
max_length/field_charset->mbmaxlen : max_length);
if (length)
get_ptr((char**) &from);
- if (length > char_length)
- char_length= my_charpos(field_charset, from, from+length, char_length);
- set_if_smaller(length, char_length);
+ if (length > local_char_length)
+ local_char_length= my_charpos(field_charset, from, from+length,
+ local_char_length);
+ set_if_smaller(length, local_char_length);
*to++= (uchar) length;
if (max_length > 255) // 2 byte length
*to++= (uchar) (length >> 8);
@@ -7484,7 +7480,7 @@ uint Field_blob::max_packed_col_length(uint max_length)
#ifdef HAVE_SPATIAL
-void Field_geom::get_key_image(char *buff, uint length, imagetype type)
+void Field_geom::get_key_image(char *buff, uint length, imagetype type_arg)
{
char *blob;
const char *dummy;
@@ -7582,7 +7578,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
goto err;
wkb_type= uint4korr(from + SRID_SIZE + 1);
if (wkb_type < (uint32) Geometry::wkb_point ||
- wkb_type > (uint32) Geometry::wkb_end)
+ wkb_type > (uint32) Geometry::wkb_last)
goto err;
Field_blob::store_length(length);
if (table->copy_blobs || length <= MAX_FIELD_WIDTH)
@@ -8217,7 +8213,7 @@ int Field_bit::cmp_offset(uint row_offset)
}
-void Field_bit::get_key_image(char *buff, uint length, imagetype type)
+void Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
{
if (bit_len)
{
@@ -8380,7 +8376,7 @@ void create_field::create_length_to_internal_length(void)
void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
- uint32 length_arg, uint32 decimals,
+ uint32 length_arg, uint32 decimals_arg,
bool maybe_null, bool is_unsigned)
{
field_name= "";
@@ -8391,7 +8387,7 @@ void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
charset= &my_charset_bin;
geom_type= Field::GEOM_GEOMETRY;
pack_flag= (FIELDFLAG_NUMBER |
- ((decimals & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
+ ((decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
(maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
(is_unsigned ? 0 : FIELDFLAG_DECIMAL));
}
@@ -9096,12 +9092,13 @@ create_field::create_field(Field *old_field,Field *orig_field)
maximum possible display length for blob
SYNOPSIS
- Field_blob::max_length()
+ Field_blob::max_display_length()
RETURN
length
*/
-uint32 Field_blob::max_length()
+
+uint32 Field_blob::max_display_length()
{
switch (packlength)
{
diff --git a/sql/field.h b/sql/field.h
index fe3c59c89f5..0f30f5332ff 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -153,12 +153,12 @@ public:
virtual void reset_fields() {}
virtual void set_default()
{
- my_ptrdiff_t offset = (my_ptrdiff_t) (table->s->default_values -
+ my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->s->default_values -
table->record[0]);
- memcpy(ptr, ptr + offset, pack_length());
+ memcpy(ptr, ptr + l_offset, pack_length());
if (null_ptr)
*null_ptr= ((*null_ptr & (uchar) ~null_bit) |
- null_ptr[offset] & null_bit);
+ null_ptr[l_offset] & null_bit);
}
virtual bool binary() const { return 1; }
virtual bool zero_pack() const { return 1; }
@@ -225,7 +225,7 @@ public:
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
}
inline void move_field(char *ptr_arg) { ptr=ptr_arg; }
- inline void move_field(my_ptrdiff_t ptr_diff)
+ virtual inline void move_field(my_ptrdiff_t ptr_diff)
{
ptr=ADD_TO_PTR(ptr,ptr_diff,char*);
if (null_ptr)
@@ -235,7 +235,7 @@ public:
{ memcpy(buff,ptr,length); }
inline void set_image(char *buff,uint length, CHARSET_INFO *cs)
{ memcpy(ptr,buff,length); }
- virtual void get_key_image(char *buff, uint length, imagetype type)
+ virtual void get_key_image(char *buff, uint length, imagetype type_arg)
{ get_image(buff,length, &my_charset_bin); }
virtual void set_key_image(char *buff,uint length)
{ set_image(buff,length, &my_charset_bin); }
@@ -300,10 +300,10 @@ public:
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
virtual bool has_charset(void) const { return FALSE; }
- virtual void set_charset(CHARSET_INFO *charset) { }
+ virtual void set_charset(CHARSET_INFO *charset_arg) { }
virtual enum Derivation derivation(void) const
{ return DERIVATION_IMPLICIT; }
- virtual void set_derivation(enum Derivation derivation) { }
+ virtual void set_derivation(enum Derivation derivation_arg) { }
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
int cuted_increment);
bool check_int(const char *str, int length, const char *int_end,
@@ -322,7 +322,7 @@ public:
}
int warn_if_overflow(int op_result);
/* maximum possible display length */
- virtual uint32 max_length()= 0;
+ virtual uint32 max_display_length()= 0;
/* convert decimal to longlong with overflow check */
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
int *err);
@@ -389,12 +389,12 @@ public:
int store(const char *to,uint length,CHARSET_INFO *cs)=0;
uint size_of() const { return sizeof(*this); }
CHARSET_INFO *charset(void) const { return field_charset; }
- void set_charset(CHARSET_INFO *charset) { field_charset=charset; }
+ void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
enum Derivation derivation(void) const { return field_derivation; }
virtual void set_derivation(enum Derivation derivation_arg)
{ field_derivation= derivation_arg; }
bool binary() const { return field_charset == &my_charset_bin; }
- uint32 max_length() { return field_length; }
+ uint32 max_display_length() { return field_length; }
friend class create_field;
my_decimal *val_decimal(my_decimal *);
};
@@ -408,9 +408,9 @@ public:
Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg,
- struct st_table *table_arg,CHARSET_INFO *charset)
+ struct st_table *table_arg, CHARSET_INFO *charset_arg)
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
- field_name_arg, table_arg, charset)
+ field_name_arg, table_arg, charset_arg)
{}
int store_decimal(const my_decimal *d);
@@ -461,7 +461,7 @@ public:
void overflow(bool negative);
bool zero_pack() const { return 0; }
void sql_type(String &str) const;
- uint32 max_length() { return field_length; }
+ uint32 max_display_length() { return field_length; }
};
@@ -505,7 +505,7 @@ public:
void sort_string(char *buff, uint length);
bool zero_pack() const { return 0; }
void sql_type(String &str) const;
- uint32 max_length() { return field_length; }
+ uint32 max_display_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
uint32 pack_length() const { return (uint32) bin_size; }
};
@@ -538,7 +538,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 1; }
void sql_type(String &str) const;
- uint32 max_length() { return 4; }
+ uint32 max_display_length() { return 4; }
};
@@ -574,7 +574,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 2; }
void sql_type(String &str) const;
- uint32 max_length() { return 6; }
+ uint32 max_display_length() { return 6; }
};
@@ -605,7 +605,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 3; }
void sql_type(String &str) const;
- uint32 max_length() { return 8; }
+ uint32 max_display_length() { return 8; }
};
@@ -641,7 +641,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 4; }
void sql_type(String &str) const;
- uint32 max_length() { return 11; }
+ uint32 max_display_length() { return 11; }
};
@@ -684,7 +684,7 @@ public:
uint32 pack_length() const { return 8; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
- uint32 max_length() { return 20; }
+ uint32 max_display_length() { return 20; }
};
#endif
@@ -719,7 +719,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(float); }
void sql_type(String &str) const;
- uint32 max_length() { return 24; }
+ uint32 max_display_length() { return 24; }
};
@@ -762,7 +762,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(double); }
void sql_type(String &str) const;
- uint32 max_length() { return 53; }
+ uint32 max_display_length() { return 53; }
uint size_of() const { return sizeof(*this); }
};
@@ -795,7 +795,7 @@ public:
uint32 pack_length() const { return 0; }
void sql_type(String &str) const;
uint size_of() const { return sizeof(*this); }
- uint32 max_length() { return 4; }
+ uint32 max_display_length() { return 4; }
};
@@ -1175,10 +1175,10 @@ public:
packlength= 4;
if (set_packlength)
{
- uint32 char_length= len_arg/cs->mbmaxlen;
- packlength= char_length <= 255 ? 1 :
- char_length <= 65535 ? 2 :
- char_length <= 16777215 ? 3 : 4;
+ uint32 l_char_length= len_arg/cs->mbmaxlen;
+ packlength= l_char_length <= 255 ? 1 :
+ l_char_length <= 65535 ? 2 :
+ l_char_length <= 16777215 ? 3 : 4;
}
}
enum_field_types type() const { return FIELD_TYPE_BLOB;}
@@ -1256,7 +1256,7 @@ public:
uint size_of() const { return sizeof(*this); }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
- uint32 max_length();
+ uint32 max_display_length();
};
@@ -1374,7 +1374,7 @@ public:
enum_field_types type() const { return FIELD_TYPE_BIT; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
- uint32 max_length() { return field_length; }
+ uint32 max_display_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
Item_result result_type () const { return INT_RESULT; }
int reset(void) { bzero(ptr, bytes_in_rec); return 0; }
@@ -1407,6 +1407,11 @@ public:
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
char *new_ptr, uchar *new_null_ptr,
uint new_null_bit);
+ inline void move_field(my_ptrdiff_t ptr_diff)
+ {
+ Field::move_field(ptr_diff);
+ bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*);
+ }
void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg)
{
bit_ptr= bit_ptr_arg;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 73f480aad02..23d652cb8cc 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -98,7 +98,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
uint maxbuffer;
BUFFPEK *buffpek;
ha_rows records= HA_POS_ERROR;
- uchar **sort_keys;
+ uchar **sort_keys= 0;
IO_CACHE tempfile, buffpek_pointers, *selected_records_file, *outfile;
SORTPARAM param;
bool multi_byte_charset;
@@ -857,12 +857,14 @@ static void make_sortkey(register SORTPARAM *param,
}
else
{
- uchar *end= (uchar*) field->pack((char *) to, field->ptr);
#ifdef HAVE_purify
+ uchar *end= (uchar*) field->pack((char *) to, field->ptr);
uint length= (uint) ((to + addonf->length) - end);
DBUG_ASSERT((int) length >= 0);
if (length)
bzero(end, length);
+#else
+ (void) field->pack((char *) to, field->ptr);
#endif
}
to+= addonf->length;
@@ -1296,7 +1298,10 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
}
else
{
- switch ((sortorder->result_type=sortorder->item->result_type())) {
+ sortorder->result_type= sortorder->item->result_type();
+ if (sortorder->item->result_as_longlong())
+ sortorder->result_type= INT_RESULT;
+ switch (sortorder->result_type) {
case STRING_RESULT:
sortorder->length=sortorder->item->max_length;
set_if_smaller(sortorder->length, thd->variables.max_sort_length);
diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc
index 0f714cc2008..2ee514f29c9 100644
--- a/sql/ha_archive.cc
+++ b/sql/ha_archive.cc
@@ -379,10 +379,8 @@ int ha_archive::write_meta_file(File meta_file, ha_rows rows, bool dirty)
See ha_example.cc for a longer description.
*/
-ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
- TABLE *table, int *rc)
+ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
{
- ARCHIVE_SHARE *share;
char meta_file_name[FN_REFLEN];
uint length;
char *tmp_name;
@@ -410,8 +408,10 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
share->table_name= tmp_name;
share->crashed= FALSE;
share->archive_write_open= FALSE;
- fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME);
- fn_format(meta_file_name,table_name,"",ARM,MY_REPLACE_EXT|MY_UNPACK_FILENAME);
+ fn_format(share->data_file_name,table_name,"",ARZ,
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME);
+ fn_format(meta_file_name,table_name,"",ARM,
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME);
strmov(share->table_name,table_name);
/*
We will use this lock for rows.
@@ -447,7 +447,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
Free the share.
See ha_example.cc for a description.
*/
-int ha_archive::free_share(ARCHIVE_SHARE *share)
+int ha_archive::free_share()
{
int rc= 0;
DBUG_ENTER("ha_archive::free_share");
@@ -527,12 +527,14 @@ int ha_archive::open(const char *name, int mode, uint open_options)
DBUG_PRINT("info", ("archive table was opened for crash %s",
(open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no"));
- share= get_share(name, table, &rc);
+ share= get_share(name, &rc);
if (rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
{
- free_share(share);
+ /* purecov: begin inspected */
+ free_share();
DBUG_RETURN(rc);
+ /* purecov: end */
}
else if (rc == HA_ERR_OUT_OF_MEM)
{
@@ -585,7 +587,7 @@ int ha_archive::close(void)
if (gzclose(archive) == Z_ERRNO)
rc= 1;
/* then also close share */
- rc|= free_share(share);
+ rc|= free_share();
DBUG_RETURN(rc);
}
@@ -747,10 +749,12 @@ int ha_archive::write_row(byte *buf)
DBUG_PRINT("archive",("MyPack is %d\n", (*field)->data_length((char*) buf + (*field)->offset())));
if ((*field)->real_type() == MYSQL_TYPE_VARCHAR)
{
+#ifndef DBUG_OFF
uint actual_length= (*field)->data_length((char*) buf + (*field)->offset());
uint offset= (*field)->offset() + actual_length +
(actual_length > 255 ? 2 : 1);
DBUG_PRINT("archive",("Offset is %d -> %d\n", actual_length, offset));
+#endif
/*
if ((*field)->pack_length() + (*field)->offset() != offset)
bzero(buf + offset, (size_t)((*field)->pack_length() + (actual_length > 255 ? 2 : 1) - (*field)->data_length));
diff --git a/sql/ha_archive.h b/sql/ha_archive.h
index 54d0be69441..76765b98bc9 100644
--- a/sql/ha_archive.h
+++ b/sql/ha_archive.h
@@ -86,8 +86,8 @@ public:
int get_row(gzFile file_to_read, byte *buf);
int read_meta_file(File meta_file, ha_rows *rows);
int write_meta_file(File meta_file, ha_rows rows, bool dirty);
- ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table, int *rc);
- int free_share(ARCHIVE_SHARE *share);
+ ARCHIVE_SHARE *get_share(const char *table_name, int *rc);
+ int free_share();
int init_archive_writer();
bool auto_repair() const { return 1; } // For the moment we just do this
int read_data_header(gzFile file_to_read);
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index d63935f1a9c..2a5fe775ca6 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -233,6 +233,7 @@ static int berkeley_close_connection(THD *thd)
return 0;
}
+
bool berkeley_flush_logs()
{
int error;
@@ -439,6 +440,15 @@ ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const
}
+void ha_berkeley::get_auto_primary_key(byte *to)
+{
+ pthread_mutex_lock(&share->mutex);
+ share->auto_ident++;
+ int5store(to,share->auto_ident);
+ pthread_mutex_unlock(&share->mutex);
+}
+
+
static int
berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key)
{
@@ -797,7 +807,7 @@ int ha_berkeley::pack_row(DBT *row, const byte *record, bool new_row)
ptr+=BDB_HIDDEN_PRIMARY_KEY_LENGTH;
}
row->data=rec_buff;
- row->size= (size_t) (ptr - rec_buff);
+ row->size= (u_int32_t) (ptr - rec_buff);
return 0;
}
@@ -892,7 +902,7 @@ DBT *ha_berkeley::create_key(DBT *key, uint keynr, char *buff,
key_part->length);
key_length-=key_part->length;
}
- key->size= (buff - (char*) key->data);
+ key->size= (u_int32_t) (buff - (char*) key->data);
DBUG_DUMP("key",(char*) key->data, key->size);
DBUG_RETURN(key);
}
@@ -936,7 +946,7 @@ DBT *ha_berkeley::pack_key(DBT *key, uint keynr, char *buff,
key_ptr+=key_part->store_length;
key_length-=key_part->store_length;
}
- key->size= (buff - (char*) key->data);
+ key->size= (u_int32_t) (buff - (char*) key->data);
DBUG_DUMP("key",(char*) key->data, key->size);
DBUG_RETURN(key);
}
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 051990b0ee5..336c90f009a 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -141,13 +141,7 @@ class ha_berkeley: public handler
enum thr_lock_type lock_type);
void get_status();
- inline void get_auto_primary_key(byte *to)
- {
- pthread_mutex_lock(&share->mutex);
- share->auto_ident++;
- int5store(to,share->auto_ident);
- pthread_mutex_unlock(&share->mutex);
- }
+ void get_auto_primary_key(byte *to);
ulonglong get_auto_increment();
void print_error(int error, myf errflag);
uint8 table_cache_type() { return HA_CACHE_TBL_TRANSACT; }
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 6508216e3d6..dd4dd725be4 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -1096,7 +1096,7 @@ bool ha_federated::create_where_from_key(String *to,
KEY *key_info,
const key_range *start_key,
const key_range *end_key,
- bool records_in_range)
+ bool from_records_in_range)
{
bool both_not_null=
(start_key != NULL && end_key != NULL) ? TRUE : FALSE;
@@ -1164,7 +1164,7 @@ bool ha_federated::create_where_from_key(String *to,
if (emit_key_part_name(&tmp, key_part))
DBUG_RETURN(1);
- if (records_in_range)
+ if (from_records_in_range)
{
if (tmp.append(FEDERATED_GE))
DBUG_RETURN(1);
@@ -1383,7 +1383,7 @@ static int free_share(FEDERATED_SHARE *share)
ha_rows ha_federated::records_in_range(uint inx, key_range *start_key,
- key_range *end_key)
+ key_range *end_key)
{
/*
@@ -2072,7 +2072,7 @@ int ha_federated::index_init(uint keynr)
int ha_federated::read_range_first(const key_range *start_key,
const key_range *end_key,
- bool eq_range, bool sorted)
+ bool eq_range_arg, bool sorted)
{
char sql_query_buffer[FEDERATED_QUERY_BUFFER_SIZE];
int retval;
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index fe5e8b76ec9..d1a931b07f2 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -317,11 +317,11 @@ int ha_heap::rnd_next(byte *buf)
int ha_heap::rnd_pos(byte * buf, byte *pos)
{
int error;
- HEAP_PTR position;
+ HEAP_PTR heap_position;
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
- memcpy_fixed((char*) &position,pos,sizeof(HEAP_PTR));
- error=heap_rrnd(file, buf, position);
+ memcpy_fixed((char*) &heap_position, pos, sizeof(HEAP_PTR));
+ error=heap_rrnd(file, buf, heap_position);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
@@ -333,19 +333,19 @@ void ha_heap::position(const byte *record)
int ha_heap::info(uint flag)
{
- HEAPINFO info;
- (void) heap_info(file,&info,flag);
-
- records = info.records;
- deleted = info.deleted;
- errkey = info.errkey;
- mean_rec_length=info.reclength;
- data_file_length=info.data_length;
- index_file_length=info.index_length;
- max_data_file_length= info.max_records* info.reclength;
- delete_length= info.deleted * info.reclength;
+ HEAPINFO hp_info;
+ (void) heap_info(file,&hp_info,flag);
+
+ records= hp_info.records;
+ deleted= hp_info.deleted;
+ errkey= hp_info.errkey;
+ mean_rec_length= hp_info.reclength;
+ data_file_length= hp_info.data_length;
+ index_file_length= hp_info.index_length;
+ max_data_file_length= hp_info.max_records* hp_info.reclength;
+ delete_length= hp_info.deleted * hp_info.reclength;
if (flag & HA_STATUS_AUTO)
- auto_increment_value= info.auto_increment;
+ auto_increment_value= hp_info.auto_increment;
/*
If info() is called for the first time after open(), we will still
have to update the key statistics. Hoping that a table lock is now
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index d854c362df8..8a35ff000a8 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2711,7 +2711,8 @@ ha_innobase::store_key_val_for_row(
true_len = (ulint) cs->cset->well_formed_len(cs,
(const char *) data,
(const char *) data + len,
- key_len / cs->mbmaxlen,
+ (uint) (key_len /
+ cs->mbmaxlen),
&error);
}
@@ -2780,7 +2781,8 @@ ha_innobase::store_key_val_for_row(
(const char *) blob_data,
(const char *) blob_data
+ blob_len,
- key_len / cs->mbmaxlen,
+ (uint) (key_len /
+ cs->mbmaxlen),
&error);
}
@@ -2852,7 +2854,8 @@ ha_innobase::store_key_val_for_row(
(const char *)src_start,
(const char *)src_start
+ key_len,
- key_len / cs->mbmaxlen,
+ (uint) (key_len /
+ cs->mbmaxlen),
&error);
}
}
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 39f8894ae89..10d3dbb2ec5 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -342,6 +342,12 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
RETURN VALUE
0 - Equal definitions.
1 - Different definitions.
+
+ TODO
+ - compare FULLTEXT keys;
+ - compare SPATIAL keys;
+ - compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly
+ (should be corretly detected in table2myisam).
*/
int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
@@ -367,6 +373,28 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{
HA_KEYSEG *t1_keysegs= t1_keyinfo[i].seg;
HA_KEYSEG *t2_keysegs= t2_keyinfo[i].seg;
+ if (t1_keyinfo[i].flag & HA_FULLTEXT && t2_keyinfo[i].flag & HA_FULLTEXT)
+ continue;
+ else if (t1_keyinfo[i].flag & HA_FULLTEXT ||
+ t2_keyinfo[i].flag & HA_FULLTEXT)
+ {
+ DBUG_PRINT("error", ("Key %d has different definition", i));
+ DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d",
+ test(t1_keyinfo[i].flag & HA_FULLTEXT),
+ test(t2_keyinfo[i].flag & HA_FULLTEXT)));
+ DBUG_RETURN(1);
+ }
+ if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL)
+ continue;
+ else if (t1_keyinfo[i].flag & HA_SPATIAL ||
+ t2_keyinfo[i].flag & HA_SPATIAL)
+ {
+ DBUG_PRINT("error", ("Key %d has different definition", i));
+ DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d",
+ test(t1_keyinfo[i].flag & HA_SPATIAL),
+ test(t2_keyinfo[i].flag & HA_SPATIAL)));
+ DBUG_RETURN(1);
+ }
if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs ||
t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg)
{
@@ -403,7 +431,14 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{
MI_COLUMNDEF *t1_rec= &t1_recinfo[i];
MI_COLUMNDEF *t2_rec= &t2_recinfo[i];
- if (t1_rec->type != t2_rec->type ||
+ /*
+ FIELD_SKIP_ZERO can be changed to FIELD_NORMAL in mi_create,
+ see NOTE1 in mi_create.c
+ */
+ if ((t1_rec->type != t2_rec->type &&
+ !(t1_rec->type == (int) FIELD_SKIP_ZERO &&
+ t1_rec->length == 1 &&
+ t2_rec->type == (int) FIELD_NORMAL)) ||
t1_rec->length != t2_rec->length ||
t1_rec->null_bit != t2_rec->null_bit)
{
@@ -930,11 +965,11 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
}
-int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
+int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize)
{
int error=0;
uint local_testflag=param.testflag;
- bool optimize_done= !optimize, statistics_done=0;
+ bool optimize_done= !do_optimize, statistics_done=0;
const char *old_proc_info=thd->proc_info;
char fixed_name[FN_REFLEN];
MYISAM_SHARE* share = file->s;
@@ -958,7 +993,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
DBUG_RETURN(HA_ADMIN_FAILED);
}
- if (!optimize ||
+ if (!do_optimize ||
((file->state->del || share->state.split != file->state->records) &&
(!(param.testflag & T_QUICK) ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
@@ -1593,47 +1628,47 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos)
void ha_myisam::position(const byte* record)
{
- my_off_t position=mi_position(file);
- my_store_ptr(ref, ref_length, position);
+ my_off_t row_position= mi_position(file);
+ my_store_ptr(ref, ref_length, row_position);
}
int ha_myisam::info(uint flag)
{
- MI_ISAMINFO info;
+ MI_ISAMINFO misam_info;
char name_buff[FN_REFLEN];
- (void) mi_status(file,&info,flag);
+ (void) mi_status(file,&misam_info,flag);
if (flag & HA_STATUS_VARIABLE)
{
- records = info.records;
- deleted = info.deleted;
- data_file_length=info.data_file_length;
- index_file_length=info.index_file_length;
- delete_length = info.delete_length;
- check_time = info.check_time;
- mean_rec_length=info.mean_reclength;
+ records= misam_info.records;
+ deleted= misam_info.deleted;
+ data_file_length= misam_info.data_file_length;
+ index_file_length= misam_info.index_file_length;
+ delete_length= misam_info.delete_length;
+ check_time= misam_info.check_time;
+ mean_rec_length= misam_info.mean_reclength;
}
if (flag & HA_STATUS_CONST)
{
TABLE_SHARE *share= table->s;
- max_data_file_length= info.max_data_file_length;
- max_index_file_length= info.max_index_file_length;
- create_time= info.create_time;
- sortkey= info.sortkey;
- ref_length= info.reflength;
- share->db_options_in_use= info.options;
+ max_data_file_length= misam_info.max_data_file_length;
+ max_index_file_length= misam_info.max_index_file_length;
+ create_time= misam_info.create_time;
+ sortkey= misam_info.sortkey;
+ ref_length= misam_info.reflength;
+ share->db_options_in_use= misam_info.options;
block_size= myisam_block_size;
share->keys_in_use.set_prefix(share->keys);
- share->keys_in_use.intersect_extended(info.key_map);
+ share->keys_in_use.intersect_extended(misam_info.key_map);
share->keys_for_keyread.intersect(share->keys_in_use);
- share->db_record_offset= info.record_offset;
+ share->db_record_offset= misam_info.record_offset;
if (share->key_parts)
memcpy((char*) table->key_info[0].rec_per_key,
- (char*) info.rec_per_key,
+ (char*) misam_info.rec_per_key,
sizeof(table->key_info[0].rec_per_key)*share->key_parts);
- raid_type= info.raid_type;
- raid_chunks= info.raid_chunks;
- raid_chunksize= info.raid_chunksize;
+ raid_type= misam_info.raid_type;
+ raid_chunks= misam_info.raid_chunks;
+ raid_chunksize= misam_info.raid_chunksize;
/*
Set data_file_name and index_file_name to point at the symlink value
@@ -1641,21 +1676,21 @@ int ha_myisam::info(uint flag)
*/
data_file_name=index_file_name=0;
fn_format(name_buff, file->filename, "", MI_NAME_DEXT, 2);
- if (strcmp(name_buff, info.data_file_name))
- data_file_name=info.data_file_name;
+ if (strcmp(name_buff, misam_info.data_file_name))
+ data_file_name= misam_info.data_file_name;
strmov(fn_ext(name_buff),MI_NAME_IEXT);
- if (strcmp(name_buff, info.index_file_name))
- index_file_name=info.index_file_name;
+ if (strcmp(name_buff, misam_info.index_file_name))
+ index_file_name= misam_info.index_file_name;
}
if (flag & HA_STATUS_ERRKEY)
{
- errkey = info.errkey;
- my_store_ptr(dupp_ref, ref_length, info.dupp_key_pos);
+ errkey = misam_info.errkey;
+ my_store_ptr(dupp_ref, ref_length, misam_info.dupp_key_pos);
}
if (flag & HA_STATUS_TIME)
- update_time = info.update_time;
+ update_time = misam_info.update_time;
if (flag & HA_STATUS_AUTO)
- auto_increment_value= info.auto_increment;
+ auto_increment_value= misam_info.auto_increment;
return 0;
}
@@ -1725,7 +1760,7 @@ void ha_myisam::update_create_info(HA_CREATE_INFO *create_info)
int ha_myisam::create(const char *name, register TABLE *table_arg,
- HA_CREATE_INFO *info)
+ HA_CREATE_INFO *ha_create_info)
{
int error;
uint create_flags= 0, records;
@@ -1742,20 +1777,22 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
create_info.max_rows= share->max_rows;
create_info.reloc_rows= share->min_rows;
create_info.with_auto_increment= share->next_number_key_offset == 0;
- create_info.auto_increment= (info->auto_increment_value ?
- info->auto_increment_value -1 :
+ create_info.auto_increment= (ha_create_info->auto_increment_value ?
+ ha_create_info->auto_increment_value -1 :
(ulonglong) 0);
create_info.data_file_length= ((ulonglong) share->max_rows *
share->avg_row_length);
- create_info.raid_type= info->raid_type;
- create_info.raid_chunks= (info->raid_chunks ? info->raid_chunks :
+ create_info.raid_type= ha_create_info->raid_type;
+ create_info.raid_chunks= (ha_create_info->raid_chunks ?
+ ha_create_info->raid_chunks :
RAID_DEFAULT_CHUNKS);
- create_info.raid_chunksize= (info->raid_chunksize ? info->raid_chunksize :
+ create_info.raid_chunksize= (ha_create_info->raid_chunksize ?
+ ha_create_info->raid_chunksize :
RAID_DEFAULT_CHUNKSIZE);
- create_info.data_file_name= info->data_file_name;
- create_info.index_file_name= info->index_file_name;
+ create_info.data_file_name= ha_create_info->data_file_name;
+ create_info.index_file_name= ha_create_info->index_file_name;
- if (info->options & HA_LEX_CREATE_TMP_TABLE)
+ if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= HA_CREATE_TMP_TABLE;
if (options & HA_OPTION_PACK_RECORD)
create_flags|= HA_PACK_RECORD;
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index 8e24164abc9..1202a733a16 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -299,8 +299,8 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
void ha_myisammrg::position(const byte *record)
{
- ulonglong position= myrg_position(file);
- my_store_ptr(ref, ref_length, (my_off_t) position);
+ ulonglong row_position= myrg_position(file);
+ my_store_ptr(ref, ref_length, (my_off_t) row_position);
}
@@ -313,25 +313,25 @@ ha_rows ha_myisammrg::records_in_range(uint inx, key_range *min_key,
int ha_myisammrg::info(uint flag)
{
- MYMERGE_INFO info;
- (void) myrg_status(file,&info,flag);
+ MYMERGE_INFO mrg_info;
+ (void) myrg_status(file,&mrg_info,flag);
/*
The following fails if one has not compiled MySQL with -DBIG_TABLES
and one has more than 2^32 rows in the merge tables.
*/
- records = (ha_rows) info.records;
- deleted = (ha_rows) info.deleted;
+ records = (ha_rows) mrg_info.records;
+ deleted = (ha_rows) mrg_info.deleted;
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
- if ((info.records >= (ulonglong) 1 << 32) ||
- (info.deleted >= (ulonglong) 1 << 32))
+ if ((mrg_info.records >= (ulonglong) 1 << 32) ||
+ (mrg_info.deleted >= (ulonglong) 1 << 32))
table->s->crashed= 1;
#endif
- data_file_length=info.data_file_length;
- errkey = info.errkey;
+ data_file_length=mrg_info.data_file_length;
+ errkey = mrg_info.errkey;
table->s->keys_in_use.set_prefix(table->s->keys);
- table->s->db_options_in_use= info.options;
+ table->s->db_options_in_use= mrg_info.options;
table->s->is_view= 1;
- mean_rec_length= info.reclength;
+ mean_rec_length= mrg_info.reclength;
/*
The handler::block_size is used all over the code in index scan cost
@@ -361,7 +361,7 @@ int ha_myisammrg::info(uint flag)
#endif
if (flag & HA_STATUS_CONST)
{
- if (table->s->key_parts && info.rec_per_key)
+ if (table->s->key_parts && mrg_info.rec_per_key)
{
#ifdef HAVE_purify
/*
@@ -374,7 +374,7 @@ int ha_myisammrg::info(uint flag)
sizeof(table->key_info[0].rec_per_key) * table->s->key_parts);
#endif
memcpy((char*) table->key_info[0].rec_per_key,
- (char*) info.rec_per_key,
+ (char*) mrg_info.rec_per_key,
sizeof(table->key_info[0].rec_per_key) *
min(file->keys, table->s->key_parts));
}
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index e546dfee699..16c734e2682 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -36,8 +36,7 @@ class ha_myisammrg: public handler
{
return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME |
HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED |
- HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE |
- HA_CAN_BIT_FIELD);
+ HA_ANY_INDEX_MAY_BE_UNIQUE | HA_CAN_BIT_FIELD);
}
ulong index_flags(uint inx, uint part, bool all_parts) const
{
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 4f753ccea79..7a9c7d0d021 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -361,11 +361,11 @@ int ha_ndbcluster::records_update()
DBUG_ENTER("ha_ndbcluster::records_update");
int result= 0;
- struct Ndb_local_table_statistics *info=
+ struct Ndb_local_table_statistics *local_info=
(struct Ndb_local_table_statistics *)m_table_info;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
- info->no_uncommitted_rows_count));
+ local_info->no_uncommitted_rows_count));
// if (info->records == ~(ha_rows)0)
{
Ndb *ndb= get_ndb();
@@ -376,16 +376,16 @@ int ha_ndbcluster::records_update()
{
mean_rec_length= stat.row_size;
data_file_length= stat.fragment_memory;
- info->records= stat.row_count;
+ local_info->records= stat.row_count;
}
}
{
THD *thd= current_thd;
if (get_thd_ndb(thd)->error)
- info->no_uncommitted_rows_count= 0;
+ local_info->no_uncommitted_rows_count= 0;
}
if(result==0)
- records= info->records+ info->no_uncommitted_rows_count;
+ records= local_info->records+ local_info->no_uncommitted_rows_count;
DBUG_RETURN(result);
}
@@ -403,17 +403,17 @@ void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
if (m_ha_not_exact_count)
return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init");
- struct Ndb_local_table_statistics *info=
+ struct Ndb_local_table_statistics *local_info=
(struct Ndb_local_table_statistics *)m_table_info;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
- if (info->last_count != thd_ndb->count)
+ if (local_info->last_count != thd_ndb->count)
{
- info->last_count= thd_ndb->count;
- info->no_uncommitted_rows_count= 0;
- info->records= ~(ha_rows)0;
+ local_info->last_count= thd_ndb->count;
+ local_info->no_uncommitted_rows_count= 0;
+ local_info->records= ~(ha_rows)0;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
- info->no_uncommitted_rows_count));
+ local_info->no_uncommitted_rows_count));
}
DBUG_VOID_RETURN;
}
@@ -423,12 +423,12 @@ void ha_ndbcluster::no_uncommitted_rows_update(int c)
if (m_ha_not_exact_count)
return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_update");
- struct Ndb_local_table_statistics *info=
+ struct Ndb_local_table_statistics *local_info=
(struct Ndb_local_table_statistics *)m_table_info;
- info->no_uncommitted_rows_count+= c;
+ local_info->no_uncommitted_rows_count+= c;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
- info->no_uncommitted_rows_count));
+ local_info->no_uncommitted_rows_count));
DBUG_VOID_RETURN;
}
@@ -1736,7 +1736,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
{
DBUG_ENTER("fetch_next");
- int check;
+ int local_check;
NdbTransaction *trans= m_active_trans;
if (m_lock_tuple)
@@ -1747,15 +1747,17 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
LOCK WITH SHARE MODE) and row was not explictly unlocked
with unlock_row() call
*/
- NdbConnection *trans= m_active_trans;
+ NdbConnection *con_trans= m_active_trans;
NdbOperation *op;
// Lock row
DBUG_PRINT("info", ("Keeping lock on scanned row"));
if (!(op= m_active_cursor->lockCurrentTuple()))
{
+ /* purecov: begin inspected */
m_lock_tuple= false;
- ERR_RETURN(trans->getNdbError());
+ ERR_RETURN(con_trans->getNdbError());
+ /* purecov: end */
}
m_ops_pending++;
}
@@ -1776,7 +1778,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
m_blobs_pending= FALSE;
}
- if ((check= cursor->nextResult(contact_ndb, m_force_send)) == 0)
+ if ((local_check= cursor->nextResult(contact_ndb, m_force_send)) == 0)
{
/*
Explicitly lock tuple if "select for update" or
@@ -1787,7 +1789,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
m_lock.type == TL_READ_WITH_SHARED_LOCKS);
DBUG_RETURN(0);
}
- else if (check == 1 || check == 2)
+ else if (local_check == 1 || local_check == 2)
{
// 1: No more records
// 2: No more cached records
@@ -1817,13 +1819,13 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
}
m_ops_pending= 0;
}
- contact_ndb= (check == 2);
+ contact_ndb= (local_check == 2);
}
else
{
DBUG_RETURN(-1);
}
- } while (check == 2);
+ } while (local_check == 2);
DBUG_RETURN(1);
}
@@ -2189,8 +2191,7 @@ int ha_ndbcluster::write_row(byte *record)
NdbTransaction *trans= m_active_trans;
NdbOperation *op;
int res;
- THD *thd= current_thd;
-
+ THD *thd= table->in_use;
DBUG_ENTER("write_row");
has_auto_increment= (table->next_number_field && record == table->record[0]);
@@ -2201,7 +2202,6 @@ int ha_ndbcluster::write_row(byte *record)
*/
if (has_auto_increment)
{
- THD *thd= table->in_use;
int error;
m_skip_auto_increment= FALSE;
@@ -2263,8 +2263,6 @@ int ha_ndbcluster::write_row(byte *record)
}
else
{
- int res;
-
if ((res= set_primary_key_from_record(op, record)))
return res;
}
@@ -2333,10 +2331,12 @@ int ha_ndbcluster::write_row(byte *record)
{
Ndb *ndb= get_ndb();
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
+#ifndef DBUG_OFF
char buff[22];
DBUG_PRINT("info",
("Trying to set next auto increment value to %s",
llstr(next_val, buff)));
+#endif
if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE)
== -1)
ERR_RETURN(ndb->getNdbError());
@@ -2702,8 +2702,6 @@ void ha_ndbcluster::print_results()
DBUG_ENTER("print_results");
#ifndef DBUG_OFF
- const NDBTAB *tab= (const NDBTAB*) m_table;
-
if (!_db_on_)
DBUG_VOID_RETURN;
@@ -3243,7 +3241,7 @@ int ha_ndbcluster::info(uint flag)
if (flag & HA_STATUS_AUTO)
{
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
- if (m_table)
+ if (m_table && table->found_next_number_field)
{
Ndb *ndb= get_ndb();
@@ -3494,7 +3492,7 @@ int ha_ndbcluster::end_bulk_insert()
}
else
{
- int res= trans->restart();
+ IF_DBUG(int res=) trans->restart();
DBUG_ASSERT(res == 0);
}
}
@@ -4261,7 +4259,9 @@ static int create_ndb_column(NDBCOL &col,
// Set autoincrement
if (field->flags & AUTO_INCREMENT_FLAG)
{
+#ifndef DBUG_OFF
char buff[22];
+#endif
col.setAutoIncrement(TRUE);
ulonglong value= info->auto_increment_value ?
info->auto_increment_value : (ulonglong) 1;
@@ -4335,14 +4335,14 @@ static void ndb_set_fragmentation(NDBTAB &tab, TABLE *form, uint pk_length)
int ha_ndbcluster::create(const char *name,
TABLE *form,
- HA_CREATE_INFO *info)
+ HA_CREATE_INFO *create_info)
{
NDBTAB tab;
NDBCOL col;
uint pack_length, length, i, pk_length= 0;
const void *data, *pack_data;
char name2[FN_HEADLEN];
- bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
+ bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
DBUG_ENTER("ha_ndbcluster::create");
DBUG_PRINT("enter", ("name: %s", name));
@@ -4369,7 +4369,7 @@ int ha_ndbcluster::create(const char *name,
DBUG_PRINT("table", ("name: %s", m_tabname));
tab.setName(m_tabname);
- tab.setLogging(!(info->options & HA_LEX_CREATE_TMP_TABLE));
+ tab.setLogging(!(create_info->options & HA_LEX_CREATE_TMP_TABLE));
// Save frm data for this table
if (readfrm(name, &data, &length))
@@ -4388,7 +4388,7 @@ int ha_ndbcluster::create(const char *name,
DBUG_PRINT("info", ("name: %s, type: %u, pack_length: %d",
field->field_name, field->real_type(),
field->pack_length()));
- if ((my_errno= create_ndb_column(col, field, info)))
+ if ((my_errno= create_ndb_column(col, field, create_info)))
DBUG_RETURN(my_errno);
tab.addColumn(col);
if (col.getPrimaryKey())
@@ -4423,13 +4423,13 @@ int ha_ndbcluster::create(const char *name,
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
{
- NdbDictionary::Column * col= tab.getColumn(i);
- int size= pk_length + (col->getPartSize()+3)/4 + 7;
+ NdbDictionary::Column * column= tab.getColumn(i);
+ int size= pk_length + (column->getPartSize()+3)/4 + 7;
if (size > NDB_MAX_TUPLE_SIZE_IN_WORDS &&
(pk_length+7) < NDB_MAX_TUPLE_SIZE_IN_WORDS)
{
size= NDB_MAX_TUPLE_SIZE_IN_WORDS - pk_length - 7;
- col->setPartSize(4*size);
+ column->setPartSize(4*size);
}
/**
* If size > NDB_MAX and pk_length+7 >= NDB_MAX
@@ -5684,7 +5684,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
if (share->commit_count != 0)
{
*commit_count= share->commit_count;
+#ifndef DBUG_OFF
char buff[22];
+#endif
DBUG_PRINT("info", ("Getting commit_count: %s from share",
llstr(share->commit_count, buff)));
pthread_mutex_unlock(&share->mutex);
@@ -5710,7 +5712,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
pthread_mutex_lock(&share->mutex);
if (share->commit_count_lock == lock)
{
+#ifndef DBUG_OFF
char buff[22];
+#endif
DBUG_PRINT("info", ("Setting commit_count to %s",
llstr(stat.commit_count, buff)));
share->commit_count= stat.commit_count;
@@ -5766,7 +5770,9 @@ ndbcluster_cache_retrieval_allowed(THD *thd,
bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
char *dbname= full_name;
char *tabname= dbname+strlen(dbname)+1;
+#ifndef DBUG_OFF
char buff[22], buff2[22];
+#endif
DBUG_ENTER("ndbcluster_cache_retrieval_allowed");
DBUG_PRINT("enter", ("dbname: %s, tabname: %s, is_autocommit: %d",
dbname, tabname, is_autocommit));
@@ -5833,7 +5839,9 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
ulonglong *engine_data)
{
Uint64 commit_count;
+#ifndef DBUG_OFF
char buff[22];
+#endif
bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
DBUG_ENTER("ha_ndbcluster::register_query_cache_table");
DBUG_PRINT("enter",("dbname: %s, tabname: %s, is_autocommit: %d",
@@ -6040,7 +6048,9 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb,
int retries= 10;
int reterr= 0;
int retry_sleep= 30 * 1000; /* 30 milliseconds */
+#ifndef DBUG_OFF
char buff[22], buff2[22], buff3[22], buff4[22];
+#endif
DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", table));
@@ -6054,7 +6064,6 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb,
Uint64 sum_row_size= 0;
Uint64 sum_mem= 0;
NdbScanOperation*pOp;
- NdbResultSet *rs;
int check;
if ((pTrans= ndb->startTransaction()) == NULL)
@@ -6243,20 +6252,19 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
bool sorted,
HANDLER_BUFFER *buffer)
{
- DBUG_ENTER("ha_ndbcluster::read_multi_range_first");
-
int res;
KEY* key_info= table->key_info + active_index;
- NDB_INDEX_TYPE index_type= get_index_type(active_index);
+ NDB_INDEX_TYPE cur_index_type= get_index_type(active_index);
ulong reclength= table->s->reclength;
NdbOperation* op;
Thd_ndb *thd_ndb= get_thd_ndb(current_thd);
+ DBUG_ENTER("ha_ndbcluster::read_multi_range_first");
/**
* blobs and unique hash index with NULL can't be batched currently
*/
if (uses_blob_value(m_retrieve_all_fields) ||
- (index_type == UNIQUE_INDEX &&
+ (cur_index_type == UNIQUE_INDEX &&
has_null_in_unique_index(active_index) &&
null_value_index_search(ranges, ranges+range_count, buffer)))
{
@@ -6308,7 +6316,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
for (; multi_range_curr<multi_range_end && curr+reclength <= end_of_buffer;
multi_range_curr++)
{
- switch (index_type){
+ switch (cur_index_type) {
case PRIMARY_KEY_ORDERED_INDEX:
if (!(multi_range_curr->start_key.length == key_info->key_length &&
multi_range_curr->start_key.flag == HA_READ_KEY_EXACT))
@@ -6666,6 +6674,9 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
for (;;)
{
+ if (abort_loop)
+ break; /* Shutting down server */
+
pthread_mutex_lock(&LOCK_ndb_util_thread);
pthread_cond_timedwait(&COND_ndb_util_thread,
&LOCK_ndb_util_thread,
@@ -6728,7 +6739,9 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
if (ndb_get_table_statistics(NULL, false, ndb, tabname, &stat) == 0)
{
+#ifndef DBUG_OFF
char buff[22], buff2[22];
+#endif
DBUG_PRINT("ndb_util_thread",
("Table: %s commit_count: %s rows: %s",
share->table_name,
@@ -6896,14 +6909,14 @@ void ndb_serialize_cond(const Item *item, void *arg)
if (context->supported)
{
- Ndb_rewrite_context *rewrite_context= context->rewrite_stack;
- const Item_func *func_item;
+ Ndb_rewrite_context *rewrite_context2= context->rewrite_stack;
+ const Item_func *rewrite_func_item;
// Check if we are rewriting some unsupported function call
- if (rewrite_context &&
- (func_item= rewrite_context->func_item) &&
- rewrite_context->count++ == 0)
+ if (rewrite_context2 &&
+ (rewrite_func_item= rewrite_context2->func_item) &&
+ rewrite_context2->count++ == 0)
{
- switch (func_item->functype()) {
+ switch (rewrite_func_item->functype()) {
case Item_func::BETWEEN:
/*
Rewrite
@@ -6930,7 +6943,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
if (context->expecting(item->type()))
{
// This is the <field>|<const> item, save it in the rewrite context
- rewrite_context->left_hand_item= item;
+ rewrite_context2->left_hand_item= item;
if (item->type() == Item::FUNC_ITEM)
{
Item_func *func_item= (Item_func *) item;
@@ -7568,8 +7581,8 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT("info", ("INT_ITEM"));
if (context->expecting(Item::INT_ITEM))
{
- Item_int *int_item= (Item_int *) item;
- DBUG_PRINT("info", ("value %ld", (long) int_item->value));
+ DBUG_PRINT("info", ("value %ld",
+ (long) ((Item_int*) item)->value));
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::INT_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
@@ -7595,8 +7608,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT("info", ("REAL_ITEM"));
if (context->expecting(Item::REAL_ITEM))
{
- Item_float *float_item= (Item_float *) item;
- DBUG_PRINT("info", ("value %f", float_item->value));
+ DBUG_PRINT("info", ("value %f", ((Item_float *) item)->value));
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::REAL_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
@@ -7643,8 +7655,8 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT("info", ("DECIMAL_ITEM"));
if (context->expecting(Item::DECIMAL_ITEM))
{
- Item_decimal *decimal_item= (Item_decimal *) item;
- DBUG_PRINT("info", ("value %f", decimal_item->val_real()));
+ DBUG_PRINT("info", ("value %f",
+ ((Item_decimal*) item)->val_real()));
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::DECIMAL_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
@@ -7981,6 +7993,7 @@ ha_ndbcluster::build_scan_filter_predicate(Ndb_cond * &cond,
DBUG_RETURN(1);
}
+
int
ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter)
{
@@ -8054,6 +8067,7 @@ ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter)
DBUG_RETURN(0);
}
+
int
ha_ndbcluster::build_scan_filter(Ndb_cond * &cond, NdbScanFilter *filter)
{
@@ -8104,14 +8118,14 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack,
DBUG_RETURN(0);
}
+
int
ha_ndbcluster::generate_scan_filter_from_cond(Ndb_cond_stack *ndb_cond_stack,
NdbScanFilter& filter)
{
- DBUG_ENTER("generate_scan_filter_from_cond");
bool multiple_cond= FALSE;
-
- DBUG_PRINT("info", ("Generating scan filter"));
+ DBUG_ENTER("generate_scan_filter_from_cond");
+
// Wrap an AND group around multiple conditions
if (ndb_cond_stack->next)
{
@@ -8137,6 +8151,7 @@ ha_ndbcluster::generate_scan_filter_from_cond(Ndb_cond_stack *ndb_cond_stack,
DBUG_RETURN(0);
}
+
int ha_ndbcluster::generate_scan_filter_from_key(NdbScanOperation *op,
const KEY* key_info,
const byte *key,
@@ -8147,15 +8162,14 @@ int ha_ndbcluster::generate_scan_filter_from_key(NdbScanOperation *op,
KEY_PART_INFO* end= key_part+key_info->key_parts;
NdbScanFilter filter(op);
int res;
-
DBUG_ENTER("generate_scan_filter_from_key");
+
filter.begin(NdbScanFilter::AND);
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
uint32 pack_len= field->pack_length();
const byte* ptr= key;
- char buf[256];
DBUG_PRINT("info", ("Filtering value for %s", field->field_name));
DBUG_DUMP("key", (char*)ptr, pack_len);
if (key_part->null_bit)
@@ -8190,7 +8204,6 @@ int
ndbcluster_show_status(THD* thd)
{
Protocol *protocol= thd->protocol;
-
DBUG_ENTER("ndbcluster_show_status");
if (have_ndbcluster != SHOW_OPTION_YES)
diff --git a/sql/handler.cc b/sql/handler.cc
index c836c949f3a..5a27e470d70 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -121,11 +121,6 @@ handlerton isam_hton = { "ISAM", SHOW_OPTION_NO, "Obsolete storage engine",
DB_TYPE_ISAM, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, HTON_NO_FLAGS };
-
-/* static functions defined in this file */
-
-static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
-
/* number of entries in handlertons[] */
ulong total_ha;
/* number of storage engines (from handlertons[]) that support 2pc */
@@ -713,7 +708,7 @@ int ha_commit_trans(THD *thd, bool all)
}
DBUG_EXECUTE_IF("crash_commit_after_prepare", abort(););
if (error || (is_real_trans && xid &&
- (error= !(cookie= tc_log->log(thd, xid)))))
+ (error= !(cookie= tc_log->log_xid(thd, xid)))))
{
ha_rollback_trans(thd, all);
error= 1;
@@ -721,7 +716,7 @@ int ha_commit_trans(THD *thd, bool all)
}
DBUG_EXECUTE_IF("crash_commit_after_log", abort(););
}
- error=ha_commit_one_phase(thd, all) ? cookie ? 2 : 1 : 0;
+ error=ha_commit_one_phase(thd, all) ? (cookie ? 2 : 1) : 0;
DBUG_EXECUTE_IF("crash_commit_before_unlog", abort(););
if (cookie)
tc_log->unlog(cookie, xid);
diff --git a/sql/item.cc b/sql/item.cc
index a57f3c0fa96..11a5039ca19 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -25,10 +25,6 @@
#include "sql_trigger.h"
#include "sql_select.h"
-static void mark_as_dependent(THD *thd,
- SELECT_LEX *last, SELECT_LEX *current,
- Item_ident *item);
-
const String my_null_string("NULL", 4, default_charset_info);
/****************************************************************************/
@@ -1525,6 +1521,8 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
doesn't display each argument's characteristics.
- if nargs is 1, then this error cannot happen.
*/
+ LINT_INIT(safe_args[0]);
+ LINT_INIT(safe_args[1]);
if (nargs >=2 && nargs <= 3)
{
safe_args[0]= args[0];
@@ -1664,7 +1662,10 @@ Item_field::Item_field(Name_resolution_context *context_arg,
field(0), result_field(0), item_equal(0), no_const_subst(0),
have_privileges(0), any_privileges(0), fixed_as_field(0)
{
+ SELECT_LEX *select= current_thd->lex->current_select;
collation.set(DERIVATION_IMPLICIT);
+ if (select && select->parsing_place != IN_HAVING)
+ select->select_n_where_fields++;
}
// Constructor need to process subselect with temporary tables (see Item)
@@ -1686,7 +1687,7 @@ void Item_field::set_field(Field *field_par)
field=result_field=field_par; // for easy coding with fields
maybe_null=field->maybe_null();
decimals= field->decimals();
- max_length= field_par->max_length();
+ max_length= field_par->max_display_length();
table_name= *field_par->table_name;
field_name= field_par->field_name;
db_name= field_par->table->s->db;
@@ -1757,9 +1758,10 @@ void Item_ident::print(String *str)
}
}
- if (!table_name || !field_name)
+ if (!table_name || !field_name || !field_name[0])
{
- const char *nm= field_name ? field_name : name ? name : "tmp_field";
+ const char *nm= (field_name && field_name[0]) ?
+ field_name : name ? name : "tmp_field";
append_identifier(thd, str, nm, (uint) strlen(nm));
return;
}
@@ -2395,21 +2397,22 @@ void Item_param::set_decimal(const char *str, ulong length)
the fact that even wrong value sent over binary protocol fits into
MAX_DATE_STRING_REP_LENGTH buffer.
*/
-void Item_param::set_time(TIME *tm, timestamp_type type, uint32 max_length_arg)
+void Item_param::set_time(TIME *tm, timestamp_type time_type,
+ uint32 max_length_arg)
{
DBUG_ENTER("Item_param::set_time");
value.time= *tm;
- value.time.time_type= type;
+ value.time.time_type= time_type;
if (value.time.year > 9999 || value.time.month > 12 ||
value.time.day > 31 ||
- type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
+ time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
value.time.minute > 59 || value.time.second > 59)
{
char buff[MAX_DATE_STRING_REP_LENGTH];
uint length= my_TIME_to_str(&value.time, buff);
- make_truncated_value_warning(current_thd, buff, length, type, 0);
+ make_truncated_value_warning(current_thd, buff, length, time_type, 0);
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
}
@@ -2874,7 +2877,7 @@ bool Item_param::basic_const_item() const
Item *
-Item_param::new_item()
+Item_param::clone_item()
{
/* see comments in the header file */
switch (state) {
@@ -3318,7 +3321,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
ORDER *group_list= (ORDER*) select->group_list.first;
bool ambiguous_fields= FALSE;
uint counter;
- bool not_used;
+ enum_resolution_type resolution;
/*
Search for a column or derived column named as 'ref' in the SELECT
@@ -3326,8 +3329,10 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
*/
if (!(select_ref= find_item_in_list(ref, *(select->get_item_list()),
&counter, REPORT_EXCEPT_NOT_FOUND,
- &not_used)))
+ &resolution)))
return NULL; /* Some error occurred. */
+ if (resolution == RESOLVED_AGAINST_ALIAS)
+ ref->alias_name_used= TRUE;
/* If this is a non-aggregated field inside HAVING, search in GROUP BY. */
if (select->having_fix_field && !ref->with_sum_func && group_list)
@@ -3437,7 +3442,12 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
*/
Name_resolution_context *last_checked_context= context;
Item **ref= (Item **) not_found_item;
- Name_resolution_context *outer_context= context->outer_context;
+ SELECT_LEX *current_sel= (SELECT_LEX *) thd->lex->current_select;
+ Name_resolution_context *outer_context= 0;
+ /* Currently derived tables cannot be correlated */
+ if (current_sel->master_unit()->first_select()->linkage !=
+ DERIVED_TABLE_TYPE)
+ outer_context= context->outer_context;
for (;
outer_context;
outer_context= outer_context->outer_context)
@@ -3529,28 +3539,29 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
thd->lex->in_sum_func->nest_level ==
thd->lex->current_select->nest_level)
{
- Item::Type type= (*reference)->type();
+ Item::Type ref_type= (*reference)->type();
set_if_bigger(thd->lex->in_sum_func->max_arg_level,
select->nest_level);
set_field(*from_field);
fixed= 1;
mark_as_dependent(thd, last_checked_context->select_lex,
context->select_lex, this,
- ((type == REF_ITEM || type == FIELD_ITEM) ?
+ ((ref_type == REF_ITEM ||
+ ref_type == FIELD_ITEM) ?
(Item_ident*) (*reference) : 0));
return 0;
}
}
else
{
- Item::Type type= (*reference)->type();
+ Item::Type ref_type= (*reference)->type();
prev_subselect_item->used_tables_cache|=
(*reference)->used_tables();
prev_subselect_item->const_item_cache&=
(*reference)->const_item();
mark_as_dependent(thd, last_checked_context->select_lex,
context->select_lex, this,
- ((type == REF_ITEM || type == FIELD_ITEM) ?
+ ((ref_type == REF_ITEM || ref_type == FIELD_ITEM) ?
(Item_ident*) (*reference) :
0));
/*
@@ -3627,9 +3638,9 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
*ref= NULL; // Don't call set_properties()
rf= (place == IN_HAVING ?
new Item_ref(context, ref, (char*) table_name,
- (char*) field_name) :
+ (char*) field_name, alias_name_used) :
new Item_direct_ref(context, ref, (char*) table_name,
- (char*) field_name));
+ (char*) field_name, alias_name_used));
*ref= save;
if (!rf)
return -1;
@@ -3747,12 +3758,14 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
if (thd->lex->current_select->is_item_list_lookup)
{
uint counter;
- bool not_used;
+ enum_resolution_type resolution;
Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
&counter, REPORT_EXCEPT_NOT_FOUND,
- &not_used);
+ &resolution);
if (!res)
return 1;
+ if (resolution == RESOLVED_AGAINST_ALIAS)
+ alias_name_used= TRUE;
if (res != (Item **)not_found_item)
{
if ((*res)->type() == Item::FIELD_ITEM)
@@ -3763,7 +3776,18 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
use the field from the Item_field in the select list and leave
the Item_field instance in place.
*/
- set_field((*((Item_field**)res))->field);
+
+ Field *field= (*((Item_field**)res))->field;
+
+ if (field == NULL)
+ {
+ /* The column to which we link isn't valid. */
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
+ current_thd->where);
+ return(1);
+ }
+
+ set_field(field);
return 0;
}
else
@@ -4051,7 +4075,9 @@ bool Item_field::set_no_const_sub(byte *arg)
DESCRIPTION
The function returns a pointer to an item that is taken from
the very beginning of the item_equal list which the Item_field
- object refers to (belongs to).
+ object refers to (belongs to) unless item_equal contains a constant
+ item. In this case the function returns this constant item,
+ (if the substitution does not require conversion).
If the Item_field object does not refer any Item_equal object
'this' is returned
@@ -4060,7 +4086,8 @@ bool Item_field::set_no_const_sub(byte *arg)
of the thransformer method.
RETURN VALUES
- pointer to a replacement Item_field if there is a better equal item;
+ pointer to a replacement Item_field if there is a better equal item or
+ a pointer to a constant equal item;
this - otherwise.
*/
@@ -4068,6 +4095,14 @@ Item *Item_field::replace_equal_field(byte *arg)
{
if (item_equal)
{
+ Item *const_item= item_equal->get_const();
+ if (const_item)
+ {
+ if (cmp_context != (Item_result)-1 &&
+ const_item->cmp_context != cmp_context)
+ return this;
+ return const_item;
+ }
Item_field *subst= item_equal->get_first();
if (subst && !field->eq(subst->field))
return subst;
@@ -4077,7 +4112,7 @@ Item *Item_field::replace_equal_field(byte *arg)
void Item::init_make_field(Send_field *tmp_field,
- enum enum_field_types field_type)
+ enum enum_field_types field_type_arg)
{
char *empty_name= (char*) "";
tmp_field->db_name= empty_name;
@@ -4089,7 +4124,7 @@ void Item::init_make_field(Send_field *tmp_field,
tmp_field->flags= (maybe_null ? 0 : NOT_NULL_FLAG) |
(my_binary_compare(collation.collation) ?
BINARY_FLAG : 0);
- tmp_field->type=field_type;
+ tmp_field->type= field_type_arg;
tmp_field->length=max_length;
tmp_field->decimals=decimals;
if (unsigned_flag)
@@ -4104,12 +4139,12 @@ void Item::make_field(Send_field *tmp_field)
void Item_empty_string::make_field(Send_field *tmp_field)
{
- enum_field_types type= FIELD_TYPE_VAR_STRING;
+ enum_field_types f_type= FIELD_TYPE_VAR_STRING;
if (max_length >= 16777216)
- type= FIELD_TYPE_LONG_BLOB;
+ f_type= FIELD_TYPE_LONG_BLOB;
else if (max_length >= 65536)
- type= FIELD_TYPE_MEDIUM_BLOB;
- init_make_field(tmp_field, type);
+ f_type= FIELD_TYPE_MEDIUM_BLOB;
+ init_make_field(tmp_field, f_type);
}
@@ -4444,7 +4479,7 @@ bool Item_int::eq(const Item *arg, bool binary_cmp) const
}
-Item *Item_int_with_ref::new_item()
+Item *Item_int_with_ref::clone_item()
{
DBUG_ASSERT(ref->const_item());
/*
@@ -4722,10 +4757,10 @@ bool Item_null::send(Protocol *protocol, String *packet)
bool Item::send(Protocol *protocol, String *buffer)
{
bool result;
- enum_field_types type;
+ enum_field_types f_type;
LINT_INIT(result); // Will be set if null_value == 0
- switch ((type=field_type())) {
+ switch ((f_type=field_type())) {
default:
case MYSQL_TYPE_NULL:
case MYSQL_TYPE_DECIMAL:
@@ -4804,7 +4839,7 @@ bool Item::send(Protocol *protocol, String *buffer)
get_date(&tm, TIME_FUZZY_DATE);
if (!null_value)
{
- if (type == MYSQL_TYPE_DATE)
+ if (f_type == MYSQL_TYPE_DATE)
return protocol->store_date(&tm);
else
result= protocol->store(&tm);
@@ -4893,12 +4928,30 @@ Item *Item_field::update_value_transformer(byte *select_arg)
}
+void Item_field::print(String *str)
+{
+ if (field && field->table->const_table)
+ {
+ char buff[MAX_FIELD_WIDTH];
+ String tmp(buff,sizeof(buff),str->charset());
+ field->val_str(&tmp);
+ str->append('\'');
+ str->append(tmp);
+ str->append('\'');
+ return;
+ }
+ Item_ident::print(str);
+}
+
+
Item_ref::Item_ref(Name_resolution_context *context_arg,
Item **item, const char *table_name_arg,
- const char *field_name_arg)
+ const char *field_name_arg,
+ bool alias_name_used_arg)
:Item_ident(context_arg, NullS, table_name_arg, field_name_arg),
result_field(0), ref(item)
{
+ alias_name_used= alias_name_used_arg;
/*
This constructor used to create some internals references over fixed items
*/
@@ -5061,7 +5114,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
goto error;
if (from_field == view_ref_found)
{
- Item::Type type= (*reference)->type();
+ Item::Type refer_type= (*reference)->type();
prev_subselect_item->used_tables_cache|=
(*reference)->used_tables();
prev_subselect_item->const_item_cache&=
@@ -5069,7 +5122,8 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
DBUG_ASSERT((*reference)->type() == REF_ITEM);
mark_as_dependent(thd, last_checked_context->select_lex,
context->select_lex, this,
- ((type == REF_ITEM || type == FIELD_ITEM) ?
+ ((refer_type == REF_ITEM ||
+ refer_type == FIELD_ITEM) ?
(Item_ident*) (*reference) :
0));
/*
@@ -5180,11 +5234,13 @@ void Item_ref::set_properties()
*/
with_sum_func= (*ref)->with_sum_func;
unsigned_flag= (*ref)->unsigned_flag;
+ fixed= 1;
+ if (alias_name_used)
+ return;
if ((*ref)->type() == FIELD_ITEM)
alias_name_used= ((Item_ident *) (*ref))->alias_name_used;
else
alias_name_used= TRUE; // it is not field, so it is was resolved by alias
- fixed= 1;
}
@@ -5202,7 +5258,7 @@ void Item_ref::print(String *str)
if (ref)
{
if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF &&
- ref_type() != OUTER_REF && name && alias_name_used)
+ !table_name && name && alias_name_used)
{
THD *thd= current_thd;
append_identifier(thd, str, name, (uint) strlen(name));
@@ -5494,6 +5550,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
if (!outer_field->fixed &&
(outer_field->fix_fields(thd, reference)))
return TRUE;
+ table_name= outer_field->table_name;
return Item_direct_ref::fix_fields(thd, reference);
}
@@ -5827,8 +5884,9 @@ bool Item_trigger_field::fix_fields(THD *thd, Item **items)
{
table_grants->want_privilege= want_privilege;
- if (check_grant_column(thd, table_grants, triggers->table->s->db,
- triggers->table->s->table_name, field_name,
+ if (check_grant_column(thd, table_grants, triggers->trigger_table->s->db,
+ triggers->trigger_table->s->table_name,
+ field_name,
strlen(field_name), thd->security_ctx))
return TRUE;
}
@@ -5946,7 +6004,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
DBUG_ASSERT(item_row->cols() == comp_item_row->cols());
col= item_row->cols();
while (col-- > 0)
- resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col));
+ resolve_const_item(thd, item_row->addr(col),
+ comp_item_row->element_index(col));
break;
}
/* Fallthrough */
@@ -6214,7 +6273,7 @@ bool Item_cache_row::setup(Item * item)
return 1;
for (uint i= 0; i < item_count; i++)
{
- Item *el= item->el(i);
+ Item *el= item->element_index(i);
Item_cache *tmp;
if (!(tmp= values[i]= Item_cache::get_cache(el->result_type())))
return 1;
@@ -6230,7 +6289,7 @@ void Item_cache_row::store(Item * item)
item->bring_value();
for (uint i= 0; i < item_count; i++)
{
- values[i]->store(item->el(i));
+ values[i]->store(item->element_index(i));
null_value|= values[i]->null_value;
}
}
diff --git a/sql/item.h b/sql/item.h
index ec6d4fabae5..c2084fb727c 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -651,7 +651,7 @@ public:
*/
virtual bool basic_const_item() const { return 0; }
/* cloning of constant items (0 if it is not const) */
- virtual Item *new_item() { return 0; }
+ virtual Item *clone_item() { return 0; }
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
@@ -782,7 +782,7 @@ public:
virtual bool collect_item_field_processor(byte * arg) { return 0; }
virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
virtual bool change_context_processor(byte *context) { return 0; }
- virtual bool reset_query_id_processor(byte *query_id) { return 0; }
+ virtual bool reset_query_id_processor(byte *query_id_arg) { return 0; }
virtual bool is_expensive_processor(byte *arg) { return 0; }
virtual bool subst_argument_checker(byte **arg)
{
@@ -806,11 +806,11 @@ public:
For SP local variable returns address of pointer to Item representing its
current value and pointer passed via parameter otherwise.
*/
- virtual Item **this_item_addr(THD *thd, Item **addr) { return addr; }
+ virtual Item **this_item_addr(THD *thd, Item **addr_arg) { return addr_arg; }
// Row emulation
virtual uint cols() { return 1; }
- virtual Item* el(uint i) { return this; }
+ virtual Item* element_index(uint i) { return this; }
virtual Item** addr(uint i) { return 0; }
virtual bool check_cols(uint c);
// It is not row => null inside is impossible
@@ -1077,7 +1077,8 @@ class Item_name_const : public Item
Item *value_item;
Item *name_item;
public:
- Item_name_const(Item *name, Item *val): value_item(val), name_item(name)
+ Item_name_const(Item *name_arg, Item *val):
+ value_item(val), name_item(name_arg)
{
Item::maybe_null= TRUE;
}
@@ -1297,11 +1298,12 @@ public:
Item *equal_fields_propagator(byte *arg);
bool set_no_const_sub(byte *arg);
Item *replace_equal_field(byte *arg);
- inline uint32 max_disp_length() { return field->max_length(); }
+ inline uint32 max_disp_length() { return field->max_display_length(); }
Item_field *filed_for_view_update() { return this; }
Item *safe_charset_converter(CHARSET_INFO *tocs);
int fix_outer_field(THD *thd, Field **field, Item **reference);
virtual Item *update_value_transformer(byte *select_arg);
+ void print(String *str);
friend class Item_default_value;
friend class Item_insert_value;
friend class st_select_lex_unit;
@@ -1332,7 +1334,7 @@ public:
/* to prevent drop fixed flag (no need parent cleanup call) */
void cleanup() {}
bool basic_const_item() const { return 1; }
- Item *new_item() { return new Item_null(name); }
+ Item *clone_item() { return new Item_null(name); }
bool is_null() { return 1; }
void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
Item *safe_charset_converter(CHARSET_INFO *tocs);
@@ -1479,7 +1481,7 @@ public:
basic_const_item returned TRUE.
*/
Item *safe_charset_converter(CHARSET_INFO *tocs);
- Item *new_item();
+ Item *clone_item();
/*
Implement by-value equality evaluation if parameter value
is set and is a basic constant (integer, real or string).
@@ -1511,7 +1513,7 @@ public:
String *val_str(String*);
int save_in_field(Field *field, bool no_conversions);
bool basic_const_item() const { return 1; }
- Item *new_item() { return new Item_int(name,value,max_length); }
+ Item *clone_item() { return new Item_int(name,value,max_length); }
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
void print(String *str);
@@ -1531,7 +1533,7 @@ public:
double val_real()
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
String *val_str(String*);
- Item *new_item() { return new Item_uint(name,max_length); }
+ Item *clone_item() { return new Item_uint(name,max_length); }
int save_in_field(Field *field, bool no_conversions);
void print(String *str);
Item_num *neg ();
@@ -1562,7 +1564,7 @@ public:
my_decimal *val_decimal(my_decimal *val) { return &decimal_value; }
int save_in_field(Field *field, bool no_conversions);
bool basic_const_item() const { return 1; }
- Item *new_item()
+ Item *clone_item()
{
return new Item_decimal(name, &decimal_value, decimals, max_length);
}
@@ -1620,7 +1622,7 @@ public:
bool basic_const_item() const { return 1; }
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
- Item *new_item()
+ Item *clone_item()
{ return new Item_float(name, value, decimals, max_length); }
Item_num *neg() { value= -value; return this; }
void print(String *str);
@@ -1705,13 +1707,17 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
bool basic_const_item() const { return 1; }
bool eq(const Item *item, bool binary_cmp) const;
- Item *new_item()
+ Item *clone_item()
{
return new Item_string(name, str_value.ptr(),
str_value.length(), collation.collation);
}
Item *safe_charset_converter(CHARSET_INFO *tocs);
- inline void append(char *str, uint length) { str_value.append(str, length); }
+ inline void append(char *str, uint length)
+ {
+ str_value.append(str, length);
+ max_length= str_value.numchars() * collation.collation->mbmaxlen;
+ }
void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
@@ -1756,9 +1762,9 @@ class Item_return_int :public Item_int
{
enum_field_types int_field_type;
public:
- Item_return_int(const char *name, uint length,
+ Item_return_int(const char *name_arg, uint length,
enum_field_types field_type_arg)
- :Item_int(name, 0, length), int_field_type(field_type_arg)
+ :Item_int(name_arg, 0, length), int_field_type(field_type_arg)
{
unsigned_flag=1;
}
@@ -1773,7 +1779,10 @@ public:
Item_hex_string(const char *str,uint str_length);
enum Type type() const { return VARBIN_ITEM; }
double val_real()
- { DBUG_ASSERT(fixed == 1); return (double) Item_hex_string::val_int(); }
+ {
+ DBUG_ASSERT(fixed == 1);
+ return (double) (ulonglong) Item_hex_string::val_int();
+ }
longlong val_int();
bool basic_const_item() const { return 1; }
String *val_str(String*) { DBUG_ASSERT(fixed == 1); return &str_value; }
@@ -1847,7 +1856,8 @@ public:
with Bar, and if we have a more broader set of problems like this.
*/
Item_ref(Name_resolution_context *context_arg, Item **item,
- const char *table_name_arg, const char *field_name_arg);
+ const char *table_name_arg, const char *field_name_arg,
+ bool alias_name_used_arg= FALSE);
/* Constructor need to process subselect with temporary tables (see Item) */
Item_ref(THD *thd, Item_ref *item)
@@ -1922,8 +1932,11 @@ class Item_direct_ref :public Item_ref
public:
Item_direct_ref(Name_resolution_context *context_arg, Item **item,
const char *table_name_arg,
- const char *field_name_arg)
- :Item_ref(context_arg, item, table_name_arg, field_name_arg) {}
+ const char *field_name_arg,
+ bool alias_name_used_arg= FALSE)
+ :Item_ref(context_arg, item, table_name_arg,
+ field_name_arg, alias_name_used_arg)
+ {}
/* Constructor need to process subselect with temporary tables (see Item) */
Item_direct_ref(THD *thd, Item_direct_ref *item) : Item_ref(thd, item) {}
@@ -2054,7 +2067,7 @@ public:
{
return ref->save_in_field(field, no_conversions);
}
- Item *new_item();
+ Item *clone_item();
virtual Item *real_item() { return ref; }
};
@@ -2490,8 +2503,8 @@ public:
enum Item_result result_type() const { return ROW_RESULT; }
uint cols() { return item_count; }
- Item* el(uint i) { return values[i]; }
- Item** addr(uint i) { return (Item **) (values + i); }
+ Item *element_index(uint i) { return values[i]; }
+ Item **addr(uint i) { return (Item **) (values + i); }
bool check_cols(uint c);
bool null_inside();
void bring_value();
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9ca010e7cf5..e032974fdea 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -281,7 +281,7 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
void Item_bool_func2::fix_length_and_dec()
{
max_length= 1; // Function returns 0 or 1
- THD *thd= current_thd;
+ THD *thd;
/*
As some compare functions are generated after sql_yacc,
@@ -319,12 +319,13 @@ void Item_bool_func2::fix_length_and_dec()
return;
}
+ thd= current_thd;
if (!thd->is_context_analysis_only())
{
- Item *real_item= args[0]->real_item();
- if (real_item->type() == FIELD_ITEM)
+ Item *arg_real_item= args[0]->real_item();
+ if (arg_real_item->type() == FIELD_ITEM)
{
- Field *field=((Item_field*) real_item)->field;
+ Field *field=((Item_field*) arg_real_item)->field;
if (field->can_be_compared_as_longlong())
{
if (convert_constant_item(thd, field,&args[1]))
@@ -336,10 +337,10 @@ void Item_bool_func2::fix_length_and_dec()
}
}
}
- real_item= args[1]->real_item();
- if (real_item->type() == FIELD_ITEM /* && !real_item->const_item() */)
+ arg_real_item= args[1]->real_item();
+ if (arg_real_item->type() == FIELD_ITEM)
{
- Field *field=((Item_field*) real_item)->field;
+ Field *field=((Item_field*) arg_real_item)->field;
if (field->can_be_compared_as_longlong())
{
if (convert_constant_item(thd, field,&args[0]))
@@ -375,9 +376,9 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
return 1;
for (uint i=0; i < n; i++)
{
- if ((*a)->el(i)->cols() != (*b)->el(i)->cols())
+ if ((*a)->element_index(i)->cols() != (*b)->element_index(i)->cols())
{
- my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->el(i)->cols());
+ my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols());
return 1;
}
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
@@ -792,6 +793,59 @@ int Arg_comparator::compare_e_row()
}
+void Item_func_truth::fix_length_and_dec()
+{
+ maybe_null= 0;
+ null_value= 0;
+ decimals= 0;
+ max_length= 1;
+}
+
+
+void Item_func_truth::print(String *str)
+{
+ str->append('(');
+ args[0]->print(str);
+ str->append(STRING_WITH_LEN(" is "));
+ if (! affirmative)
+ str->append(STRING_WITH_LEN("not "));
+ if (value)
+ str->append(STRING_WITH_LEN("true"));
+ else
+ str->append(STRING_WITH_LEN("false"));
+ str->append(')');
+}
+
+
+bool Item_func_truth::val_bool()
+{
+ bool val= args[0]->val_bool();
+ if (args[0]->null_value)
+ {
+ /*
+ NULL val IS {TRUE, FALSE} --> FALSE
+ NULL val IS NOT {TRUE, FALSE} --> TRUE
+ */
+ return (! affirmative);
+ }
+
+ if (affirmative)
+ {
+ /* {TRUE, FALSE} val IS {TRUE, FALSE} value */
+ return (val == value);
+ }
+
+ /* {TRUE, FALSE} val IS NOT {TRUE, FALSE} value */
+ return (val != value);
+}
+
+
+longlong Item_func_truth::val_int()
+{
+ return (val_bool() ? 1 : 0);
+}
+
+
bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
{
if (!args[0]->fixed && args[0]->fix_fields(thd, args) ||
@@ -811,10 +865,10 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
uint n= cache->cols();
for (uint i= 0; i < n; i++)
{
- if (args[0]->el(i)->used_tables())
- ((Item_cache *)cache->el(i))->set_used_tables(OUTER_REF_TABLE_BIT);
+ if (args[0]->element_index(i)->used_tables())
+ ((Item_cache *)cache->element_index(i))->set_used_tables(OUTER_REF_TABLE_BIT);
else
- ((Item_cache *)cache->el(i))->set_used_tables(0);
+ ((Item_cache *)cache->element_index(i))->set_used_tables(0);
}
used_tables_cache= args[0]->used_tables();
}
@@ -854,6 +908,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
longlong Item_in_optimizer::val_int()
{
+ bool tmp;
DBUG_ASSERT(fixed == 1);
cache->store(args[0]);
@@ -888,7 +943,7 @@ longlong Item_in_optimizer::val_int()
if (cache->cols() == 1)
{
item_subs->set_cond_guard_var(0, FALSE);
- longlong tmp= args[1]->val_bool_result();
+ (void) args[1]->val_bool_result();
result_for_null_param= null_value= !item_subs->engine->no_rows();
item_subs->set_cond_guard_var(0, TRUE);
}
@@ -902,11 +957,11 @@ longlong Item_in_optimizer::val_int()
*/
for (i= 0; i < ncols; i++)
{
- if (cache->el(i)->null_value)
+ if (cache->element_index(i)->null_value)
item_subs->set_cond_guard_var(i, FALSE);
}
- longlong tmp= args[1]->val_bool_result();
+ (void) args[1]->val_bool_result();
result_for_null_param= null_value= !item_subs->engine->no_rows();
/* Turn all predicates back on */
@@ -917,7 +972,7 @@ longlong Item_in_optimizer::val_int()
}
return 0;
}
- bool tmp= args[1]->val_bool_result();
+ tmp= args[1]->val_bool_result();
null_value= args[1]->null_value;
return tmp;
}
@@ -1026,15 +1081,15 @@ longlong Item_func_strcmp::val_int()
void Item_func_interval::fix_length_and_dec()
{
- use_decimal_comparison= (row->el(0)->result_type() == DECIMAL_RESULT) ||
- (row->el(0)->result_type() == INT_RESULT);
+ use_decimal_comparison= (row->element_index(0)->result_type() == DECIMAL_RESULT) ||
+ (row->element_index(0)->result_type() == INT_RESULT);
if (row->cols() > 8)
{
bool consts=1;
for (uint i=1 ; consts && i < row->cols() ; i++)
{
- consts&= row->el(i)->const_item();
+ consts&= row->element_index(i)->const_item();
}
if (consts &&
@@ -1045,7 +1100,7 @@ void Item_func_interval::fix_length_and_dec()
{
for (uint i=1 ; i < row->cols(); i++)
{
- Item *el= row->el(i);
+ Item *el= row->element_index(i);
interval_range *range= intervals + (i-1);
if ((el->result_type() == DECIMAL_RESULT) ||
(el->result_type() == INT_RESULT))
@@ -1070,7 +1125,7 @@ void Item_func_interval::fix_length_and_dec()
{
for (uint i=1 ; i < row->cols(); i++)
{
- intervals[i-1].dbl= row->el(i)->val_real();
+ intervals[i-1].dbl= row->element_index(i)->val_real();
}
}
}
@@ -1110,15 +1165,15 @@ longlong Item_func_interval::val_int()
if (use_decimal_comparison)
{
- dec= row->el(0)->val_decimal(&dec_buf);
- if (row->el(0)->null_value)
+ dec= row->element_index(0)->val_decimal(&dec_buf);
+ if (row->element_index(0)->null_value)
return -1;
my_decimal2double(E_DEC_FATAL_ERROR, dec, &value);
}
else
{
- value= row->el(0)->val_real();
- if (row->el(0)->null_value)
+ value= row->element_index(0)->val_real();
+ if (row->element_index(0)->null_value)
return -1;
}
@@ -1154,16 +1209,16 @@ longlong Item_func_interval::val_int()
for (i=1 ; i < row->cols() ; i++)
{
- Item *el= row->el(i);
+ Item *el= row->element_index(i);
if (use_decimal_comparison &&
((el->result_type() == DECIMAL_RESULT) ||
(el->result_type() == INT_RESULT)))
{
- my_decimal e_dec_buf, *e_dec= row->el(i)->val_decimal(&e_dec_buf);
+ my_decimal e_dec_buf, *e_dec= row->element_index(i)->val_decimal(&e_dec_buf);
if (my_decimal_cmp(e_dec, dec) > 0)
return i-1;
}
- else if (row->el(i)->val_real() > value)
+ else if (row->element_index(i)->val_real() > value)
return i-1;
}
return i-1;
@@ -1527,6 +1582,7 @@ Item_func_if::fix_length_and_dec()
{
maybe_null=args[1]->maybe_null || args[2]->maybe_null;
decimals= max(args[1]->decimals, args[2]->decimals);
+ unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag;
enum Item_result arg1_type=args[1]->result_type();
enum Item_result arg2_type=args[2]->result_type();
@@ -1556,12 +1612,20 @@ Item_func_if::fix_length_and_dec()
collation.set(&my_charset_bin); // Number
}
}
- max_length=
- (cached_result_type == DECIMAL_RESULT || cached_result_type == INT_RESULT) ?
- (max(args[1]->max_length - args[1]->decimals,
- args[2]->max_length - args[2]->decimals) + decimals +
- (unsigned_flag ? 0 : 1) ) :
- max(args[1]->max_length, args[2]->max_length);
+
+ if ((cached_result_type == DECIMAL_RESULT )
+ || (cached_result_type == INT_RESULT))
+ {
+ int len1= args[1]->max_length - args[1]->decimals
+ - (args[1]->unsigned_flag ? 0 : 1);
+
+ int len2= args[2]->max_length - args[2]->decimals
+ - (args[2]->unsigned_flag ? 0 : 1);
+
+ max_length=max(len1, len2) + decimals + (unsigned_flag ? 0 : 1);
+ }
+ else
+ max_length= max(args[1]->max_length, args[2]->max_length);
}
@@ -1886,7 +1950,9 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
buff should match stack usage from
Item_func_case::val_int() -> Item_func_case::find_item()
*/
+#ifndef EMBEDDED_LIBRARY
char buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2];
+#endif
bool res= Item_func::fix_fields(thd, ref);
/*
Call check_stack_overrun after fix_fields to be sure that stack variable
@@ -2089,9 +2155,100 @@ void Item_func_coalesce::fix_length_and_dec()
Classes and function for the IN operator
****************************************************************************/
-static int cmp_longlong(void *cmp_arg, longlong *a,longlong *b)
+/*
+ Determine which of the signed longlong arguments is bigger
+
+ SYNOPSIS
+ cmp_longs()
+ a_val left argument
+ b_val right argument
+
+ DESCRIPTION
+ This function will compare two signed longlong arguments
+ and will return -1, 0, or 1 if left argument is smaller than,
+ equal to or greater than the right argument.
+
+ RETURN VALUE
+ -1 left argument is smaller than the right argument.
+ 0 left argument is equal to the right argument.
+ 1 left argument is greater than the right argument.
+*/
+static inline int cmp_longs (longlong a_val, longlong b_val)
{
- return *a < *b ? -1 : *a == *b ? 0 : 1;
+ return a_val < b_val ? -1 : a_val == b_val ? 0 : 1;
+}
+
+
+/*
+ Determine which of the unsigned longlong arguments is bigger
+
+ SYNOPSIS
+ cmp_ulongs()
+ a_val left argument
+ b_val right argument
+
+ DESCRIPTION
+ This function will compare two unsigned longlong arguments
+ and will return -1, 0, or 1 if left argument is smaller than,
+ equal to or greater than the right argument.
+
+ RETURN VALUE
+ -1 left argument is smaller than the right argument.
+ 0 left argument is equal to the right argument.
+ 1 left argument is greater than the right argument.
+*/
+static inline int cmp_ulongs (ulonglong a_val, ulonglong b_val)
+{
+ return a_val < b_val ? -1 : a_val == b_val ? 0 : 1;
+}
+
+
+/*
+ Compare two integers in IN value list format (packed_longlong)
+
+ SYNOPSIS
+ cmp_longlong()
+ cmp_arg an argument passed to the calling function (qsort2)
+ a left argument
+ b right argument
+
+ DESCRIPTION
+ This function will compare two integer arguments in the IN value list
+ format and will return -1, 0, or 1 if left argument is smaller than,
+ equal to or greater than the right argument.
+ It's used in sorting the IN values list and finding an element in it.
+ Depending on the signedness of the arguments cmp_longlong() will
+ compare them as either signed (using cmp_longs()) or unsigned (using
+ cmp_ulongs()).
+
+ RETURN VALUE
+ -1 left argument is smaller than the right argument.
+ 0 left argument is equal to the right argument.
+ 1 left argument is greater than the right argument.
+*/
+int cmp_longlong(void *cmp_arg,
+ in_longlong::packed_longlong *a,
+ in_longlong::packed_longlong *b)
+{
+ if (a->unsigned_flag != b->unsigned_flag)
+ {
+ /*
+ One of the args is unsigned and is too big to fit into the
+ positive signed range. Report no match.
+ */
+ if (a->unsigned_flag && ((ulonglong) a->val) > LONGLONG_MAX ||
+ b->unsigned_flag && ((ulonglong) b->val) > LONGLONG_MAX)
+ return a->unsigned_flag ? 1 : -1;
+ /*
+ Although the signedness differs both args can fit into the signed
+ positive range. Make them signed and compare as usual.
+ */
+ return cmp_longs (a->val, b->val);
+ }
+ if (a->unsigned_flag)
+ return cmp_ulongs ((ulonglong) a->val, (ulonglong) b->val);
+ else
+ return cmp_longs (a->val, b->val);
}
static int cmp_double(void *cmp_arg, double *a,double *b)
@@ -2216,19 +2373,23 @@ void in_row::set(uint pos, Item *item)
}
in_longlong::in_longlong(uint elements)
- :in_vector(elements,sizeof(longlong),(qsort2_cmp) cmp_longlong, 0)
+ :in_vector(elements,sizeof(packed_longlong),(qsort2_cmp) cmp_longlong, 0)
{}
void in_longlong::set(uint pos,Item *item)
{
- ((longlong*) base)[pos]=item->val_int();
+ struct packed_longlong *buff= &((packed_longlong*) base)[pos];
+
+ buff->val= item->val_int();
+ buff->unsigned_flag= item->unsigned_flag;
}
byte *in_longlong::get_value(Item *item)
{
- tmp= item->val_int();
+ tmp.val= item->val_int();
if (item->null_value)
return 0;
+ tmp.unsigned_flag= item->unsigned_flag;
return (byte*) &tmp;
}
@@ -2349,11 +2510,11 @@ void cmp_item_row::store_value(Item *item)
{
if (!comparators[i])
if (!(comparators[i]=
- cmp_item::get_comparator(item->el(i)->result_type(),
- item->el(i)->collation.collation)))
+ cmp_item::get_comparator(item->element_index(i)->result_type(),
+ item->element_index(i)->collation.collation)))
break; // new failed
- comparators[i]->store_value(item->el(i));
- item->null_value|= item->el(i)->null_value;
+ comparators[i]->store_value(item->element_index(i));
+ item->null_value|= item->element_index(i)->null_value;
}
}
DBUG_VOID_RETURN;
@@ -2378,8 +2539,8 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
if (!(comparators[i]= tmpl->comparators[i]->make_same()))
break; // new failed
comparators[i]->store_value_by_template(tmpl->comparators[i],
- item->el(i));
- item->null_value|= item->el(i)->null_value;
+ item->element_index(i));
+ item->null_value|= item->element_index(i)->null_value;
}
}
}
@@ -2397,9 +2558,9 @@ int cmp_item_row::cmp(Item *arg)
arg->bring_value();
for (uint i=0; i < n; i++)
{
- if (comparators[i]->cmp(arg->el(i)))
+ if (comparators[i]->cmp(arg->element_index(i)))
{
- if (!arg->el(i)->null_value)
+ if (!arg->element_index(i)->null_value)
return 1;
was_null= 1;
}
@@ -2410,11 +2571,11 @@ int cmp_item_row::cmp(Item *arg)
int cmp_item_row::compare(cmp_item *c)
{
- cmp_item_row *cmp= (cmp_item_row *) c;
+ cmp_item_row *l_cmp= (cmp_item_row *) c;
for (uint i=0; i < n; i++)
{
int res;
- if ((res= comparators[i]->compare(cmp->comparators[i])))
+ if ((res= comparators[i]->compare(l_cmp->comparators[i])))
return res;
}
return 0;
@@ -2441,8 +2602,8 @@ int cmp_item_decimal::cmp(Item *arg)
int cmp_item_decimal::compare(cmp_item *arg)
{
- cmp_item_decimal *cmp= (cmp_item_decimal*) arg;
- return my_decimal_cmp(&value, &cmp->value);
+ cmp_item_decimal *l_cmp= (cmp_item_decimal*) arg;
+ return my_decimal_cmp(&value, &l_cmp->value);
}
@@ -2549,6 +2710,31 @@ void Item_func_in::fix_length_and_dec()
*/
if (const_itm && !nulls_in_row())
{
+ /*
+ IN must compare INT/DATE/DATETIME/TIMESTAMP columns and constants
+ as int values (the same way as equality does).
+ So we must check here if the column on the left and all the constant
+ values on the right can be compared as integers and adjust the
+ comparison type accordingly.
+ */
+ if (args[0]->real_item()->type() == FIELD_ITEM &&
+ thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
+ thd->lex->sql_command != SQLCOM_SHOW_CREATE &&
+ cmp_type != INT_RESULT)
+ {
+ Field *field= ((Item_field*) (args[0]->real_item()))->field;
+ if (field->can_be_compared_as_longlong())
+ {
+ bool all_converted= TRUE;
+ for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
+ {
+ if (!convert_constant_item (thd, field, &arg[0]))
+ all_converted= FALSE;
+ }
+ if (all_converted)
+ cmp_type= INT_RESULT;
+ }
+ }
switch (cmp_type) {
case STRING_RESULT:
array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index d7db928e281..f6c6f612c5b 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -101,6 +101,92 @@ public:
uint decimal_precision() const { return 1; }
};
+
+/**
+ Abstract Item class, to represent <code>X IS [NOT] (TRUE | FALSE)</code>
+ boolean predicates.
+*/
+
+class Item_func_truth : public Item_bool_func
+{
+public:
+ virtual bool val_bool();
+ virtual longlong val_int();
+ virtual void fix_length_and_dec();
+ virtual void print(String *str);
+
+protected:
+ Item_func_truth(Item *a, bool a_value, bool a_affirmative)
+ : Item_bool_func(a), value(a_value), affirmative(a_affirmative)
+ {}
+
+ ~Item_func_truth()
+ {}
+private:
+ /**
+ True for <code>X IS [NOT] TRUE</code>,
+ false for <code>X IS [NOT] FALSE</code> predicates.
+ */
+ const bool value;
+ /**
+ True for <code>X IS Y</code>, false for <code>X IS NOT Y</code> predicates.
+ */
+ const bool affirmative;
+};
+
+
+/**
+ This Item represents a <code>X IS TRUE</code> boolean predicate.
+*/
+
+class Item_func_istrue : public Item_func_truth
+{
+public:
+ Item_func_istrue(Item *a) : Item_func_truth(a, true, true) {}
+ ~Item_func_istrue() {}
+ virtual const char* func_name() const { return "istrue"; }
+};
+
+
+/**
+ This Item represents a <code>X IS NOT TRUE</code> boolean predicate.
+*/
+
+class Item_func_isnottrue : public Item_func_truth
+{
+public:
+ Item_func_isnottrue(Item *a) : Item_func_truth(a, true, false) {}
+ ~Item_func_isnottrue() {}
+ virtual const char* func_name() const { return "isnottrue"; }
+};
+
+
+/**
+ This Item represents a <code>X IS FALSE</code> boolean predicate.
+*/
+
+class Item_func_isfalse : public Item_func_truth
+{
+public:
+ Item_func_isfalse(Item *a) : Item_func_truth(a, false, true) {}
+ ~Item_func_isfalse() {}
+ virtual const char* func_name() const { return "isfalse"; }
+};
+
+
+/**
+ This Item represents a <code>X IS NOT FALSE</code> boolean predicate.
+*/
+
+class Item_func_isnotfalse : public Item_func_truth
+{
+public:
+ Item_func_isnotfalse(Item *a) : Item_func_truth(a, false, false) {}
+ ~Item_func_isnotfalse() {}
+ virtual const char* func_name() const { return "isnotfalse"; }
+};
+
+
class Item_cache;
#define UNKNOWN ((my_bool)-1)
@@ -734,7 +820,16 @@ public:
class in_longlong :public in_vector
{
- longlong tmp;
+ /*
+ Here we declare a temporary variable (tmp) of the same type as the
+ elements of this vector. tmp is used in finding if a given value is in
+ the list.
+ */
+ struct packed_longlong
+ {
+ longlong val;
+ longlong unsigned_flag; // Use longlong, not bool, to preserve alignment
+ } tmp;
public:
in_longlong(uint elements);
void set(uint pos,Item *item);
@@ -750,8 +845,12 @@ public:
}
void value_to_item(uint pos, Item *item)
{
- ((Item_int*)item)->value= ((longlong*)base)[pos];
+ ((Item_int*) item)->value= ((packed_longlong*) base)[pos].val;
+ ((Item_int*) item)->unsigned_flag= (my_bool)
+ ((packed_longlong*) base)[pos].unsigned_flag;
}
+
+ friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b);
};
class in_double :public in_vector
@@ -845,10 +944,10 @@ public:
return (value_res ? (res ? sortcmp(value_res, res, cmp_charset) : 1) :
(res ? -1 : 0));
}
- int compare(cmp_item *c)
+ int compare(cmp_item *ci)
{
- cmp_item_string *cmp= (cmp_item_string *)c;
- return sortcmp(value_res, cmp->value_res, cmp_charset);
+ cmp_item_string *l_cmp= (cmp_item_string *) ci;
+ return sortcmp(value_res, l_cmp->value_res, cmp_charset);
}
cmp_item *make_same();
};
@@ -866,10 +965,10 @@ public:
{
return value != arg->val_int();
}
- int compare(cmp_item *c)
+ int compare(cmp_item *ci)
{
- cmp_item_int *cmp= (cmp_item_int *)c;
- return (value < cmp->value) ? -1 : ((value == cmp->value) ? 0 : 1);
+ cmp_item_int *l_cmp= (cmp_item_int *)ci;
+ return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1);
}
cmp_item *make_same();
};
@@ -887,10 +986,10 @@ public:
{
return value != arg->val_real();
}
- int compare(cmp_item *c)
+ int compare(cmp_item *ci)
{
- cmp_item_real *cmp= (cmp_item_real *)c;
- return (value < cmp->value)? -1 : ((value == cmp->value) ? 0 : 1);
+ cmp_item_real *l_cmp= (cmp_item_real *) ci;
+ return (value < l_cmp->value)? -1 : ((value == l_cmp->value) ? 0 : 1);
}
cmp_item *make_same();
};
@@ -955,10 +1054,10 @@ public:
DBUG_ASSERT(0);
return 1;
}
- int compare(cmp_item *c)
+ int compare(cmp_item *ci)
{
- cmp_item_string *cmp= (cmp_item_string *)c;
- return sortcmp(value_res, cmp->value_res, cmp_charset);
+ cmp_item_string *l_cmp= (cmp_item_string *) ci;
+ return sortcmp(value_res, l_cmp->value_res, cmp_charset);
}
cmp_item *make_same()
{
@@ -1372,7 +1471,7 @@ public:
Item_cond_and() :Item_cond() {}
Item_cond_and(Item *i1,Item *i2) :Item_cond(i1,i2) {}
Item_cond_and(THD *thd, Item_cond_and *item) :Item_cond(thd, item) {}
- Item_cond_and(List<Item> &list): Item_cond(list) {}
+ Item_cond_and(List<Item> &list_arg): Item_cond(list_arg) {}
enum Functype functype() const { return COND_AND_FUNC; }
longlong val_int();
const char *func_name() const { return "and"; }
@@ -1394,7 +1493,7 @@ public:
Item_cond_or() :Item_cond() {}
Item_cond_or(Item *i1,Item *i2) :Item_cond(i1,i2) {}
Item_cond_or(THD *thd, Item_cond_or *item) :Item_cond(thd, item) {}
- Item_cond_or(List<Item> &list): Item_cond(list) {}
+ Item_cond_or(List<Item> &list_arg): Item_cond(list_arg) {}
enum Functype functype() const { return COND_OR_FUNC; }
longlong val_int();
const char *func_name() const { return "or"; }
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 32cc90b96d6..e8ecd6b8f1c 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -409,8 +409,13 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const
if (item->type() != FUNC_ITEM)
return 0;
Item_func *item_func=(Item_func*) item;
- if (arg_count != item_func->arg_count ||
- func_name() != item_func->func_name())
+ Item_func::Functype func_type;
+ if ((func_type= functype()) != item_func->functype() ||
+ arg_count != item_func->arg_count ||
+ (func_type != Item_func::FUNC_SP &&
+ func_name() != item_func->func_name()) ||
+ (func_type == Item_func::FUNC_SP &&
+ my_strcasecmp(system_charset_info, func_name(), item_func->func_name())))
return 0;
for (uint i=0; i < arg_count ; i++)
if (!args[i]->eq(item_func->args[i], binary_cmp))
@@ -2360,7 +2365,7 @@ longlong Item_func_locate::val_int()
b->ptr(), b->length(),
&match, 1))
return 0;
- return (longlong) match.mblen + start0 + 1;
+ return (longlong) match.mb_len + start0 + 1;
}
@@ -3161,9 +3166,9 @@ longlong Item_master_pos_wait::val_int()
null_value = 1;
return 0;
}
+#ifdef HAVE_REPLICATION
longlong pos = (ulong)args[1]->val_int();
longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
-#ifdef HAVE_REPLICATION
if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
{
null_value = 1;
@@ -3459,6 +3464,7 @@ longlong Item_func_benchmark::val_int()
DBUG_ASSERT(fixed == 1);
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), &my_charset_bin);
+ my_decimal tmp_decimal;
THD *thd=current_thd;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
@@ -3473,6 +3479,9 @@ longlong Item_func_benchmark::val_int()
case STRING_RESULT:
(void) args[0]->val_str(&tmp);
break;
+ case DECIMAL_RESULT:
+ (void) args[0]->val_decimal(&tmp_decimal);
+ break;
case ROW_RESULT:
default:
// This case should never be chosen
@@ -3715,7 +3724,8 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
bool
-Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
+Item_func_set_user_var::update_hash(void *ptr, uint length,
+ Item_result res_type,
CHARSET_INFO *cs, Derivation dv,
bool unsigned_arg)
{
@@ -3724,9 +3734,9 @@ Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
result type of the variable
*/
if ((null_value= args[0]->null_value) && null_item)
- type= entry->type; // Don't change type of item
+ res_type= entry->type; // Don't change type of item
if (::update_hash(entry, (null_value= args[0]->null_value),
- ptr, length, type, cs, dv, unsigned_arg))
+ ptr, length, res_type, cs, dv, unsigned_arg))
{
current_thd->fatal_error(); // Probably end of memory
null_value= 1;
@@ -4226,7 +4236,14 @@ int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
user_var_entry *var_entry;
var_entry= get_variable(&thd->user_vars, name, 0);
- if (!(opt_bin_log && is_update_query(sql_command)))
+ /*
+ Any reference to user-defined variable which is done from stored
+ function or trigger affects their execution and the execution of the
+ calling statement. We must log all such variables even if they are
+ not involved in table-updating statements.
+ */
+ if (!(opt_bin_log &&
+ (is_update_query(sql_command) || thd->in_sub_stmt)))
{
*out_entry= var_entry;
return 0;
@@ -4978,8 +4995,9 @@ longlong Item_func_row_count::val_int()
}
-Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
- :Item_func(), context(context_arg), m_name(name), m_sp(NULL),
+Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
+ sp_name *name_arg)
+ :Item_func(), context(context_arg), m_name(name_arg), m_sp(NULL),
result_field(NULL)
{
maybe_null= 1;
@@ -4989,8 +5007,8 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
- sp_name *name, List<Item> &list)
- :Item_func(list), context(context_arg), m_name(name), m_sp(NULL),
+ sp_name *name_arg, List<Item> &list)
+ :Item_func(list), context(context_arg), m_name(name_arg), m_sp(NULL),
result_field(NULL)
{
maybe_null= 1;
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 676b3bc9b36..6c012277888 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -35,6 +35,7 @@ void Item_geometry_func::fix_length_and_dec()
collation.set(&my_charset_bin);
decimals=0;
max_length=MAX_BLOB_WIDTH;
+ maybe_null= 1;
}
int Item_geometry_func::get_geometry_type() const
@@ -63,11 +64,8 @@ String *Item_func_geometry_from_text::val_str(String *str)
return 0;
str->length(0);
str->q_append(srid);
- if (!Geometry::create_from_wkt(&buffer, &trs, str, 0))
- /* We shouldn't return NULL here as NULL is a legal spatial object */
- /* Geometry::bad_spatial_data will produce error message beeing stored*/
- /* in GEOMETRY field */
- return &Geometry::bad_geometry_data;
+ if ((null_value= !Geometry::create_from_wkt(&buffer, &trs, str, 0)))
+ return 0;
return str;
}
@@ -121,6 +119,7 @@ String *Item_func_as_wkt::val_str(String *str)
void Item_func_as_wkt::fix_length_and_dec()
{
max_length=MAX_BLOB_WIDTH;
+ maybe_null= 1;
}
@@ -386,7 +385,8 @@ String *Item_func_spatial_collection::val_str(String *str)
for (i= 0; i < arg_count; ++i)
{
String *res= args[i]->val_str(&arg_value);
- if (args[i]->null_value)
+ uint32 len;
+ if (args[i]->null_value || ((len= res->length()) < WKB_HEADER_SIZE))
goto err;
if (coll_type == Geometry::wkb_geometrycollection)
@@ -395,13 +395,12 @@ String *Item_func_spatial_collection::val_str(String *str)
In the case of GeometryCollection we don't need any checkings
for item types, so just copy them into target collection
*/
- if (str->append(res->ptr(), res->length(), (uint32) 512))
+ if (str->append(res->ptr(), len, (uint32) 512))
goto err;
}
else
{
enum Geometry::wkbType wkb_type;
- uint32 len=res->length();
const char *data= res->ptr() + 1;
/*
@@ -409,8 +408,6 @@ String *Item_func_spatial_collection::val_str(String *str)
are of specific type, let's do this checking now
*/
- if (len < 5)
- goto err;
wkb_type= (Geometry::wkbType) uint4korr(data);
data+= 4;
len-= 5;
@@ -532,9 +529,13 @@ longlong Item_func_spatial_rel::val_int()
longlong Item_func_isempty::val_int()
{
DBUG_ASSERT(fixed == 1);
- String tmp;
- null_value=0;
- return args[0]->null_value ? 1 : 0;
+ String tmp;
+ String *swkb= args[0]->val_str(&tmp);
+ Geometry_buffer buffer;
+
+ null_value= args[0]->null_value ||
+ !(Geometry::construct(&buffer, swkb->ptr(), swkb->length()));
+ return null_value ? 1 : 0;
}
@@ -542,10 +543,11 @@ longlong Item_func_issimple::val_int()
{
DBUG_ASSERT(fixed == 1);
String tmp;
- String *wkb=args[0]->val_str(&tmp);
-
- if ((null_value= (!wkb || args[0]->null_value)))
- return 0;
+ String *swkb= args[0]->val_str(&tmp);
+ Geometry_buffer buffer;
+
+ null_value= args[0]->null_value ||
+ !(Geometry::construct(&buffer, swkb->ptr(), swkb->length()));
/* TODO: Ramil or Holyfoot, add real IsSimple calculation */
return 0;
}
@@ -698,8 +700,9 @@ double Item_func_glength::val_real()
null_value= (!swkb ||
!(geom= Geometry::construct(&buffer,
- swkb->ptr(), swkb->length())) ||
- geom->length(&res));
+ swkb->ptr(),
+ swkb->length())) ||
+ geom->geom_length(&res));
return res;
}
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index 4fb379fdda7..9c7970f9e53 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -34,6 +34,7 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
Field *tmp_table_field(TABLE *t_arg);
virtual int get_geometry_type() const;
+ bool is_null() { (void) val_int(); return null_value; }
};
class Item_func_geometry_from_text: public Item_geometry_func
@@ -81,6 +82,7 @@ public:
void fix_length_and_dec()
{
max_length=20; // "GeometryCollection" is the most long
+ maybe_null= 1;
};
};
@@ -225,6 +227,8 @@ public:
}
}
void print(String *str) { Item_func::print(str); }
+ void fix_length_and_dec() { maybe_null= 1; }
+ bool is_null() { (void) val_int(); return null_value; }
};
class Item_func_isempty: public Item_bool_func
@@ -234,6 +238,7 @@ public:
longlong val_int();
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "isempty"; }
+ void fix_length_and_dec() { maybe_null= 1; }
};
class Item_func_issimple: public Item_bool_func
@@ -243,6 +248,7 @@ public:
longlong val_int();
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "issimple"; }
+ void fix_length_and_dec() { maybe_null= 1; }
};
class Item_func_isclosed: public Item_bool_func
@@ -252,6 +258,7 @@ public:
longlong val_int();
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "isclosed"; }
+ void fix_length_and_dec() { maybe_null= 1; }
};
class Item_func_dimension: public Item_int_func
@@ -261,7 +268,7 @@ public:
Item_func_dimension(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "dimension"; }
- void fix_length_and_dec() { max_length=10; }
+ void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
};
class Item_func_x: public Item_real_func
@@ -271,6 +278,11 @@ public:
Item_func_x(Item *a): Item_real_func(a) {}
double val_real();
const char *func_name() const { return "x"; }
+ void fix_length_and_dec()
+ {
+ Item_real_func::fix_length_and_dec();
+ maybe_null= 1;
+ }
};
@@ -281,6 +293,11 @@ public:
Item_func_y(Item *a): Item_real_func(a) {}
double val_real();
const char *func_name() const { return "y"; }
+ void fix_length_and_dec()
+ {
+ Item_real_func::fix_length_and_dec();
+ maybe_null= 1;
+ }
};
@@ -291,7 +308,7 @@ public:
Item_func_numgeometries(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "numgeometries"; }
- void fix_length_and_dec() { max_length=10; }
+ void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
};
@@ -302,7 +319,7 @@ public:
Item_func_numinteriorring(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "numinteriorrings"; }
- void fix_length_and_dec() { max_length=10; }
+ void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
};
@@ -313,7 +330,7 @@ public:
Item_func_numpoints(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "numpoints"; }
- void fix_length_and_dec() { max_length=10; }
+ void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
};
@@ -324,6 +341,11 @@ public:
Item_func_area(Item *a): Item_real_func(a) {}
double val_real();
const char *func_name() const { return "area"; }
+ void fix_length_and_dec()
+ {
+ Item_real_func::fix_length_and_dec();
+ maybe_null= 1;
+ }
};
@@ -334,6 +356,11 @@ public:
Item_func_glength(Item *a): Item_real_func(a) {}
double val_real();
const char *func_name() const { return "glength"; }
+ void fix_length_and_dec()
+ {
+ Item_real_func::fix_length_and_dec();
+ maybe_null= 1;
+ }
};
@@ -344,7 +371,7 @@ public:
Item_func_srid(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "srid"; }
- void fix_length_and_dec() { max_length= 10; }
+ void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
};
#define GEOM_NEW(obj_constructor) new obj_constructor
diff --git a/sql/item_row.h b/sql/item_row.h
index bd47558a2f6..8623b579e33 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -71,7 +71,7 @@ public:
Item *transform(Item_transformer transformer, byte *arg);
uint cols() { return arg_count; }
- Item* el(uint i) { return items[i]; }
+ Item* element_index(uint i) { return items[i]; }
Item** addr(uint i) { return items + i; }
bool check_cols(uint c);
bool null_inside() { return with_null; };
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 95cc32b5c8e..6b1921e5bc8 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -37,15 +37,6 @@ C_MODE_END
String my_empty_string("",default_charset_info);
-static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
- const char *fname)
-{
- my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
- c1.collation->name, c1.derivation_name(),
- c2.collation->name, c2.derivation_name(),
- fname);
-}
-
String *Item_str_func::check_well_formed_result(String *str)
{
@@ -976,18 +967,18 @@ String *Item_func_insert::val_str(String *str)
args[3]->null_value)
goto null; /* purecov: inspected */
- if ((start < 0) || (start > res->length() + 1))
+ if ((start < 0) || (start > res->length()))
return res; // Wrong param; skip insert
- if ((length < 0) || (length > res->length() + 1))
- length= res->length() + 1;
+ if ((length < 0) || (length > res->length()))
+ length= res->length();
/* start and length are now sufficiently valid to pass to charpos function */
start= res->charpos((int) start);
length= res->charpos((int) length, (uint32) start);
/* Re-testing with corrected params */
- if (start > res->length() + 1)
- return res; // Wrong param; skip insert
+ if (start > res->length())
+ return res; /* purecov: inspected */ // Wrong param; skip insert
if (length > res->length() - start)
length= res->length() - start;
@@ -1193,11 +1184,10 @@ void Item_func_substr::fix_length_and_dec()
if (args[1]->const_item())
{
int32 start= (int32) args[1]->val_int();
- start= (int32)((start < 0) ? max_length + start : start - 1);
- if (start < 0 || start >= (int32) max_length)
- max_length=0; /* purecov: inspected */
+ if (start < 0)
+ max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
else
- max_length-= (uint) start;
+ max_length-= min((uint)(start - 1), max_length);
}
if (arg_count == 3 && args[2]->const_item())
{
@@ -2251,8 +2241,10 @@ String *Item_func_repeat::val_str(String *str)
if (args[0]->null_value || args[1]->null_value)
goto err; // string and/or delim are null
null_value= 0;
- if ((count <= 0) && !args[1]->unsigned_flag) // For nicer SQL code
+
+ if (count == 0 || count < 0 && !args[1]->unsigned_flag)
return &my_empty_string;
+
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Bounds check on count: If this is triggered, we will error. */
if ((ulonglong) count > INT_MAX32)
@@ -2780,6 +2772,11 @@ String *Item_load_file::val_str(String *str)
(void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
+ /* Read only allowed from within dir specified by secure_file_priv */
+ if (opt_secure_file_priv &&
+ strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
+ goto err;
+
if (!my_stat(path, &stat_info, MYF(0)))
goto err;
@@ -3241,15 +3238,17 @@ String *Item_func_uuid::val_str(String *str)
int i;
if (my_gethwaddr(mac))
{
+ /* purecov: begin inspected */
/*
generating random "hardware addr"
and because specs explicitly specify that it should NOT correlate
with a clock_seq value (initialized random below), we use a separate
randominit() here
*/
- randominit(&uuid_rand, tmp + (ulong) thd, tmp + (ulong)query_id);
+ randominit(&uuid_rand, tmp + (ulong) thd, tmp + (ulong)global_query_id);
for (i=0; i < (int)sizeof(mac); i++)
mac[i]=(uchar)(my_rnd(&uuid_rand)*255);
+ /* purecov: end */
}
s=clock_seq_and_node_str+sizeof(clock_seq_and_node_str)-1;
for (i=sizeof(mac)-1 ; i>=0 ; i--)
@@ -3257,7 +3256,7 @@ String *Item_func_uuid::val_str(String *str)
*--s=_dig_vec_lower[mac[i] & 15];
*--s=_dig_vec_lower[mac[i] >> 4];
}
- randominit(&uuid_rand, tmp + (ulong)start_time,
+ randominit(&uuid_rand, tmp + (ulong) server_start_time,
tmp + thd->status_var.bytes_sent);
set_clock_seq_str();
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 60547d00a5c..778ea6e9496 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -605,7 +605,11 @@ class Item_func_unhex :public Item_str_func
{
String tmp_value;
public:
- Item_func_unhex(Item *a) :Item_str_func(a) {}
+ Item_func_unhex(Item *a) :Item_str_func(a)
+ {
+ /* there can be bad hex strings */
+ maybe_null= 1;
+ }
const char *func_name() const { return "unhex"; }
String *val_str(String *);
void fix_length_and_dec()
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index d61bb25e9b7..12ae0c026eb 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -51,6 +51,10 @@ Item_subselect::Item_subselect():
void Item_subselect::init(st_select_lex *select_lex,
select_subselect *result)
{
+ /*
+ Please see Item_singlerow_subselect::invalidate_and_restore_select_lex(),
+ which depends on alterations to the parse tree implemented here.
+ */
DBUG_ENTER("Item_subselect::init");
DBUG_PRINT("enter", ("select_lex: 0x%lx", (long) select_lex));
@@ -91,6 +95,12 @@ void Item_subselect::init(st_select_lex *select_lex,
DBUG_VOID_RETURN;
}
+st_select_lex *
+Item_subselect::get_select_lex()
+{
+ return unit->first_select();
+}
+
void Item_subselect::cleanup()
{
DBUG_ENTER("Item_subselect::cleanup");
@@ -232,11 +242,11 @@ bool Item_subselect::const_item() const
return const_item_cache;
}
-Item *Item_subselect::get_tmp_table_item(THD *thd)
+Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
{
if (!with_sum_func && !const_item())
return new Item_field(result_field);
- return copy_or_same(thd);
+ return copy_or_same(thd_arg);
}
void Item_subselect::update_used_tables()
@@ -268,6 +278,26 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
DBUG_VOID_RETURN;
}
+st_select_lex *
+Item_singlerow_subselect::invalidate_and_restore_select_lex()
+{
+ DBUG_ENTER("Item_singlerow_subselect::invalidate_and_restore_select_lex");
+ st_select_lex *result= get_select_lex();
+
+ DBUG_ASSERT(result);
+
+ /*
+ This code restore the parse tree in it's state before the execution of
+ Item_singlerow_subselect::Item_singlerow_subselect(),
+ and in particular decouples this object from the SELECT_LEX,
+ so that the SELECT_LEX can be used with a different flavor
+ or Item_subselect instead, as part of query rewriting.
+ */
+ unit->item= NULL;
+
+ DBUG_RETURN(result);
+}
+
Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
Item_subselect *parent,
st_select_lex *select_lex,
@@ -551,13 +581,13 @@ void Item_exists_subselect::print(String *str)
}
-bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit)
+bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit_arg)
{
- if (unit->fake_select_lex &&
- unit->fake_select_lex->test_limit())
+ if (unit_arg->fake_select_lex &&
+ unit_arg->fake_select_lex->test_limit())
return(1);
- SELECT_LEX *sl= unit->first_select();
+ SELECT_LEX *sl= unit_arg->first_select();
for (; sl; sl= sl->next_select())
{
if (sl->test_limit())
@@ -829,7 +859,6 @@ Item_subselect::trans_res
Item_in_subselect::single_value_transformer(JOIN *join,
Comp_creator *func)
{
- Item_subselect::trans_res result= RES_ERROR;
SELECT_LEX *select_lex= join->select_lex;
DBUG_ENTER("Item_in_subselect::single_value_transformer");
@@ -927,7 +956,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if (!substitution)
{
/* We're invoked for the 1st (or the only) SELECT in the subquery UNION */
- SELECT_LEX_UNIT *unit= select_lex->master_unit();
+ SELECT_LEX_UNIT *master_unit= select_lex->master_unit();
substitution= optimizer;
SELECT_LEX *current= thd->lex->current_select, *up;
@@ -950,7 +979,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
(char *)"<no matter>",
(char *)in_left_expr_name);
- unit->uncacheable|= UNCACHEABLE_DEPENDENT;
+ master_unit->uncacheable|= UNCACHEABLE_DEPENDENT;
}
if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
{
@@ -1149,7 +1178,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
if (!substitution)
{
//first call for this unit
- SELECT_LEX_UNIT *unit= select_lex->master_unit();
+ SELECT_LEX_UNIT *master_unit= select_lex->master_unit();
substitution= optimizer;
SELECT_LEX *current= thd->lex->current_select, *up;
@@ -1165,7 +1194,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
optimizer->keep_top_level_cache();
thd->lex->current_select= current;
- unit->uncacheable|= UNCACHEABLE_DEPENDENT;
+ master_unit->uncacheable|= UNCACHEABLE_DEPENDENT;
if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
{
@@ -1198,7 +1227,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
{
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
if (select_lex->ref_pointer_array[i]->
- check_cols(left_expr->el(i)->cols()))
+ check_cols(left_expr->element_index(i)->cols()))
DBUG_RETURN(RES_ERROR);
Item *item_eq=
new Item_func_eq(new
@@ -1221,7 +1250,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
(char *)"<list ref>")
);
Item *col_item= new Item_cond_or(item_eq, item_isnull);
- if (!abort_on_null && left_expr->el(i)->maybe_null)
+ if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
if (!(col_item= new Item_func_trig_cond(col_item, get_cond_guard(i))))
DBUG_RETURN(RES_ERROR);
@@ -1235,7 +1264,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
ref_pointer_array + i,
(char *)"<no matter>",
(char *)"<list ref>"));
- if (!abort_on_null && left_expr->el(i)->maybe_null)
+ if (!abort_on_null && left_expr->element_index(i)->maybe_null)
{
if (!(item_nnull_test=
new Item_func_trig_cond(item_nnull_test, get_cond_guard(i))))
@@ -1272,7 +1301,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
Item *item, *item_isnull;
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
if (select_lex->ref_pointer_array[i]->
- check_cols(left_expr->el(i)->cols()))
+ check_cols(left_expr->element_index(i)->cols()))
DBUG_RETURN(RES_ERROR);
item=
new Item_func_eq(new
@@ -1312,7 +1341,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
TODO: why we create the above for cases where the right part
cant be NULL?
*/
- if (left_expr->el(i)->maybe_null)
+ if (left_expr->element_index(i)->maybe_null)
{
if (!(item= new Item_func_trig_cond(item, get_cond_guard(i))))
DBUG_RETURN(RES_ERROR);
@@ -1474,14 +1503,14 @@ void Item_in_subselect::print(String *str)
}
-bool Item_in_subselect::fix_fields(THD *thd, Item **ref)
+bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
{
bool result = 0;
- if(thd->lex->view_prepare_mode && left_expr && !left_expr->fixed)
- result = left_expr->fix_fields(thd, &left_expr);
+ if (thd_arg->lex->view_prepare_mode && left_expr && !left_expr->fixed)
+ result = left_expr->fix_fields(thd_arg, &left_expr);
- return result || Item_subselect::fix_fields(thd, ref);
+ return result || Item_subselect::fix_fields(thd_arg, ref);
}
@@ -1520,13 +1549,13 @@ void subselect_engine::set_thd(THD *thd_arg)
subselect_single_select_engine::
subselect_single_select_engine(st_select_lex *select,
- select_subselect *result,
- Item_subselect *item)
- :subselect_engine(item, result),
+ select_subselect *result_arg,
+ Item_subselect *item_arg)
+ :subselect_engine(item_arg, result_arg),
prepared(0), optimized(0), executed(0),
select_lex(select), join(0)
{
- select_lex->master_unit()->item= item;
+ select_lex->master_unit()->item= item_arg;
}
@@ -1763,7 +1792,6 @@ int subselect_single_select_engine::exec()
if (!executed)
{
item->reset_value_registration();
- bool have_changed_access= FALSE;
JOIN_TAB *changed_tabs[MAX_TABLES];
JOIN_TAB **last_changed_tab= changed_tabs;
if (item->have_guarded_conds())
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 25a0326f8b6..6b605e96432 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -126,6 +126,12 @@ public:
virtual void reset_value_registration() {}
enum_parsing_place place() { return parsing_place; }
+ /**
+ Get the SELECT_LEX structure associated with this Item.
+ @return the SELECT_LEX structure associated with this Item
+ */
+ st_select_lex* get_select_lex();
+
friend class select_subselect;
friend class Item_in_optimizer;
friend bool Item_field::fix_fields(THD *, Item **);
@@ -163,12 +169,26 @@ public:
void fix_length_and_dec();
uint cols();
- Item* el(uint i) { return my_reinterpret_cast(Item*)(row[i]); }
+ Item* element_index(uint i) { return my_reinterpret_cast(Item*)(row[i]); }
Item** addr(uint i) { return (Item**)row + i; }
bool check_cols(uint c);
bool null_inside();
void bring_value();
+ /**
+ This method is used to implement a special case of semantic tree
+ rewriting, mandated by a SQL:2003 exception in the specification.
+ The only caller of this method is handle_sql2003_note184_exception(),
+ see the code there for more details.
+ Note that this method breaks the object internal integrity, by
+ removing it's association with the corresponding SELECT_LEX,
+ making this object orphan from the parse tree.
+ No other method, beside the destructor, should be called on this
+ object, as it is now invalid.
+ @return the SELECT_LEX structure that was given in the constructor.
+ */
+ st_select_lex* invalidate_and_restore_select_lex();
+
friend class select_singlerow_subselect;
};
@@ -531,10 +551,10 @@ class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
public:
// constructor can assign THD because it will be called after JOIN::prepare
- subselect_indexsubquery_engine(THD *thd, st_join_table *tab_arg,
+ subselect_indexsubquery_engine(THD *thd_arg, st_join_table *tab_arg,
Item_subselect *subs, Item *where,
Item *having_arg, bool chk_null)
- :subselect_uniquesubquery_engine(thd, tab_arg, subs, where),
+ :subselect_uniquesubquery_engine(thd_arg, tab_arg, subs, where),
check_null(chk_null),
having(having_arg)
{}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 28a9a1f4dbf..41f0dd6496b 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1158,7 +1158,7 @@ double Item_sum_avg::val_real()
my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
{
- my_decimal sum, cnt;
+ my_decimal sum_buff, cnt;
const my_decimal *sum_dec;
DBUG_ASSERT(fixed == 1);
if (!count)
@@ -1166,7 +1166,7 @@ my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
null_value=1;
return NULL;
}
- sum_dec= Item_sum_sum::val_decimal(&sum);
+ sum_dec= Item_sum_sum::val_decimal(&sum_buff);
int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &cnt);
my_decimal_div(E_DEC_FATAL_ERROR, val, sum_dec, &cnt, prec_increment);
return val;
@@ -1609,7 +1609,7 @@ bool Item_sum_min::add()
break;
case DECIMAL_RESULT:
{
- my_decimal value, *val= args[0]->val_decimal(&value);
+ my_decimal value_buff, *val= args[0]->val_decimal(&value_buff);
if (!args[0]->null_value &&
(null_value || (my_decimal_cmp(&sum_dec, val) > 0)))
{
@@ -1673,7 +1673,7 @@ bool Item_sum_max::add()
break;
case DECIMAL_RESULT:
{
- my_decimal value, *val= args[0]->val_decimal(&value);
+ my_decimal value_buff, *val= args[0]->val_decimal(&value_buff);
if (!args[0]->null_value &&
(null_value || (my_decimal_cmp(val, &sum_dec) > 0)))
{
@@ -1838,7 +1838,7 @@ void Item_sum_hybrid::reset_field()
}
case DECIMAL_RESULT:
{
- my_decimal value, *arg_dec= args[0]->val_decimal(&value);
+ my_decimal value_buff, *arg_dec= args[0]->val_decimal(&value_buff);
if (maybe_null)
{
@@ -2466,11 +2466,11 @@ bool Item_sum_count_distinct::setup(THD *thd)
for (tree_key_length= 0; field < field_end; ++field)
{
Field *f= *field;
- enum enum_field_types type= f->type();
+ enum enum_field_types f_type= f->type();
tree_key_length+= f->pack_length();
- if ((type == MYSQL_TYPE_VARCHAR) ||
- !f->binary() && (type == MYSQL_TYPE_STRING ||
- type == MYSQL_TYPE_VAR_STRING))
+ if ((f_type == MYSQL_TYPE_VARCHAR) ||
+ !f->binary() && (f_type == MYSQL_TYPE_STRING ||
+ f_type == MYSQL_TYPE_VAR_STRING))
{
all_binary= FALSE;
break;
@@ -3053,8 +3053,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
void Item_func_group_concat::cleanup()
{
- THD *thd= current_thd;
-
DBUG_ENTER("Item_func_group_concat::cleanup");
Item_sum::cleanup();
@@ -3063,7 +3061,7 @@ void Item_func_group_concat::cleanup()
{
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values);
- warning->set_msg(thd, warn_buff);
+ warning->set_msg(current_thd, warn_buff);
warning= 0;
}
@@ -3093,8 +3091,7 @@ void Item_func_group_concat::cleanup()
warning= 0;
}
}
- DBUG_ASSERT(tree == 0);
- DBUG_ASSERT(warning == 0);
+ DBUG_ASSERT(tree == 0 && warning == 0);
}
DBUG_VOID_RETURN;
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 737064a9713..683cd8803d6 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1167,14 +1167,14 @@ String* Item_func_dayname::val_str(String* str)
{
DBUG_ASSERT(fixed == 1);
uint weekday=(uint) val_int(); // Always Item_func_daynr()
- const char *name;
+ const char *day_name;
THD *thd= current_thd;
if (null_value)
return (String*) 0;
- name= thd->variables.lc_time_names->day_names->type_names[weekday];
- str->set(name, strlen(name), system_charset_info);
+ day_name= thd->variables.lc_time_names->day_names->type_names[weekday];
+ str->set(day_name, strlen(day_name), system_charset_info);
return str;
}
@@ -1608,7 +1608,7 @@ int Item_func_now::save_in_field(Field *to, bool no_conversions)
void Item_func_sysdate_local::store_now_in_TIME(TIME *now_time)
{
THD *thd= current_thd;
- thd->variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL));
+ thd->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) time(NULL));
thd->time_zone_used= 1;
}
@@ -3302,10 +3302,10 @@ bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
{
DATE_TIME_FORMAT date_time_format;
char val_buff[64], format_buff[64];
- String val_str(val_buff, sizeof(val_buff), &my_charset_bin), *val;
+ String val_string(val_buff, sizeof(val_buff), &my_charset_bin), *val;
String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format;
- val= args[0]->val_str(&val_str);
+ val= args[0]->val_str(&val_string);
format= args[1]->val_str(&format_str);
if (args[0]->null_value || args[1]->null_value)
goto null_date;
diff --git a/sql/lock.cc b/sql/lock.cc
index 2afe1de59f5..bf1512b754c 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -566,7 +566,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
for (; haystack; haystack= haystack->next_global)
{
- if (haystack->placeholder() || haystack->schema_table)
+ if (haystack->placeholder())
continue;
table2= haystack->table;
if (table2->s->tmp_table == TMP_TABLE)
diff --git a/sql/log.cc b/sql/log.cc
index 1961a5b6f88..7d0bef5ca2c 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -117,7 +117,7 @@ static int binlog_prepare(THD *thd, bool all)
do nothing.
just pretend we can do 2pc, so that MySQL won't
switch to 1pc.
- real work will be done in MYSQL_LOG::log()
+ real work will be done in MYSQL_LOG::log_xid()
*/
return 0;
}
@@ -131,7 +131,7 @@ static int binlog_commit(THD *thd, bool all)
if (my_b_tell(trans_log) == 0)
{
- // we're here because trans_log was flushed in MYSQL_LOG::log()
+ // we're here because trans_log was flushed in MYSQL_LOG::log_xid()
DBUG_RETURN(0);
}
if (all)
@@ -304,7 +304,7 @@ void setup_windows_event_source()
/* Register EventMessageFile */
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
- (PBYTE) szPath, strlen(szPath)+1);
+ (PBYTE) szPath, (DWORD) (strlen(szPath) + 1));
/* Register supported event types */
dwTypes= (EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
@@ -452,7 +452,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
TODO: The following should be using fn_format(); We just need to
first change fn_format() to cut the file name if it's too long.
*/
- strmake(buff,glob_hostname,FN_REFLEN-5);
+ strmake(buff, pidfile_name,FN_REFLEN-5);
strmov(fn_ext(buff),suffix);
return (const char *)buff;
}
@@ -758,6 +758,8 @@ int MYSQL_LOG::raw_get_current_log(LOG_INFO* linfo)
0 ok
*/
+#ifdef HAVE_REPLICATION
+
static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
{
int bytes_read;
@@ -791,6 +793,7 @@ err:
DBUG_RETURN(1);
}
+#endif /* HAVE_REPLICATION */
/*
Find the position in the log-index-file for the given log name
@@ -1267,8 +1270,6 @@ err:
pthread_mutex_unlock(&LOCK_index);
DBUG_RETURN(error);
}
-
-
#endif /* HAVE_REPLICATION */
@@ -1577,13 +1578,13 @@ bool MYSQL_LOG::flush_and_sync()
return err;
}
-void MYSQL_LOG::start_union_events(THD *thd)
+void MYSQL_LOG::start_union_events(THD *thd, query_id_t query_id_param)
{
DBUG_ASSERT(!thd->binlog_evt_union.do_union);
thd->binlog_evt_union.do_union= TRUE;
thd->binlog_evt_union.unioned_events= FALSE;
thd->binlog_evt_union.unioned_events_trans= FALSE;
- thd->binlog_evt_union.first_query_id= thd->query_id;
+ thd->binlog_evt_union.first_query_id= query_id_param;
}
void MYSQL_LOG::stop_union_events(THD *thd)
@@ -1628,14 +1629,14 @@ bool MYSQL_LOG::write(Log_event *event_info)
*/
if (likely(is_open()))
{
- const char *local_db= event_info->get_db();
IO_CACHE *file= &log_file;
#ifdef HAVE_REPLICATION
/*
- In the future we need to add to the following if tests like
- "do the involved tables match (to be implemented)
- binlog_[wild_]{do|ignore}_table?" (WL#1049)"
+ In the future we need to add to the following if tests like
+ "do the involved tables match (to be implemented)
+ binlog_[wild_]{do|ignore}_table?" (WL#1049)"
*/
+ const char *local_db= event_info->get_db();
if ((thd && !(thd->options & OPTION_BIN_LOG)) ||
(!db_ok(local_db, binlog_do_db, binlog_ignore_db)))
{
@@ -1783,7 +1784,7 @@ void MYSQL_LOG::rotate_and_purge(uint flags)
#ifdef HAVE_REPLICATION
if (expire_logs_days)
{
- long purge_time= time(0) - expire_logs_days*24*60*60;
+ long purge_time= (long) (time(0) - expire_logs_days*24*60*60);
if (purge_time >= 0)
purge_logs_before_date(purge_time);
}
@@ -2523,7 +2524,7 @@ int TC_LOG_MMAP::open(const char *opt_name)
goto err;
if (using_heuristic_recover())
return 1;
- if ((fd= my_create(logname, O_RDWR, 0, MYF(MY_WME))) < 0)
+ if ((fd= my_create(logname, CREATE_MODE, O_RDWR, MYF(MY_WME))) < 0)
goto err;
inited=1;
file_length= opt_tc_log_size;
@@ -2670,21 +2671,34 @@ int TC_LOG_MMAP::overflow()
}
/*
- all access to active page is serialized but it's not a problem, as
- we're assuming that fsync() will be a main bottleneck.
- That is, parallelizing writes to log pages we'll decrease number of
- threads waiting for a page, but then all these threads will be waiting
- for a fsync() anyway
+ Record that transaction XID is committed on the persistent storage
+
+ NOTES
+ This function is called in the middle of two-phase commit:
+ First all resources prepare the transaction, then tc_log->log() is called,
+ then all resources commit the transaction, then tc_log->unlog() is called.
+
+ All access to active page is serialized but it's not a problem, as
+ we're assuming that fsync() will be a main bottleneck.
+ That is, parallelizing writes to log pages we'll decrease number of
+ threads waiting for a page, but then all these threads will be waiting
+ for a fsync() anyway
+
+ IMPLEMENTATION
+ If tc_log == MYSQL_LOG then tc_log writes transaction to binlog and
+ records XID in a special Xid_log_event.
+ If tc_log = TC_LOG_MMAP then xid is written in a special memory-mapped
+ log.
RETURN
- 0 - error
- otherwise - "cookie", a number that will be passed as an argument
- to unlog() call. tc_log can define it any way it wants,
- and use for whatever purposes. TC_LOG_MMAP sets it
- to the position in memory where xid was logged to.
+ 0 Error
+ # "cookie", a number that will be passed as an argument
+ to unlog() call. tc_log can define it any way it wants,
+ and use for whatever purposes. TC_LOG_MMAP sets it
+ to the position in memory where xid was logged to.
*/
-int TC_LOG_MMAP::log(THD *thd, my_xid xid)
+int TC_LOG_MMAP::log_xid(THD *thd, my_xid xid)
{
int err;
PAGE *p;
@@ -2793,6 +2807,7 @@ int TC_LOG_MMAP::sync()
erase xid from the page, update page free space counters/pointers.
cookie points directly to the memory where xid was logged
*/
+
void TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
{
PAGE *p=pages+(cookie/tc_log_page_size);
@@ -3035,7 +3050,7 @@ void TC_LOG_BINLOG::close()
0 - error
1 - success
*/
-int TC_LOG_BINLOG::log(THD *thd, my_xid xid)
+int TC_LOG_BINLOG::log_xid(THD *thd, my_xid xid)
{
Xid_log_event xle(thd, xid);
IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot];
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 657fd510e78..dbf69acf70a 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -269,11 +269,14 @@ append_query_string(CHARSET_INFO *csinfo,
}
#endif
+
/*
Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
commands just before it prints a query.
*/
+#ifdef MYSQL_CLIENT
+
static void print_set_option(FILE* file, uint32 bits_changed, uint32 option,
uint32 flags, const char* name, bool* need_comma)
{
@@ -285,6 +288,7 @@ static void print_set_option(FILE* file, uint32 bits_changed, uint32 option,
*need_comma= 1;
}
}
+#endif
/**************************************************************************
Log_event methods (= the parent class of all events)
@@ -1088,7 +1092,8 @@ bool Query_log_event::write(IO_CACHE* file)
1+4+ // code of autoinc and the 2 autoinc variables
1+6+ // code of charset and charset
1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name
- 1+2 // code of lc_time_names and lc_time_names_number
+ 1+2+ // code of lc_time_names and lc_time_names_number
+ 1+2 // code of charset_database and charset_database_number
], *start, *start_of_status;
ulong event_length;
@@ -1207,6 +1212,13 @@ bool Query_log_event::write(IO_CACHE* file)
int2store(start, lc_time_names_number);
start+= 2;
}
+ if (charset_database_number)
+ {
+ DBUG_ASSERT(charset_database_number <= 0xFFFF);
+ *start++= Q_CHARSET_DATABASE_CODE;
+ int2store(start, charset_database_number);
+ start+= 2;
+ }
/*
Here there could be code like
if (command-line-option-which-says-"log_this_variable" && inited)
@@ -1272,7 +1284,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
sql_mode(thd_arg->variables.sql_mode),
auto_increment_increment(thd_arg->variables.auto_increment_increment),
auto_increment_offset(thd_arg->variables.auto_increment_offset),
- lc_time_names_number(thd_arg->variables.lc_time_names->number)
+ lc_time_names_number(thd_arg->variables.lc_time_names->number),
+ charset_database_number(0)
{
time_t end_time;
time(&end_time);
@@ -1280,6 +1293,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
catalog_len = (catalog) ? (uint32) strlen(catalog) : 0;
/* status_vars_len is set just before writing the event */
db_len = (db) ? (uint32) strlen(db) : 0;
+ if (thd_arg->variables.collation_database != thd_arg->db_charset)
+ charset_database_number= thd_arg->variables.collation_database->number;
+
/*
If we don't use flags2 for anything else than options contained in
thd->options, it would be more efficient to flags2=thd_arg->options
@@ -1350,7 +1366,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
db(NullS), catalog_len(0), status_vars_len(0),
flags2_inited(0), sql_mode_inited(0), charset_inited(0),
auto_increment_increment(1), auto_increment_offset(1),
- time_zone_len(0), lc_time_names_number(0)
+ time_zone_len(0), lc_time_names_number(0), charset_database_number(0)
{
ulong data_len;
uint32 tmp;
@@ -1455,6 +1471,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
lc_time_names_number= uint2korr(pos);
pos+= 2;
break;
+ case Q_CHARSET_DATABASE_CODE:
+ charset_database_number= uint2korr(pos);
+ pos+= 2;
+ break;
default:
/* That's why you must write status vars in growing order of code */
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
@@ -1652,6 +1672,16 @@ void Query_log_event::print_query_header(FILE* file,
lc_time_names_number, print_event_info->delimiter);
print_event_info->lc_time_names_number= lc_time_names_number;
}
+ if (charset_database_number != print_event_info->charset_database_number)
+ {
+ if (charset_database_number)
+ fprintf(file, "SET @@session.collation_database=%d%s\n",
+ charset_database_number, print_event_info->delimiter);
+ else
+ fprintf(file, "SET @@session.collation_database=DEFAULT%s\n",
+ print_event_info->delimiter);
+ print_event_info->charset_database_number= charset_database_number;
+ }
}
@@ -1817,7 +1847,21 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli,
}
else
thd->variables.lc_time_names= &my_locale_en_US;
-
+ if (charset_database_number)
+ {
+ CHARSET_INFO *cs;
+ if (!(cs= get_charset(charset_database_number, MYF(0))))
+ {
+ char buf[20];
+ int10_to_str((int) charset_database_number, buf, -10);
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
+ goto compare_errors;
+ }
+ thd->variables.collation_database= cs;
+ }
+ else
+ thd->variables.collation_database= thd->db_charset;
+
/* Execute the query (note that we bypass dispatch_command()) */
mysql_parse(thd, thd->query, thd->query_length);
@@ -2047,6 +2091,8 @@ Start_log_event_v3::Start_log_event_v3(const char* buf,
binlog_version= uint2korr(buf+ST_BINLOG_VER_OFFSET);
memcpy(server_version, buf+ST_SERVER_VER_OFFSET,
ST_SERVER_VER_LEN);
+ // prevent overrun if log is corrupted on disk
+ server_version[ST_SERVER_VER_LEN-1]= 0;
created= uint4korr(buf+ST_CREATED_OFFSET);
/* We use log_pos to mark if this was an artificial event or not */
artificial_event= (log_pos == 0);
@@ -2170,6 +2216,8 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
switch (binlog_ver) {
case 4: /* MySQL 5.0 */
memcpy(server_version, ::server_version, ST_SERVER_VER_LEN);
+ DBUG_EXECUTE_IF("pretend_version_50034_in_binlog",
+ strmov(server_version, "5.0.34"););
common_header_len= LOG_EVENT_HEADER_LEN;
number_of_event_types= LOG_EVENT_TYPES;
/* we'll catch my_malloc() error in is_valid() */
@@ -2241,6 +2289,7 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
post_header_len= 0; /* will make is_valid() fail */
break;
}
+ calc_server_version_split();
}
@@ -2280,6 +2329,7 @@ Format_description_log_event(const char* buf,
post_header_len= (uint8*) my_memdup((byte*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
number_of_event_types*
sizeof(*post_header_len), MYF(0));
+ calc_server_version_split();
DBUG_VOID_RETURN;
}
@@ -2380,6 +2430,37 @@ int Format_description_log_event::exec_event(struct st_relay_log_info* rli)
}
#endif
+
+/**
+ Splits the event's 'server_version' string into three numeric pieces stored
+ into 'server_version_split':
+ X.Y.Zabc (X,Y,Z numbers, a not a digit) -> {X,Y,Z}
+ X.Yabc -> {X,Y,0}
+ Xabc -> {X,0,0}
+ 'server_version_split' is then used for lookups to find if the server which
+ created this event has some known bug.
+*/
+void Format_description_log_event::calc_server_version_split()
+{
+ char *p= server_version, *r;
+ ulong number;
+ for (uint i= 0; i<=2; i++)
+ {
+ number= strtoul(p, &r, 10);
+ server_version_split[i]= (uchar)number;
+ DBUG_ASSERT(number < 256); // fit in uchar
+ p= r;
+ DBUG_ASSERT(!((i == 0) && (*r != '.'))); // should be true in practice
+ if (*r == '.')
+ p++; // skip the dot
+ }
+ DBUG_PRINT("info",("Format_description_log_event::server_version_split:"
+ " '%s' %d %d %d", server_version,
+ server_version_split[0],
+ server_version_split[1], server_version_split[2]));
+}
+
+
/**************************************************************************
Load_log_event methods
General note about Load_log_event: the binlogging of LOAD DATA INFILE is
@@ -3033,10 +3114,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
ex.skip_lines = skip_lines;
List<Item> field_list;
- thd->main_lex.select_lex.context.resolve_in_table_list_only(&tables);
- set_fields(tables.db, field_list, &thd->main_lex.select_lex.context);
+ thd->lex->select_lex.context.resolve_in_table_list_only(&tables);
+ set_fields(tables.db, field_list, &thd->lex->select_lex.context);
thd->variables.pseudo_thread_id= thread_id;
- List<Item> set_fields;
if (net)
{
// mysql_load will use thd->net to read the file
@@ -3047,10 +3127,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
thd->net.pkt_nr = net->pkt_nr;
}
/*
- It is safe to use set_fields twice because we are not going to
+ It is safe to use tmp_list twice because we are not going to
update it inside mysql_load().
*/
- if (mysql_load(thd, &ex, &tables, field_list, set_fields, set_fields,
+ List<Item> tmp_list;
+ if (mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list,
handle_dup, ignore, net != 0))
thd->query_error= 1;
if (thd->cuted_fields)
diff --git a/sql/log_event.h b/sql/log_event.h
index fd2a5e5fb63..a1e7adb6487 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -272,6 +272,7 @@ struct sql_ex_info
#define Q_LC_TIME_NAMES_CODE 7
+#define Q_CHARSET_DATABASE_CODE 8
/* Intvar event post-header */
#define I_TYPE_OFFSET 0
@@ -509,10 +510,11 @@ typedef struct st_print_event_info
char charset[6]; // 3 variables, each of them storable in 2 bytes
char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
uint lc_time_names_number;
+ uint charset_database_number;
st_print_event_info()
:flags2_inited(0), sql_mode_inited(0),
auto_increment_increment(1),auto_increment_offset(1), charset_inited(0),
- lc_time_names_number(0)
+ lc_time_names_number(0), charset_database_number(0)
{
/*
Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
@@ -797,6 +799,7 @@ public:
uint time_zone_len; /* 0 means uninited */
const char *time_zone_str;
uint lc_time_names_number; /* 0 means en_US */
+ uint charset_database_number;
#ifndef MYSQL_CLIENT
@@ -854,6 +857,8 @@ public:
bool write(IO_CACHE* file) { return(false); };
virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
+#else
+ Muted_query_log_event() {}
#endif
};
@@ -1102,6 +1107,7 @@ public:
uint8 number_of_event_types;
/* The list of post-headers' lengthes */
uint8 *post_header_len;
+ uchar server_version_split[3];
Format_description_log_event(uint8 binlog_ver, const char* server_ver=0);
@@ -1133,6 +1139,7 @@ public:
*/
return FORMAT_DESCRIPTION_HEADER_LEN;
}
+ void calc_server_version_split();
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index e5877e8ed1f..88bd8576965 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -60,10 +60,10 @@ typedef ulonglong nested_join_map;
/* query_id */
typedef ulonglong query_id_t;
-extern query_id_t query_id;
+extern query_id_t global_query_id;
/* increment query_id and return it. */
-inline query_id_t next_query_id() { return query_id++; }
+inline query_id_t next_query_id() { return global_query_id++; }
/* useful constants */
extern const key_map key_map_empty;
@@ -97,6 +97,18 @@ void net_set_read_timeout(NET *net, uint timeout);
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define all_bits_set(A,B) ((A) & (B) != (B))
+#define WARN_DEPRECATED(Thd,Ver,Old,New) \
+ do { \
+ DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \
+ if (((gptr)Thd) != NULL) \
+ push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
+ ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX), \
+ (Old), (Ver), (New)); \
+ else \
+ sql_print_warning("The syntax %s is deprecated and will be removed " \
+ "in MySQL %s. Please use %s instead.", (Old), (Ver), (New)); \
+ } while(0)
+
extern CHARSET_INFO *system_charset_info, *files_charset_info ;
extern CHARSET_INFO *national_charset_info, *table_alias_charset;
@@ -163,7 +175,7 @@ MY_LOCALE *my_locale_by_number(uint number);
Feel free to raise this by the smallest amount you can to get the
"execution_constants" test to pass.
*/
-#define STACK_MIN_SIZE 10788 // Abort if less stack during eval.
+#define STACK_MIN_SIZE 12000 // Abort if less stack during eval.
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
#define STACK_BUFF_ALLOC 256 // For stack overrun checks
@@ -306,55 +318,55 @@ MY_LOCALE *my_locale_by_number(uint number);
TODO: separate three contexts above, move them to separate bitfields.
*/
-#define SELECT_DISTINCT (1ULL << 0) // SELECT, user
-#define SELECT_STRAIGHT_JOIN (1ULL << 1) // SELECT, user
-#define SELECT_DESCRIBE (1ULL << 2) // SELECT, user
-#define SELECT_SMALL_RESULT (1ULL << 3) // SELECT, user
-#define SELECT_BIG_RESULT (1ULL << 4) // SELECT, user
-#define OPTION_FOUND_ROWS (1ULL << 5) // SELECT, user
-#define OPTION_TO_QUERY_CACHE (1ULL << 6) // SELECT, user
-#define SELECT_NO_JOIN_CACHE (1ULL << 7) // intern
-#define OPTION_BIG_TABLES (1ULL << 8) // THD, user
-#define OPTION_BIG_SELECTS (1ULL << 9) // THD, user
-#define OPTION_LOG_OFF (1ULL << 10) // THD, user
-#define OPTION_UPDATE_LOG (1ULL << 11) // THD, user, unused
-#define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern
-#define OPTION_WARNINGS (1ULL << 13) // THD, user
-#define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog
-#define OPTION_FOUND_COMMENT (1ULL << 15) // SELECT, intern, parser
-#define OPTION_SAFE_UPDATES (1ULL << 16) // THD, user
-#define OPTION_BUFFER_RESULT (1ULL << 17) // SELECT, user
-#define OPTION_BIN_LOG (1ULL << 18) // THD, user
-#define OPTION_NOT_AUTOCOMMIT (1ULL << 19) // THD, user
-#define OPTION_BEGIN (1ULL << 20) // THD, intern
-#define OPTION_TABLE_LOCK (1ULL << 21) // THD, intern
-#define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE)
-#define OPTION_QUOTE_SHOW_CREATE (1ULL << 23) // THD, user
+#define SELECT_DISTINCT (ULL(1) << 0) // SELECT, user
+#define SELECT_STRAIGHT_JOIN (ULL(1) << 1) // SELECT, user
+#define SELECT_DESCRIBE (ULL(1) << 2) // SELECT, user
+#define SELECT_SMALL_RESULT (ULL(1) << 3) // SELECT, user
+#define SELECT_BIG_RESULT (ULL(1) << 4) // SELECT, user
+#define OPTION_FOUND_ROWS (ULL(1) << 5) // SELECT, user
+#define OPTION_TO_QUERY_CACHE (ULL(1) << 6) // SELECT, user
+#define SELECT_NO_JOIN_CACHE (ULL(1) << 7) // intern
+#define OPTION_BIG_TABLES (ULL(1) << 8) // THD, user
+#define OPTION_BIG_SELECTS (ULL(1) << 9) // THD, user
+#define OPTION_LOG_OFF (ULL(1) << 10) // THD, user
+#define OPTION_UPDATE_LOG (ULL(1) << 11) // THD, user, unused
+#define TMP_TABLE_ALL_COLUMNS (ULL(1) << 12) // SELECT, intern
+#define OPTION_WARNINGS (ULL(1) << 13) // THD, user
+#define OPTION_AUTO_IS_NULL (ULL(1) << 14) // THD, user, binlog
+#define OPTION_FOUND_COMMENT (ULL(1) << 15) // SELECT, intern, parser
+#define OPTION_SAFE_UPDATES (ULL(1) << 16) // THD, user
+#define OPTION_BUFFER_RESULT (ULL(1) << 17) // SELECT, user
+#define OPTION_BIN_LOG (ULL(1) << 18) // THD, user
+#define OPTION_NOT_AUTOCOMMIT (ULL(1) << 19) // THD, user
+#define OPTION_BEGIN (ULL(1) << 20) // THD, intern
+#define OPTION_TABLE_LOCK (ULL(1) << 21) // THD, intern
+#define OPTION_QUICK (ULL(1) << 22) // SELECT (for DELETE)
+#define OPTION_QUOTE_SHOW_CREATE (ULL(1) << 23) // THD, user
/* Thr following is used to detect a conflict with DISTINCT
in the user query has requested */
-#define SELECT_ALL (1ULL << 24) // SELECT, user, parser
+#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser
/* Set if we are updating a non-transaction safe table */
-#define OPTION_STATUS_NO_TRANS_UPDATE (1ULL << 25) // THD, intern
+#define OPTION_STATUS_NO_TRANS_UPDATE (ULL(1) << 25) // THD, intern
/* The following can be set when importing tables in a 'wrong order'
to suppress foreign key checks */
-#define OPTION_NO_FOREIGN_KEY_CHECKS (1ULL << 26) // THD, user, binlog
+#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog
/* The following speeds up inserts to InnoDB tables by suppressing unique
key checks in some cases */
-#define OPTION_RELAXED_UNIQUE_CHECKS (1ULL << 27) // THD, user, binlog
-#define SELECT_NO_UNLOCK (1ULL << 28) // SELECT, intern
-#define OPTION_SCHEMA_TABLE (1ULL << 29) // SELECT, intern
+#define OPTION_RELAXED_UNIQUE_CHECKS (ULL(1) << 27) // THD, user, binlog
+#define SELECT_NO_UNLOCK (ULL(1) << 28) // SELECT, intern
+#define OPTION_SCHEMA_TABLE (ULL(1) << 29) // SELECT, intern
/* Flag set if setup_tables already done */
-#define OPTION_SETUP_TABLES_DONE (1ULL << 30) // intern
+#define OPTION_SETUP_TABLES_DONE (ULL(1) << 30) // intern
/* If not set then the thread will ignore all warnings with level notes. */
-#define OPTION_SQL_NOTES (1ULL << 31) // THD, user
+#define OPTION_SQL_NOTES (ULL(1) << 31) // THD, user
/*
Force the used temporary table to be a MyISAM table (because we will use
fulltext functions when reading from it.
*/
-#define TMP_TABLE_FORCE_MYISAM (1ULL << 32)
+#define TMP_TABLE_FORCE_MYISAM (ULL(1) << 32)
/*
@@ -1009,9 +1021,29 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
table_map read_tables, COND *conds,
bool allow_null_cond, int *error);
extern Item **not_found_item;
+
+/*
+ This enumeration type is used only by the function find_item_in_list
+ to return the info on how an item has been resolved against a list
+ of possibly aliased items.
+ The item can be resolved:
+ - against an alias name of the list's element (RESOLVED_AGAINST_ALIAS)
+ - against non-aliased field name of the list (RESOLVED_WITH_NO_ALIAS)
+ - against an aliased field name of the list (RESOLVED_BEHIND_ALIAS)
+ - ignoring the alias name in cases when SQL requires to ignore aliases
+ (e.g. when the resolved field reference contains a table name or
+ when the resolved item is an expression) (RESOLVED_IGNORING_ALIAS)
+*/
+enum enum_resolution_type {
+ NOT_RESOLVED=0,
+ RESOLVED_IGNORING_ALIAS,
+ RESOLVED_BEHIND_ALIAS,
+ RESOLVED_WITH_NO_ALIAS,
+ RESOLVED_AGAINST_ALIAS
+};
Item ** find_item_in_list(Item *item, List<Item> &items, uint *counter,
find_item_error_report_type report_error,
- bool *unaliased);
+ enum_resolution_type *resolution);
bool get_key_map_from_key_list(key_map *map, TABLE *table,
List<String> *index_list);
bool insert_fields(THD *thd, Name_resolution_context *context,
@@ -1067,7 +1099,8 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
st_table_list *TABLE_LIST::*link,
const char *db_name,
const char *table_name);
-TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list);
+TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
+ bool check_alias);
TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name);
bool close_temporary_table(THD *thd, const char *db, const char *table_name);
void close_temporary(TABLE *table, bool delete_table);
@@ -1204,7 +1237,7 @@ void my_dbopt_free(void);
External variables
*/
-extern time_t start_time;
+extern time_t server_start_time;
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[],
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
@@ -1277,6 +1310,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
+extern char* opt_secure_file_priv;
extern my_bool opt_log_slow_admin_statements;
extern my_bool sp_automatic_privileges, opt_noacl;
extern my_bool opt_old_style_user_limits, trust_function_creators;
@@ -1385,7 +1419,7 @@ extern handlerton myisammrg_hton;
#define have_merge_db myisammrg_hton.state
extern SHOW_COMP_OPTION have_isam;
-extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_dlopen;
+extern SHOW_COMP_OPTION have_raid, have_ssl, have_symlink, have_dlopen;
extern SHOW_COMP_OPTION have_query_cache;
extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
extern SHOW_COMP_OPTION have_crypt;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5a805b586fd..99d66134405 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -319,9 +319,14 @@ static char *my_bind_addr_str;
static char *default_collation_name;
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
static char mysql_data_home_buff[2];
-static struct passwd *user_info;
static I_List<THD> thread_cache;
+#ifndef EMBEDDED_LIBRARY
+static struct passwd *user_info;
+static pthread_t select_thread;
+static uint thr_kill_signal;
+#endif
+
static pthread_cond_t COND_thread_cache, COND_flush_thread_cache;
#ifdef HAVE_BERKELEY_DB
@@ -350,6 +355,8 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
my_bool opt_innodb;
+bool slave_warning_issued = false;
+
#ifdef HAVE_NDBCLUSTER_DB
const char *opt_ndbcluster_connectstring= 0;
const char *opt_ndb_connectstring= 0;
@@ -363,6 +370,7 @@ ulong opt_ndb_nodeid;
my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
+char* opt_secure_file_priv= 0;
my_bool opt_log_slow_admin_statements= 0;
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
@@ -395,7 +403,7 @@ ulong slave_net_timeout, slave_trans_retries;
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
ulong query_cache_size=0;
ulong refresh_version, flush_version; /* Increments on each reload */
-query_id_t query_id;
+query_id_t global_query_id;
ulong aborted_threads, aborted_connects;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
@@ -427,7 +435,7 @@ ulong rpl_recovery_rank=0;
double log_10[32]; /* 10 potences */
double log_01[32];
-time_t start_time;
+time_t server_start_time;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
char *default_tz_name;
@@ -488,7 +496,7 @@ CHARSET_INFO *national_charset_info, *table_alias_charset;
CHARSET_INFO *character_set_filesystem;
SHOW_COMP_OPTION have_isam;
-SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache;
+SHOW_COMP_OPTION have_raid, have_ssl, have_symlink, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys, have_dlopen;
SHOW_COMP_OPTION have_crypt, have_compress;
@@ -518,7 +526,6 @@ rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
pthread_cond_t COND_refresh,COND_thread_count, COND_global_read_lock;
pthread_t signal_thread;
pthread_attr_t connection_attrib;
-static uint thr_kill_signal;
File_parser_dummy_hook file_parser_dummy_hook;
@@ -546,7 +553,6 @@ static char **defaults_argv;
static char *opt_bin_logname;
static my_socket unix_sock,ip_sock;
-static pthread_t select_thread;
struct rand_struct sql_rand; // used by sql_class.cc:THD::THD()
/* OS specific variables */
@@ -629,7 +635,6 @@ struct st_VioSSLFd *ssl_acceptor_fd;
/* Function declarations */
-static void start_signal_handler(void);
pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void);
static void get_options(int argc,char **argv);
@@ -640,7 +645,6 @@ static void fix_paths(void);
pthread_handler_t handle_connections_sockets(void *arg);
pthread_handler_t kill_server_thread(void *arg);
static void bootstrap(FILE *file);
-static void close_server_sock();
static bool read_init_file(char *file_name);
#ifdef __NT__
pthread_handler_t handle_connections_namedpipes(void *arg);
@@ -651,10 +655,16 @@ pthread_handler_t handle_connections_shared_memory(void *arg);
pthread_handler_t handle_slave(void *arg);
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
static void clean_up(bool print_message);
+static int test_if_case_insensitive(const char *dir_name);
+
+#ifndef EMBEDDED_LIBRARY
+static void start_signal_handler(void);
+static void close_server_sock();
static void clean_up_mutexes(void);
static void wait_for_signal_thread_to_end(void);
-static int test_if_case_insensitive(const char *dir_name);
static void create_pid_file();
+#endif
+
#ifndef EMBEDDED_LIBRARY
/****************************************************************************
@@ -843,7 +853,6 @@ static void close_connections(void)
DBUG_PRINT("quit",("close_connections thread"));
DBUG_VOID_RETURN;
}
-#endif /*EMBEDDED_LIBRARY*/
static void close_server_sock()
@@ -886,12 +895,14 @@ static void close_server_sock()
#endif
}
+#endif /*EMBEDDED_LIBRARY*/
+
void kill_mysql(void)
{
DBUG_ENTER("kill_mysql");
-#ifdef SIGNALS_DONT_BREAK_READ
+#if defined(SIGNALS_DONT_BREAK_READ) && !defined(EMBEDDED_LIBRARY)
abort_loop=1; // Break connection loops
close_server_sock(); // Force accept to wake up
#endif
@@ -971,7 +982,7 @@ static void __cdecl kill_server(int sig_ptr)
kill_in_progress=TRUE;
abort_loop=1; // This should be set
if (sig != 0) // 0 is not a valid signal number
- my_sigset(sig,SIG_IGN);
+ my_sigset(sig, SIG_IGN); /* purify inspected */
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname);
else
@@ -1144,6 +1155,7 @@ void clean_up(bool print_message)
#endif
x_free(opt_bin_logname);
x_free(opt_relay_logname);
+ x_free(opt_secure_file_priv);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
@@ -1192,6 +1204,8 @@ void clean_up(bool print_message)
} /* clean_up */
+#ifndef EMBEDDED_LIBRARY
+
/*
This is mainly needed when running with purify, but it's still nice to
know that all child threads have died when mysqld exits
@@ -1260,6 +1274,9 @@ static void clean_up_mutexes()
(void) pthread_cond_destroy(&COND_manager);
}
+#endif /*EMBEDDED_LIBRARY*/
+
+
/****************************************************************************
** Init IP and UNIX socket
****************************************************************************/
@@ -1294,7 +1311,7 @@ static void set_ports()
static struct passwd *check_user(const char *user)
{
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
- struct passwd *user_info;
+ struct passwd *tmp_user_info;
uid_t user_id= geteuid();
// Don't bother if we aren't superuser
@@ -1302,12 +1319,14 @@ static struct passwd *check_user(const char *user)
{
if (user)
{
- // Don't give a warning, if real user is same as given with --user
- user_info= getpwnam(user);
- if ((!user_info || user_id != user_info->pw_uid) &&
+ /* Don't give a warning, if real user is same as given with --user */
+ /* purecov: begin tested */
+ tmp_user_info= getpwnam(user);
+ if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
global_system_variables.log_warnings)
sql_print_warning(
"One can only use the --user switch if running as root\n");
+ /* purecov: end */
}
return NULL;
}
@@ -1320,23 +1339,25 @@ static struct passwd *check_user(const char *user)
}
return NULL;
}
+ /* purecov: begin tested */
if (!strcmp(user,"root"))
return NULL; // Avoid problem with dynamic libraries
- if (!(user_info= getpwnam(user)))
+ if (!(tmp_user_info= getpwnam(user)))
{
// Allow a numeric uid to be used
const char *pos;
for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ;
if (*pos) // Not numeric id
goto err;
- if (!(user_info= getpwuid(atoi(user))))
+ if (!(tmp_user_info= getpwuid(atoi(user))))
goto err;
else
- return user_info;
+ return tmp_user_info;
}
else
- return user_info;
+ return tmp_user_info;
+ /* purecov: end */
err:
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
@@ -1345,10 +1366,11 @@ err:
return NULL;
}
-static void set_user(const char *user, struct passwd *user_info)
+static void set_user(const char *user, struct passwd *user_info_arg)
{
+ /* purecov: begin tested */
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
- DBUG_ASSERT(user_info != 0);
+ DBUG_ASSERT(user_info_arg != 0);
#ifdef HAVE_INITGROUPS
/*
We can get a SIGSEGV when calling initgroups() on some systems when NSS
@@ -1357,33 +1379,34 @@ static void set_user(const char *user, struct passwd *user_info)
output a specific message to help the user resolve this problem.
*/
calling_initgroups= TRUE;
- initgroups((char*) user, user_info->pw_gid);
+ initgroups((char*) user, user_info_arg->pw_gid);
calling_initgroups= FALSE;
#endif
- if (setgid(user_info->pw_gid) == -1)
+ if (setgid(user_info_arg->pw_gid) == -1)
{
sql_perror("setgid");
unireg_abort(1);
}
- if (setuid(user_info->pw_uid) == -1)
+ if (setuid(user_info_arg->pw_uid) == -1)
{
sql_perror("setuid");
unireg_abort(1);
}
#endif
+ /* purecov: end */
}
-static void set_effective_user(struct passwd *user_info)
+static void set_effective_user(struct passwd *user_info_arg)
{
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
- DBUG_ASSERT(user_info != 0);
- if (setregid((gid_t)-1, user_info->pw_gid) == -1)
+ DBUG_ASSERT(user_info_arg != 0);
+ if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1)
{
sql_perror("setregid");
unireg_abort(1);
}
- if (setreuid((uid_t)-1, user_info->pw_uid) == -1)
+ if (setreuid((uid_t)-1, user_info_arg->pw_uid) == -1)
{
sql_perror("setreuid");
unireg_abort(1);
@@ -1577,18 +1600,6 @@ static void network_init(void)
#endif /*!EMBEDDED_LIBRARY*/
-void MYSQLerror(const char *s)
-{
- THD *thd=current_thd;
- char *yytext= (char*) thd->lex->tok_start;
- /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
- if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
- s=ER(ER_SYNTAX_ERROR);
- my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
- (yytext ? (char*) yytext : ""),
- thd->lex->yylineno);
-}
-
#ifndef EMBEDDED_LIBRARY
/*
@@ -1670,6 +1681,12 @@ void end_thread(THD *thd, bool put_in_cache)
thd->real_id=pthread_self();
thd->thread_stack= (char*) &thd; // For store_globals
(void) thd->store_globals();
+ /*
+ THD::mysys_var::abort is associated with physical thread rather
+ than with THD object. So we need to reset this flag before using
+ this thread for handling of new THD object/connection.
+ */
+ thd->mysys_var->abort= 0;
thd->thr_create_time= time(NULL);
threads.append(thd);
pthread_mutex_unlock(&LOCK_thread_count);
@@ -1730,6 +1747,7 @@ extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
the signal thread is ready before continuing
******************************************************************************/
+
#if defined(__WIN__) || defined(OS2)
static void init_signals(void)
{
@@ -1970,6 +1988,7 @@ static void init_signals(void)
}
+
static void start_signal_handler(void)
{
// Save vm id of this process
@@ -2021,6 +2040,7 @@ static void init_signals(void)
signal_thread = pthread_self();
}
+
static void start_signal_handler(void)
{}
@@ -2035,7 +2055,10 @@ static void check_data_home(const char *path)
extern "C" sig_handler handle_segfault(int sig)
{
+ time_t curr_time;
+ struct tm tm;
THD *thd=current_thd;
+
/*
Strictly speaking, one needs a mutex here
but since we have got SIGSEGV already, things are a mess
@@ -2049,11 +2072,17 @@ extern "C" sig_handler handle_segfault(int sig)
}
segfaulted = 1;
+
+ curr_time= time(NULL);
+ localtime_r(&curr_time, &tm);
+
fprintf(stderr,"\
-mysqld got signal %d;\n\
+%02d%02d%02d %2d:%02d:%02d - mysqld got signal %d;\n\
This could be because you hit a bug. It is also possible that this binary\n\
or one of the libraries it was linked against is corrupt, improperly built,\n\
or misconfigured. This error can also be caused by malfunctioning hardware.\n",
+ tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
sig);
fprintf(stderr, "\
We will try our best to scrape up some info that will hopefully help diagnose\n\
@@ -2143,6 +2172,8 @@ bugs.\n");
#define SA_NODEFER 0
#endif
+#ifndef EMBEDDED_LIBRARY
+
static void init_signals(void)
{
sigset_t set;
@@ -2221,7 +2252,6 @@ static void init_signals(void)
}
-#ifndef EMBEDDED_LIBRARY
static void start_signal_handler(void)
{
int error;
@@ -2385,11 +2415,11 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
}
return(0); /* purecov: deadcode */
}
-#endif /*!EMBEDDED_LIBRARY*/
static void check_data_home(const char *path)
{}
+#endif /*!EMBEDDED_LIBRARY*/
#endif /* __WIN__*/
@@ -2412,6 +2442,14 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
*/
if ((thd= current_thd))
{
+ /*
+ TODO: There are two exceptions mechanism (THD and sp_rcontext),
+ this could be improved by having a common stack of handlers.
+ */
+ if (thd->handle_error(error,
+ MYSQL_ERROR::WARN_LEVEL_ERROR))
+ DBUG_RETURN(0);
+
if (thd->spcont &&
thd->spcont->handle_error(error, MYSQL_ERROR::WARN_LEVEL_ERROR, thd))
{
@@ -2452,6 +2490,7 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
}
+#ifndef EMBEDDED_LIBRARY
static void *my_str_malloc_mysqld(size_t size)
{
return my_malloc(size, MYF(MY_FAE));
@@ -2462,6 +2501,7 @@ static void my_str_free_mysqld(void *ptr)
{
my_free((gptr)ptr, MYF(MY_FAE));
}
+#endif /* EMBEDDED_LIBRARY */
#ifdef __WIN__
@@ -2594,7 +2634,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
tzset(); // Set tzname
max_system_variables.pseudo_thread_id= (ulong)~0;
- start_time=time((time_t*) 0);
+ server_start_time= time((time_t*) 0);
if (init_thread_environment())
return 1;
mysql_init_variables();
@@ -2610,7 +2650,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
#ifdef HAVE_TZNAME
{
struct tm tm_tmp;
- localtime_r(&start_time,&tm_tmp);
+ localtime_r(&server_start_time,&tm_tmp);
strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
sizeof(system_time_zone)-1);
@@ -2634,9 +2674,15 @@ static int init_common_variables(const char *conf_file_name, int argc,
mysql_slow_log.init_pthread_objects();
mysql_bin_log.init_pthread_objects();
- if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
- strmov(glob_hostname,"mysql");
- strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
+ if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
+ {
+ strmake(glob_hostname, STRING_WITH_LEN("localhost"));
+ sql_print_warning("gethostname failed, using '%s' as hostname",
+ glob_hostname);
+ strmake(pidfile_name, STRING_WITH_LEN("mysql"));
+ }
+ else
+ strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
load_defaults(conf_file_name, groups, &argc, &argv);
@@ -2722,10 +2768,33 @@ static int init_common_variables(const char *conf_file_name, int argc,
#ifdef USE_REGEX
my_regex_init(&my_charset_latin1);
#endif
- if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
- MY_CS_PRIMARY,
- MYF(MY_WME))))
- return 1;
+ /*
+ Process a comma-separated character set list and choose
+ the first available character set. This is mostly for
+ test purposes, to be able to start "mysqld" even if
+ the requested character set is not available (see bug#18743).
+ */
+ for (;;)
+ {
+ char *next_character_set_name= strchr(default_character_set_name, ',');
+ if (next_character_set_name)
+ *next_character_set_name++= '\0';
+ if (!(default_charset_info=
+ get_charset_by_csname(default_character_set_name,
+ MY_CS_PRIMARY, MYF(MY_WME))))
+ {
+ if (next_character_set_name)
+ {
+ default_character_set_name= next_character_set_name;
+ default_collation_name= 0; // Ignore collation
+ }
+ else
+ return 1; // Eof of the list
+ }
+ else
+ break;
+ }
+
if (default_collation_name)
{
CHARSET_INFO *default_collation;
@@ -2964,6 +3033,8 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
#endif /* HAVE_OPENSSL */
+#ifndef EMBEDDED_LIBRARY
+
static void init_ssl()
{
#ifdef HAVE_OPENSSL
@@ -2977,18 +3048,19 @@ static void init_ssl()
if (!ssl_acceptor_fd)
{
opt_use_ssl = 0;
- have_openssl= SHOW_OPTION_DISABLED;
+ have_ssl= SHOW_OPTION_DISABLED;
}
}
else
{
- have_openssl= SHOW_OPTION_DISABLED;
+ have_ssl= SHOW_OPTION_DISABLED;
}
if (des_key_file)
load_des_key_file(des_key_file);
#endif /* HAVE_OPENSSL */
}
+#endif /* EMBEDDED_LIBRARY */
static int init_server_components()
{
@@ -3000,7 +3072,7 @@ static int init_server_components()
query_cache_set_min_res_unit(query_cache_min_res_unit);
query_cache_init();
query_cache_resize(query_cache_size);
- randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
+ randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
reset_floating_point_exceptions();
init_thr_lock();
#ifdef HAVE_REPLICATION
@@ -3085,7 +3157,7 @@ server.");
if (opt_error_log)
{
if (!log_error_file_ptr[0])
- fn_format(log_error_file, glob_hostname, mysql_data_home, ".err",
+ fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */
else
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
@@ -3170,7 +3242,7 @@ server.");
(TC_LOG *) &tc_log_mmap) :
(TC_LOG *) &tc_log_dummy);
- if (tc_log->open(opt_bin_logname))
+ if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file))
{
sql_print_error("Can't init tc log");
unireg_abort(1);
@@ -3188,7 +3260,7 @@ server.");
#ifdef HAVE_REPLICATION
if (opt_bin_log && expire_logs_days)
{
- long purge_time= time(0) - expire_logs_days*24*60*60;
+ long purge_time= (long) (time(0) - expire_logs_days*24*60*60);
if (purge_time >= 0)
mysql_bin_log.purge_logs_before_date(purge_time);
}
@@ -3229,6 +3301,7 @@ server.");
}
+#ifndef EMBEDDED_LIBRARY
static void create_maintenance_thread()
{
if (
@@ -3246,7 +3319,6 @@ static void create_maintenance_thread()
static void create_shutdown_thread()
{
-#if !defined(EMBEDDED_LIBRARY)
#ifdef __WIN__
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread;
@@ -3262,9 +3334,9 @@ static void create_shutdown_thread()
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
sql_print_warning("Can't create thread to handle shutdown requests");
#endif
-#endif // EMBEDDED_LIBRARY
}
+#endif /* EMBEDDED_LIBRARY */
#if defined(__NT__) || defined(HAVE_SMEM)
static void handle_connections_methods()
@@ -4700,7 +4772,8 @@ enum options_mysqld
OPT_TABLE_LOCK_WAIT_TIMEOUT,
OPT_PORT_OPEN_TIMEOUT,
OPT_MERGE,
- OPT_INNODB_ROLLBACK_ON_TIMEOUT
+ OPT_INNODB_ROLLBACK_ON_TIMEOUT,
+ OPT_SECURE_FILE_PRIV
};
@@ -5350,6 +5423,10 @@ Can't be set to 1 if --log-slave-updates is used.",
{"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.",
(gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
my_bool(0), 0, 0, 0, 0, 0},
+ {"secure-file-priv", OPT_SECURE_FILE_PRIV,
+ "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory",
+ (gptr*) &opt_secure_file_priv, (gptr*) &opt_secure_file_priv, 0,
+ GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
@@ -6379,6 +6456,7 @@ static void mysql_init_variables(void)
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
opt_secure_auth= 0;
+ opt_secure_file_priv= 0;
opt_bootstrap= opt_myisam_log= 0;
mqh_used= 0;
segfaulted= kill_in_progress= 0;
@@ -6432,7 +6510,7 @@ static void mysql_init_variables(void)
protocol_version= PROTOCOL_VERSION;
what_to_log= ~ (1L << (uint) COM_TIME);
refresh_version= flush_version= 1L; /* Increments on each reload */
- query_id= thread_id= 1L;
+ global_query_id= thread_id= 1L;
strmov(server_version, MYSQL_SERVER_VERSION);
myisam_recover_options_str= sql_mode_str= "OFF";
myisam_stats_method_str= "nulls_unequal";
@@ -6545,9 +6623,9 @@ static void mysql_init_variables(void)
have_raid=SHOW_OPTION_NO;
#endif
#ifdef HAVE_OPENSSL
- have_openssl=SHOW_OPTION_YES;
+ have_ssl=SHOW_OPTION_YES;
#else
- have_openssl=SHOW_OPTION_NO;
+ have_ssl=SHOW_OPTION_NO;
#endif
#ifdef HAVE_BROKEN_REALPATH
have_symlink=SHOW_OPTION_NO;
@@ -6908,6 +6986,29 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_STANDALONE: /* Dummy option for NT */
break;
#endif
+ /*
+ The following change issues a deprecation warning if the slave
+ configuration is specified either in the my.cnf file or on
+ the command-line. See BUG#21490.
+ */
+ case OPT_MASTER_HOST:
+ case OPT_MASTER_USER:
+ case OPT_MASTER_PASSWORD:
+ case OPT_MASTER_PORT:
+ case OPT_MASTER_CONNECT_RETRY:
+ case OPT_MASTER_SSL:
+ case OPT_MASTER_SSL_KEY:
+ case OPT_MASTER_SSL_CERT:
+ case OPT_MASTER_SSL_CAPATH:
+ case OPT_MASTER_SSL_CIPHER:
+ case OPT_MASTER_SSL_CA:
+ if (!slave_warning_issued) //only show the warning once
+ {
+ slave_warning_issued = true;
+ WARN_DEPRECATED(NULL, "5.2", "for replication startup options",
+ "'CHANGE MASTER'");
+ }
+ break;
case OPT_CONSOLE:
if (opt_console)
opt_error_log= 0; // Force logs to stdout
@@ -7417,6 +7518,16 @@ static void fix_paths(void)
exit(1);
}
#endif /* HAVE_REPLICATION */
+ /*
+ Convert the secure-file-priv option to system format, allowing
+ a quick strcmp to check if read or write is in an allowed dir
+ */
+ if (opt_secure_file_priv)
+ {
+ convert_dirname(buff, opt_secure_file_priv, NullS);
+ my_free(opt_secure_file_priv, MYF(0));
+ opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
+ }
}
@@ -7523,6 +7634,8 @@ static int test_if_case_insensitive(const char *dir_name)
/* Create file to store pid number */
+#ifndef EMBEDDED_LIBRARY
+
static void create_pid_file()
{
File file;
@@ -7542,7 +7655,7 @@ static void create_pid_file()
sql_perror("Can't start server: can't create PID file");
exit(1);
}
-
+#endif /* EMBEDDED_LIBRARY */
/* Clear most status variables */
void refresh_status(THD *thd)
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 16b36b927d6..ef929bc67f0 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -221,6 +221,8 @@ my_bool net_realloc(NET *net, ulong length)
-1 Don't know if data is ready or not
*/
+#if !defined(EMBEDDED_LIBRARY)
+
static int net_data_is_ready(my_socket sd)
{
#ifdef HAVE_POLL
@@ -255,9 +257,10 @@ static int net_data_is_ready(my_socket sd)
return 0;
else
return test(res ? FD_ISSET(sd, &sfds) : 0);
-#endif
+#endif /* HAVE_POLL */
}
+#endif /* EMBEDDED_LIBRARY */
/*
Remove unwanted characters from connection
@@ -282,8 +285,11 @@ static int net_data_is_ready(my_socket sd)
void net_clear(NET *net)
{
+#if !defined(EMBEDDED_LIBRARY)
int count, ready;
+#endif
DBUG_ENTER("net_clear");
+
#if !defined(EMBEDDED_LIBRARY)
while((ready= net_data_is_ready(net->vio->sd)) > 0)
{
@@ -293,7 +299,7 @@ void net_clear(NET *net)
{
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
-#ifdef EXTRA_DEBUG
+#if defined(EXTRA_DEBUG) && (MYSQL_VERSION_ID < 51000)
fprintf(stderr,"skipped %d bytes from file: %s\n",
count, vio_description(net->vio));
#endif
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 4838e690dd7..0e284850cbe 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -499,9 +499,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double read_time);
static
TRP_GROUP_MIN_MAX *get_best_group_min_max(PARAM *param, SEL_TREE *tree);
-static int get_index_merge_params(PARAM *param, key_map& needed_reg,
- SEL_IMERGE *imerge, double *read_time,
- ha_rows* imerge_rows);
static double get_index_only_read_time(const PARAM* param, ha_rows records,
int keynr);
@@ -511,7 +508,6 @@ static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map,
static void print_ror_scans_arr(TABLE *table, const char *msg,
struct st_ror_scan_info **start,
struct st_ror_scan_info **end);
-static void print_rowid(byte* val, int len);
static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg);
#endif
@@ -823,7 +819,7 @@ QUICK_SELECT_I::QUICK_SELECT_I()
QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
bool no_alloc, MEM_ROOT *parent_alloc)
- :dont_free(0),error(0),free_file(0),in_range(0),cur_range(NULL),range(0)
+ :dont_free(0),error(0),free_file(0),in_range(0),cur_range(NULL),last_range(0)
{
sorted= 0;
index= key_nr;
@@ -1248,13 +1244,12 @@ int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, byte *val1, byte *val2)
int QUICK_ROR_UNION_SELECT::reset()
{
- QUICK_SELECT_I* quick;
+ QUICK_SELECT_I *quick;
int error;
DBUG_ENTER("QUICK_ROR_UNION_SELECT::reset");
have_prev_rowid= FALSE;
if (!scans_inited)
{
- QUICK_SELECT_I *quick;
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
@@ -6614,7 +6609,7 @@ int QUICK_RANGE_SELECT::reset()
byte *mrange_buff;
DBUG_ENTER("QUICK_RANGE_SELECT::reset");
next=0;
- range= NULL;
+ last_range= NULL;
in_range= FALSE;
cur_range= (QUICK_RANGE**) ranges.buffer;
@@ -6732,23 +6727,23 @@ int QUICK_RANGE_SELECT::get_next()
{
start_key= &mrange_slot->start_key;
end_key= &mrange_slot->end_key;
- range= *(cur_range++);
+ last_range= *(cur_range++);
- start_key->key= (const byte*) range->min_key;
- start_key->length= range->min_length;
- start_key->flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
- (range->flag & EQ_RANGE) ?
+ start_key->key= (const byte*) last_range->min_key;
+ start_key->length= last_range->min_length;
+ start_key->flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
+ (last_range->flag & EQ_RANGE) ?
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
- end_key->key= (const byte*) range->max_key;
- end_key->length= range->max_length;
+ end_key->key= (const byte*) last_range->max_key;
+ end_key->length= last_range->max_length;
/*
We use HA_READ_AFTER_KEY here because if we are reading on a key
prefix. We want to find all keys with this prefix.
*/
- end_key->flag= (range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
+ end_key->flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
HA_READ_AFTER_KEY);
- mrange_slot->range_flag= range->flag;
+ mrange_slot->range_flag= last_range->flag;
}
result= file->read_multi_range_first(&mrange, multi_range, count,
@@ -6798,7 +6793,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, byte *cur_prefix)
{
int result;
key_range start_key, end_key;
- if (range)
+ if (last_range)
{
/* Read the next record in the same range with prefix after cur_prefix. */
DBUG_ASSERT(cur_prefix != 0);
@@ -6812,35 +6807,35 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, byte *cur_prefix)
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
- range= 0;
+ last_range= 0;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
- range= *(cur_range++);
+ last_range= *(cur_range++);
- start_key.key= (const byte*) range->min_key;
- start_key.length= min(range->min_length, prefix_length);
- start_key.flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
- (range->flag & EQ_RANGE) ?
+ start_key.key= (const byte*) last_range->min_key;
+ start_key.length= min(last_range->min_length, prefix_length);
+ start_key.flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
+ (last_range->flag & EQ_RANGE) ?
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
- end_key.key= (const byte*) range->max_key;
- end_key.length= min(range->max_length, prefix_length);
+ end_key.key= (const byte*) last_range->max_key;
+ end_key.length= min(last_range->max_length, prefix_length);
/*
We use READ_AFTER_KEY here because if we are reading on a key
prefix we want to find all keys with this prefix
*/
- end_key.flag= (range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
+ end_key.flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
HA_READ_AFTER_KEY);
- result= file->read_range_first(range->min_length ? &start_key : 0,
- range->max_length ? &end_key : 0,
- test(range->flag & EQ_RANGE),
+ result= file->read_range_first(last_range->min_length ? &start_key : 0,
+ last_range->max_length ? &end_key : 0,
+ test(last_range->flag & EQ_RANGE),
sorted);
- if (range->flag == (UNIQUE_RANGE | EQ_RANGE))
- range=0; // Stop searching
+ if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
+ last_range= 0; // Stop searching
if (result != HA_ERR_END_OF_FILE)
DBUG_RETURN(result);
- range=0; // No matching rows; go to next range
+ last_range= 0; // No matching rows; go to next range
}
}
@@ -6854,11 +6849,11 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
for (;;)
{
int result;
- if (range)
+ if (last_range)
{
// Already read through key
- result= file->index_next_same(record, (byte*) range->min_key,
- range->min_length);
+ result= file->index_next_same(record, (byte*) last_range->min_key,
+ last_range->min_length);
if (result != HA_ERR_END_OF_FILE)
DBUG_RETURN(result);
}
@@ -6867,18 +6862,18 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
- range= 0;
+ last_range= 0;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
- range= *(cur_range++);
+ last_range= *(cur_range++);
result= file->index_read(record,
- (byte*) range->min_key,
- range->min_length,
- (ha_rkey_function)(range->flag ^ GEOM_FLAG));
+ (byte*) last_range->min_key,
+ last_range->min_length,
+ (ha_rkey_function)(last_range->flag ^ GEOM_FLAG));
if (result != HA_ERR_KEY_NOT_FOUND)
DBUG_RETURN(result);
- range=0; // Not found, to next range
+ last_range= 0; // Not found, to next range
}
}
@@ -6903,7 +6898,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
bool QUICK_RANGE_SELECT::row_in_ranges()
{
- QUICK_RANGE *range;
+ QUICK_RANGE *res;
uint min= 0;
uint max= ranges.elements - 1;
uint mid= (max + min)/2;
@@ -6919,8 +6914,8 @@ bool QUICK_RANGE_SELECT::row_in_ranges()
max= mid;
mid= (min + max) / 2;
}
- range= *(QUICK_RANGE**)dynamic_array_ptr(&ranges, mid);
- return (!cmp_next(range) && !cmp_prev(range));
+ res= *(QUICK_RANGE**)dynamic_array_ptr(&ranges, mid);
+ return (!cmp_next(res) && !cmp_prev(res));
}
/*
@@ -6934,14 +6929,14 @@ bool QUICK_RANGE_SELECT::row_in_ranges()
*/
QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q,
- uint used_key_parts)
+ uint used_key_parts_arg)
: QUICK_RANGE_SELECT(*q), rev_it(rev_ranges)
{
QUICK_RANGE *r;
QUICK_RANGE **pr= (QUICK_RANGE**)ranges.buffer;
- QUICK_RANGE **last_range= pr + ranges.elements;
- for (; pr!=last_range; pr++)
+ QUICK_RANGE **end_range= pr + ranges.elements;
+ for (; pr!=end_range; pr++)
rev_ranges.push_front(*pr);
/* Remove EQ_RANGE flag for keys that are not using the full key */
@@ -6975,11 +6970,11 @@ int QUICK_SELECT_DESC::get_next()
for (;;)
{
int result;
- if (range)
+ if (last_range)
{ // Already read through key
- result = ((range->flag & EQ_RANGE)
- ? file->index_next_same(record, (byte*) range->min_key,
- range->min_length) :
+ result = ((last_range->flag & EQ_RANGE)
+ ? file->index_next_same(record, (byte*) last_range->min_key,
+ last_range->min_length) :
file->index_prev(record));
if (!result)
{
@@ -6990,47 +6985,49 @@ int QUICK_SELECT_DESC::get_next()
DBUG_RETURN(result);
}
- if (!(range=rev_it++))
+ if (!(last_range= rev_it++))
DBUG_RETURN(HA_ERR_END_OF_FILE); // All ranges used
- if (range->flag & NO_MAX_RANGE) // Read last record
+ if (last_range->flag & NO_MAX_RANGE) // Read last record
{
int local_error;
if ((local_error=file->index_last(record)))
DBUG_RETURN(local_error); // Empty table
- if (cmp_prev(range) == 0)
+ if (cmp_prev(last_range) == 0)
DBUG_RETURN(0);
- range=0; // No matching records; go to next range
+ last_range= 0; // No match; go to next range
continue;
}
- if (range->flag & EQ_RANGE)
+ if (last_range->flag & EQ_RANGE)
{
- result = file->index_read(record, (byte*) range->max_key,
- range->max_length, HA_READ_KEY_EXACT);
+ result= file->index_read(record, (byte*) last_range->max_key,
+ last_range->max_length, HA_READ_KEY_EXACT);
}
else
{
- DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
- result=file->index_read(record, (byte*) range->max_key,
- range->max_length,
- ((range->flag & NEAR_MAX) ?
- HA_READ_BEFORE_KEY : HA_READ_PREFIX_LAST_OR_PREV));
+ DBUG_ASSERT(last_range->flag & NEAR_MAX ||
+ range_reads_after_key(last_range));
+ result=file->index_read(record, (byte*) last_range->max_key,
+ last_range->max_length,
+ ((last_range->flag & NEAR_MAX) ?
+ HA_READ_BEFORE_KEY :
+ HA_READ_PREFIX_LAST_OR_PREV));
}
if (result)
{
if (result != HA_ERR_KEY_NOT_FOUND)
DBUG_RETURN(result);
- range=0; // Not found, to next range
+ last_range= 0; // Not found, to next range
continue;
}
- if (cmp_prev(range) == 0)
+ if (cmp_prev(last_range) == 0)
{
- if (range->flag == (UNIQUE_RANGE | EQ_RANGE))
- range = 0; // Stop searching
+ if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
+ last_range= 0; // Stop searching
DBUG_RETURN(0); // Found key is in range
}
- range = 0; // To next range
+ last_range= 0; // To next range
}
}
@@ -7507,7 +7504,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
if ((join->tables != 1) || /* The query must reference one table. */
((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */
(!join->select_distinct)) ||
- (thd->lex->select_lex.olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */
+ (join->select_lex->olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */
DBUG_RETURN(NULL);
if (table->s->keys == 0) /* There are no indexes to use. */
DBUG_RETURN(NULL);
@@ -9514,23 +9511,9 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg)
}
-static void print_rowid(byte* val, int len)
-{
- byte *pb;
- DBUG_LOCK_FILE;
- fputc('\"', DBUG_FILE);
- for (pb= val; pb!= val + len; ++pb)
- fprintf(DBUG_FILE, "%c", *pb);
- fprintf(DBUG_FILE, "\", hex: ");
-
- for (pb= val; pb!= val + len; ++pb)
- fprintf(DBUG_FILE, "%x ", *pb);
- fputc('\n', DBUG_FILE);
- DBUG_UNLOCK_FILE;
-}
-
void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
{
+ /* purecov: begin inspected */
fprintf(DBUG_FILE, "%*squick range select, key %s, length: %d\n",
indent, "", head->key_info[index].name, max_used_key_length);
@@ -9538,8 +9521,8 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
{
QUICK_RANGE *range;
QUICK_RANGE **pr= (QUICK_RANGE**)ranges.buffer;
- QUICK_RANGE **last_range= pr + ranges.elements;
- for (; pr!=last_range; ++pr)
+ QUICK_RANGE **end_range= pr + ranges.elements;
+ for (; pr != end_range; ++pr)
{
fprintf(DBUG_FILE, "%*s", indent + 2, "");
range= *pr;
@@ -9564,6 +9547,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
fputs("\n",DBUG_FILE);
}
}
+ /* purecov: end */
}
void QUICK_INDEX_MERGE_SELECT::dbug_dump(int indent, bool verbose)
diff --git a/sql/opt_range.h b/sql/opt_range.h
index cbd27d389ad..3a737323eb7 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -299,7 +299,7 @@ protected:
DYNAMIC_ARRAY ranges; /* ordered array of range ptrs */
QUICK_RANGE **cur_range; /* current element in ranges */
- QUICK_RANGE *range;
+ QUICK_RANGE *last_range;
KEY_PART *key_parts;
KEY_PART_INFO *key_part_info;
int cmp_next(QUICK_RANGE *range);
diff --git a/sql/password.c b/sql/password.c
index bb5b2693f26..57ed3e6ab0f 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -472,7 +472,7 @@ scramble(char *to, const char *message, const char *password)
*/
my_bool
-check_scramble(const char *scramble, const char *message,
+check_scramble(const char *scramble_arg, const char *message,
const uint8 *hash_stage2)
{
SHA1_CONTEXT sha1_context;
@@ -485,7 +485,7 @@ check_scramble(const char *scramble, const char *message,
mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
mysql_sha1_result(&sha1_context, buf);
/* encrypt scramble */
- my_crypt((char *) buf, buf, (const uchar *) scramble, SCRAMBLE_LENGTH);
+ my_crypt((char *) buf, buf, (const uchar *) scramble_arg, SCRAMBLE_LENGTH);
/* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
mysql_sha1_reset(&sha1_context);
mysql_sha1_input(&sha1_context, buf, SHA1_HASH_SIZE);
@@ -495,7 +495,8 @@ check_scramble(const char *scramble, const char *message,
/*
- Convert scrambled password from asciiz hex string to binary form.
+ Convert scrambled password from asciiz hex string to binary form.
+
SYNOPSIS
get_salt_from_password()
res OUT buf to hold password. Must be at least SHA1_HASH_SIZE
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 757e7aae026..f9ba734a48d 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -27,8 +27,10 @@
#include <stdarg.h>
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
-static void write_eof_packet(THD *thd, NET *net);
void net_send_error_packet(THD *thd, uint sql_errno, const char *err);
+#ifndef EMBEDDED_LIBRARY
+static void write_eof_packet(THD *thd, NET *net);
+#endif
#ifndef EMBEDDED_LIBRARY
bool Protocol::net_store_data(const char *from, uint length)
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index a2e5c3b0894..1dc16b6e566 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -528,11 +528,11 @@ HOSTS";
while ((row= mysql_fetch_row(res)))
{
- uint32 server_id;
+ uint32 log_server_id;
SLAVE_INFO* si, *old_si;
- server_id = atoi(row[0]);
+ log_server_id = atoi(row[0]);
if ((old_si= (SLAVE_INFO*)hash_search(&slave_list,
- (byte*)&server_id,4)))
+ (byte*)&log_server_id,4)))
si = old_si;
else
{
@@ -542,7 +542,7 @@ HOSTS";
pthread_mutex_unlock(&LOCK_slave_list);
goto err;
}
- si->server_id = server_id;
+ si->server_id = log_server_id;
my_hash_insert(&slave_list, (byte*)si);
}
strmake(si->host, row[1], sizeof(si->host)-1);
@@ -916,14 +916,14 @@ bool load_master_data(THD* thd)
setting active_mi, because init_master_info() sets active_mi with
defaults.
*/
- int error;
+ int error_2;
if (init_master_info(active_mi, master_info_file, relay_log_info_file,
0, (SLAVE_IO | SLAVE_SQL)))
my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name));
- active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error);
+ active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error_2);
/* at least in recent versions, the condition below should be false */
if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE)
active_mi->master_log_pos = BIN_LOG_HEADER_SIZE;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index be9d73a091c..46c2a775d8a 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -82,9 +82,6 @@ TYPELIB delay_key_write_typelib=
delay_key_write_type_names, NULL
};
-static int sys_check_charset(THD *thd, set_var *var);
-static bool sys_update_charset(THD *thd, set_var *var);
-static void sys_set_default_charset(THD *thd, enum_var_type type);
static int sys_check_ftb_syntax(THD *thd, set_var *var);
static bool sys_update_ftb_syntax(THD *thd, set_var * var);
static void sys_default_ftb_syntax(THD *thd, enum_var_type type);
@@ -358,6 +355,8 @@ sys_query_cache_wlock_invalidate("query_cache_wlock_invalidate",
&SV::query_cache_wlock_invalidate);
#endif /* HAVE_QUERY_CACHE */
sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth);
+sys_var_const_str_ptr sys_secure_file_priv("secure_file_priv",
+ &opt_secure_file_priv);
sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id);
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
@@ -588,6 +587,10 @@ sys_var_readonly sys_have_innodb("have_innodb", OPT_GLOBAL,
/* Global read-only variable describing server license */
sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
+/* Global read-only variable containing hostname */
+sys_var_const_str sys_hostname("hostname", glob_hostname);
+
+
/*
List of all variables for initialisation and storage in hash
@@ -640,6 +643,7 @@ sys_var *sys_variables[]=
&sys_foreign_key_checks,
&sys_group_concat_max_len,
&sys_have_innodb,
+ &sys_hostname,
&sys_identity,
&sys_init_connect,
&sys_init_slave,
@@ -719,6 +723,7 @@ sys_var *sys_variables[]=
&sys_rpl_recovery_rank,
&sys_safe_updates,
&sys_secure_auth,
+ &sys_secure_file_priv,
&sys_select_limit,
&sys_server_id,
#ifdef HAVE_REPLICATION
@@ -866,11 +871,14 @@ struct show_var_st init_vars[]= {
{"have_isam", (char*) &have_isam, SHOW_HAVE},
{"have_merge_engine", (char*) &have_merge_db, SHOW_HAVE},
{"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
- {"have_openssl", (char*) &have_openssl, SHOW_HAVE},
+ /* have_openssl is just and alias for have_ssl */
+ {"have_openssl", (char*) &have_ssl, SHOW_HAVE},
+ {"have_ssl", (char*) &have_ssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE},
{"have_rtree_keys", (char*) &have_rtree_keys, SHOW_HAVE},
{"have_symlink", (char*) &have_symlink, SHOW_HAVE},
+ {sys_hostname.name, (char*) &sys_hostname, SHOW_SYS},
{"init_connect", (char*) &sys_init_connect, SHOW_SYS},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
{"init_slave", (char*) &sys_init_slave, SHOW_SYS},
@@ -1027,6 +1035,7 @@ struct show_var_st init_vars[]= {
#endif
{sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
{"secure_auth", (char*) &sys_secure_auth, SHOW_SYS},
+ {"secure_file_priv", (char*) &sys_secure_file_priv, SHOW_SYS},
#ifdef HAVE_SMEM
{"shared_memory", (char*) &opt_enable_shared_memory, SHOW_MY_BOOL},
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
@@ -1414,9 +1423,9 @@ static void fix_server_id(THD *thd, enum_var_type type)
sys_var_long_ptr::
-sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
+sys_var_long_ptr(const char *name_arg, ulong *value_ptr_arg,
sys_after_update_func after_update_arg)
- :sys_var_long_ptr_global(name_arg, value_ptr,
+ :sys_var_long_ptr_global(name_arg, value_ptr_arg,
&LOCK_global_system_variables, after_update_arg)
{}
@@ -1766,7 +1775,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
/* As there was no local variable, return the global value */
var_type= OPT_GLOBAL;
}
- switch (type()) {
+ switch (show_type()) {
case SHOW_INT:
{
uint value;
diff --git a/sql/set_var.h b/sql/set_var.h
index 60fdb0e879b..6000e155db9 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -55,8 +55,8 @@ public:
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
virtual bool update(THD *thd, set_var *var)=0;
- virtual void set_default(THD *thd, enum_var_type type) {}
- virtual SHOW_TYPE type() { return SHOW_UNDEF; }
+ virtual void set_default(THD *thd_arg, enum_var_type type) {}
+ virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ return 0; }
virtual bool check_type(enum_var_type type)
@@ -96,14 +96,16 @@ class sys_var_long_ptr_global: public sys_var_global
{
public:
ulong *value;
- sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr,
+ sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr_arg,
pthread_mutex_t *guard_arg,
sys_after_update_func after_update_arg= NULL)
- :sys_var_global(name_arg, after_update_arg, guard_arg), value(value_ptr) {}
+ :sys_var_global(name_arg, after_update_arg, guard_arg),
+ value(value_ptr_arg)
+ {}
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_LONG; }
+ SHOW_TYPE show_type() { return SHOW_LONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ return (byte*) value; }
};
@@ -125,14 +127,14 @@ class sys_var_ulonglong_ptr :public sys_var
{
public:
ulonglong *value;
- sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr)
- :sys_var(name_arg),value(value_ptr) {}
- sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr,
+ sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr_arg)
+ :sys_var(name_arg),value(value_ptr_arg) {}
+ sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr_arg,
sys_after_update_func func)
- :sys_var(name_arg,func), value(value_ptr) {}
+ :sys_var(name_arg,func), value(value_ptr_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_LONGLONG; }
+ SHOW_TYPE show_type() { return SHOW_LONGLONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ return (byte*) value; }
};
@@ -151,7 +153,7 @@ public:
}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_MY_BOOL; }
+ SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ return (byte*) value; }
bool check_update_type(Item_result type) { return 0; }
@@ -183,7 +185,7 @@ public:
{
(*set_default_func)(thd, type);
}
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ return (byte*) value; }
bool check_update_type(Item_result type)
@@ -209,7 +211,7 @@ public:
{
return 1;
}
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return (byte*) value;
@@ -238,7 +240,7 @@ public:
{
return 1;
}
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return (byte*) *value;
@@ -266,7 +268,7 @@ public:
return check_enum(thd, var, enum_names);
}
bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_update_type(Item_result type) { return 0; }
};
@@ -301,7 +303,7 @@ public:
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_LONG; }
+ SHOW_TYPE show_type() { return SHOW_LONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -319,7 +321,7 @@ public:
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_HA_ROWS; }
+ SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -339,7 +341,7 @@ public:
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_LONGLONG; }
+ SHOW_TYPE show_type() { return SHOW_LONGLONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type)
{
@@ -365,7 +367,7 @@ public:
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_MY_BOOL; }
+ SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check(THD *thd, set_var *var)
{
@@ -396,7 +398,7 @@ public:
}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_update_type(Item_result type) { return 0; }
};
@@ -431,7 +433,7 @@ public:
:sys_var_thd(name_arg), offset(offset_arg)
{}
bool check(THD *thd, set_var *var);
-SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
@@ -469,7 +471,7 @@ public:
bool update(THD *thd, set_var *var);
bool check_update_type(Item_result type) { return 0; }
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
- SHOW_TYPE type() { return SHOW_MY_BOOL; }
+ SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -484,7 +486,7 @@ public:
void set_default(THD *thd, enum_var_type type);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
bool check_default(enum_var_type type) { return 0; }
- SHOW_TYPE type() { return SHOW_LONG; }
+ SHOW_TYPE show_type() { return SHOW_LONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -495,7 +497,7 @@ public:
sys_var_last_insert_id(const char *name_arg) :sys_var(name_arg) {}
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
- SHOW_TYPE type() { return SHOW_LONGLONG; }
+ SHOW_TYPE show_type() { return SHOW_LONGLONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -506,7 +508,7 @@ public:
sys_var_insert_id(const char *name_arg) :sys_var(name_arg) {}
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
- SHOW_TYPE type() { return SHOW_LONGLONG; }
+ SHOW_TYPE show_type() { return SHOW_LONGLONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -528,8 +530,8 @@ public:
class sys_var_sync_binlog_period :public sys_var_long_ptr
{
public:
- sys_var_sync_binlog_period(const char *name_arg, ulong *value_ptr)
- :sys_var_long_ptr(name_arg,value_ptr) {}
+ sys_var_sync_binlog_period(const char *name_arg, ulong *value_ptr_arg)
+ :sys_var_long_ptr(name_arg,value_ptr_arg) {}
bool update(THD *thd, set_var *var);
};
#endif
@@ -559,7 +561,7 @@ public:
no_support_one_shot= 0;
}
bool check(THD *thd, set_var *var);
-SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return ((type != STRING_RESULT) && (type != INT_RESULT));
@@ -583,7 +585,7 @@ public:
no_support_one_shot= 0;
}
bool check(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return ((type != STRING_RESULT) && (type != INT_RESULT));
@@ -699,7 +701,7 @@ public:
:sys_var_key_cache_param(name_arg, offsetof(KEY_CACHE, param_buff_size))
{}
bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_LONGLONG; }
+ SHOW_TYPE show_type() { return SHOW_LONGLONG; }
};
@@ -710,7 +712,7 @@ public:
:sys_var_key_cache_param(name_arg, offset_arg)
{}
bool update(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_LONG; }
+ SHOW_TYPE show_type() { return SHOW_LONG; }
};
@@ -725,7 +727,7 @@ public:
:sys_var_thd(name_arg), offset(offset_arg),
date_time_type(date_time_type_arg)
{}
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
@@ -745,13 +747,13 @@ class sys_var_readonly: public sys_var
{
public:
enum_var_type var_type;
- SHOW_TYPE show_type;
+ SHOW_TYPE show_type_value;
sys_value_ptr_func value_ptr_func;
sys_var_readonly(const char *name_arg, enum_var_type type,
SHOW_TYPE show_type_arg,
sys_value_ptr_func value_ptr_func_arg)
:sys_var(name_arg), var_type(type),
- show_type(show_type_arg), value_ptr_func(value_ptr_func_arg)
+ show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
{}
bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; }
@@ -761,7 +763,7 @@ public:
{
return (*value_ptr_func)(thd);
}
- SHOW_TYPE type() { return show_type; }
+ SHOW_TYPE show_type() { return show_type_value; }
bool is_readonly() const { return 1; }
};
@@ -774,7 +776,7 @@ public:
no_support_one_shot= 0;
}
bool check(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
@@ -798,7 +800,7 @@ public:
return type != OPT_GLOBAL || !option_limits;
}
void set_default(THD *thd, enum_var_type type);
- SHOW_TYPE type() { return SHOW_INT; }
+ SHOW_TYPE show_type() { return SHOW_INT; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -825,7 +827,7 @@ public:
#endif
}
bool check(THD *thd, set_var *var);
- SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return ((type != STRING_RESULT) && (type != INT_RESULT));
@@ -872,8 +874,8 @@ public:
} save_result;
LEX_STRING base; /* for structs */
- set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg,
- Item *value_arg)
+ set_var(enum_var_type type_arg, sys_var *var_arg,
+ const LEX_STRING *base_name_arg, Item *value_arg)
:var(var_arg), type(type_arg), base(*base_name_arg)
{
/*
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index e09629a1f3e..1230287656e 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -51,54 +51,54 @@ ER_YES
spa "SI"
ukr "ôáë"
ER_CANT_CREATE_FILE
- cze "Nemohu vytvo-Bøit soubor '%-.64s' (chybový kód: %d)"
- dan "Kan ikke oprette filen '%-.64s' (Fejlkode: %d)"
- nla "Kan file '%-.64s' niet aanmaken (Errcode: %d)"
+ cze "Nemohu vytvo-Bøit soubor '%-.200s' (chybový kód: %d)"
+ dan "Kan ikke oprette filen '%-.200s' (Fejlkode: %d)"
+ nla "Kan file '%-.200s' niet aanmaken (Errcode: %d)"
eng "Can't create file '%-.200s' (errno: %d)"
- est "Ei suuda luua faili '%-.64s' (veakood: %d)"
- fre "Ne peut créer le fichier '%-.64s' (Errcode: %d)"
- ger "Kann Datei '%-.64s' nicht erzeugen (Fehler: %d)"
- greek "Áäýíáôç ç äçìéïõñãßá ôïõ áñ÷åßïõ '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "A '%-.64s' file nem hozhato letre (hibakod: %d)"
- ita "Impossibile creare il file '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¥Õ¥¡¥¤¥ë¤¬ºî¤ì¤Þ¤»¤ó (errno: %d)"
- kor "È­ÀÏ '%-.64s'¸¦ ¸¸µéÁö ¸øÇß½À´Ï´Ù. (¿¡·¯¹øÈ£: %d)"
- nor "Kan ikke opprette fila '%-.64s' (Feilkode: %d)"
- norwegian-ny "Kan ikkje opprette fila '%-.64s' (Feilkode: %d)"
- pol "Nie mo¿na stworzyæ pliku '%-.64s' (Kod b³êdu: %d)"
- por "Não pode criar o arquivo '%-.64s' (erro no. %d)"
- rum "Nu pot sa creez fisierul '%-.64s' (Eroare: %d)"
- rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÆÁÊÌ '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Ne mogu da kreiram file '%-.64s' (errno: %d)"
- slo "Nemô¾em vytvori» súbor '%-.64s' (chybový kód: %d)"
- spa "No puedo crear archivo '%-.64s' (Error: %d)"
- swe "Kan inte skapa filen '%-.64s' (Felkod: %d)"
- ukr "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ ÆÁÊÌ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ est "Ei suuda luua faili '%-.200s' (veakood: %d)"
+ fre "Ne peut créer le fichier '%-.200s' (Errcode: %d)"
+ ger "Kann Datei '%-.200s' nicht erzeugen (Fehler: %d)"
+ greek "Áäýíáôç ç äçìéïõñãßá ôïõ áñ÷åßïõ '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "A '%-.200s' file nem hozhato letre (hibakod: %d)"
+ ita "Impossibile creare il file '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¥Õ¥¡¥¤¥ë¤¬ºî¤ì¤Þ¤»¤ó (errno: %d)"
+ kor "È­ÀÏ '%-.200s'¸¦ ¸¸µéÁö ¸øÇß½À´Ï´Ù. (¿¡·¯¹øÈ£: %d)"
+ nor "Kan ikke opprette fila '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Kan ikkje opprette fila '%-.200s' (Feilkode: %d)"
+ pol "Nie mo¿na stworzyæ pliku '%-.200s' (Kod b³êdu: %d)"
+ por "Não pode criar o arquivo '%-.200s' (erro no. %d)"
+ rum "Nu pot sa creez fisierul '%-.200s' (Eroare: %d)"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÆÁÊÌ '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Ne mogu da kreiram file '%-.200s' (errno: %d)"
+ slo "Nemô¾em vytvori» súbor '%-.200s' (chybový kód: %d)"
+ spa "No puedo crear archivo '%-.200s' (Error: %d)"
+ swe "Kan inte skapa filen '%-.200s' (Felkod: %d)"
+ ukr "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ ÆÁÊÌ '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_CANT_CREATE_TABLE
- cze "Nemohu vytvo-Bøit tabulku '%-.64s' (chybový kód: %d)"
- dan "Kan ikke oprette tabellen '%-.64s' (Fejlkode: %d)"
- nla "Kan tabel '%-.64s' niet aanmaken (Errcode: %d)"
+ cze "Nemohu vytvo-Bøit tabulku '%-.200s' (chybový kód: %d)"
+ dan "Kan ikke oprette tabellen '%-.200s' (Fejlkode: %d)"
+ nla "Kan tabel '%-.200s' niet aanmaken (Errcode: %d)"
eng "Can't create table '%-.200s' (errno: %d)"
- jps "'%-.64s' ƒe[ƒuƒ‹‚ªì‚ê‚Ü‚¹‚ñ.(errno: %d)",
- est "Ei suuda luua tabelit '%-.64s' (veakood: %d)"
- fre "Ne peut créer la table '%-.64s' (Errcode: %d)"
- ger "Kann Tabelle '%-.64s' nicht erzeugen (Fehler: %d)"
- greek "Áäýíáôç ç äçìéïõñãßá ôïõ ðßíáêá '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "A '%-.64s' tabla nem hozhato letre (hibakod: %d)"
- ita "Impossibile creare la tabella '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¥Æ¡¼¥Ö¥ë¤¬ºî¤ì¤Þ¤»¤ó.(errno: %d)"
- kor "Å×À̺í '%-.64s'¸¦ ¸¸µéÁö ¸øÇß½À´Ï´Ù. (¿¡·¯¹øÈ£: %d)"
- nor "Kan ikke opprette tabellen '%-.64s' (Feilkode: %d)"
- norwegian-ny "Kan ikkje opprette tabellen '%-.64s' (Feilkode: %d)"
- pol "Nie mo¿na stworzyæ tabeli '%-.64s' (Kod b³êdu: %d)"
- por "Não pode criar a tabela '%-.64s' (erro no. %d)"
- rum "Nu pot sa creez tabla '%-.64s' (Eroare: %d)"
- rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÔÁÂÌÉÃÕ '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Ne mogu da kreiram tabelu '%-.64s' (errno: %d)"
- slo "Nemô¾em vytvori» tabuµku '%-.64s' (chybový kód: %d)"
- spa "No puedo crear tabla '%-.64s' (Error: %d)"
- swe "Kan inte skapa tabellen '%-.64s' (Felkod: %d)"
- ukr "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ ÔÁÂÌÉÃÀ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.200s' ƒe[ƒuƒ‹‚ªì‚ê‚Ü‚¹‚ñ.(errno: %d)",
+ est "Ei suuda luua tabelit '%-.200s' (veakood: %d)"
+ fre "Ne peut créer la table '%-.200s' (Errcode: %d)"
+ ger "Kann Tabelle '%-.200s' nicht erzeugen (Fehler: %d)"
+ greek "Áäýíáôç ç äçìéïõñãßá ôïõ ðßíáêá '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "A '%-.200s' tabla nem hozhato letre (hibakod: %d)"
+ ita "Impossibile creare la tabella '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¥Æ¡¼¥Ö¥ë¤¬ºî¤ì¤Þ¤»¤ó.(errno: %d)"
+ kor "Å×À̺í '%-.200s'¸¦ ¸¸µéÁö ¸øÇß½À´Ï´Ù. (¿¡·¯¹øÈ£: %d)"
+ nor "Kan ikke opprette tabellen '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Kan ikkje opprette tabellen '%-.200s' (Feilkode: %d)"
+ pol "Nie mo¿na stworzyæ tabeli '%-.200s' (Kod b³êdu: %d)"
+ por "Não pode criar a tabela '%-.200s' (erro no. %d)"
+ rum "Nu pot sa creez tabla '%-.200s' (Eroare: %d)"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÔÁÂÌÉÃÕ '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Ne mogu da kreiram tabelu '%-.200s' (errno: %d)"
+ slo "Nemô¾em vytvori» tabuµku '%-.200s' (chybový kód: %d)"
+ spa "No puedo crear tabla '%-.200s' (Error: %d)"
+ swe "Kan inte skapa tabellen '%-.200s' (Felkod: %d)"
+ ukr "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ ÔÁÂÌÉÃÀ '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_CANT_CREATE_DB
cze "Nemohu vytvo-Bøit databázi '%-.64s' (chybový kód: %d)"
dan "Kan ikke oprette databasen '%-.64s' (Fejlkode: %d)"
@@ -275,30 +275,30 @@ ER_CANT_FIND_SYSTEM_REC
swe "Hittar inte posten i systemregistret"
ukr "îÅ ÍÏÖÕ ÚÞÉÔÁÔÉ ÚÁÐÉÓ Ú ÓÉÓÔÅÍÎϧ ÔÁÂÌÉæ"
ER_CANT_GET_STAT
- cze "Nemohu z-Bískat stav '%-.64s' (chybový kód: %d)"
- dan "Kan ikke læse status af '%-.64s' (Fejlkode: %d)"
- nla "Kan de status niet krijgen van '%-.64s' (Errcode: %d)"
+ cze "Nemohu z-Bískat stav '%-.200s' (chybový kód: %d)"
+ dan "Kan ikke læse status af '%-.200s' (Fejlkode: %d)"
+ nla "Kan de status niet krijgen van '%-.200s' (Errcode: %d)"
eng "Can't get status of '%-.200s' (errno: %d)"
- jps "'%-.64s' ‚̃XƒeƒCƒ^ƒX‚ª“¾‚ç‚ê‚Ü‚¹‚ñ. (errno: %d)",
- est "Ei suuda lugeda '%-.64s' olekut (veakood: %d)"
- fre "Ne peut obtenir le status de '%-.64s' (Errcode: %d)"
- ger "Kann Status von '%-.64s' nicht ermitteln (Fehler: %d)"
- greek "Áäýíáôç ç ëÞøç ðëçñïöïñéþí ãéá ôçí êáôÜóôáóç ôïõ '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "A(z) '%-.64s' statusza nem allapithato meg (hibakod: %d)"
- ita "Impossibile leggere lo stato di '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¤Î¥¹¥Æ¥¤¥¿¥¹¤¬ÆÀ¤é¤ì¤Þ¤»¤ó. (errno: %d)"
- kor "'%-.64s'ÀÇ »óŸ¦ ¾òÁö ¸øÇß½À´Ï´Ù. (¿¡·¯¹øÈ£: %d)"
- nor "Kan ikke lese statusen til '%-.64s' (Feilkode: %d)"
- norwegian-ny "Kan ikkje lese statusen til '%-.64s' (Feilkode: %d)"
- pol "Nie mo¿na otrzymaæ statusu '%-.64s' (Kod b³êdu: %d)"
- por "Não pode obter o status de '%-.64s' (erro no. %d)"
- rum "Nu pot sa obtin statusul lui '%-.64s' (Eroare: %d)"
- rus "îÅ×ÏÚÍÏÖÎÏ ÐÏÌÕÞÉÔØ ÓÔÁÔÕÓÎÕÀ ÉÎÆÏÒÍÁÃÉÀ Ï '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Ne mogu da dobijem stanje file-a '%-.64s' (errno: %d)"
- slo "Nemô¾em zisti» stav '%-.64s' (chybový kód: %d)"
- spa "No puedo obtener el estado de '%-.64s' (Error: %d)"
- swe "Kan inte läsa filinformationen (stat) från '%-.64s' (Felkod: %d)"
- ukr "îÅ ÍÏÖÕ ÏÔÒÉÍÁÔÉ ÓÔÁÔÕÓ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.200s' ‚̃XƒeƒCƒ^ƒX‚ª“¾‚ç‚ê‚Ü‚¹‚ñ. (errno: %d)",
+ est "Ei suuda lugeda '%-.200s' olekut (veakood: %d)"
+ fre "Ne peut obtenir le status de '%-.200s' (Errcode: %d)"
+ ger "Kann Status von '%-.200s' nicht ermitteln (Fehler: %d)"
+ greek "Áäýíáôç ç ëÞøç ðëçñïöïñéþí ãéá ôçí êáôÜóôáóç ôïõ '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "A(z) '%-.200s' statusza nem allapithato meg (hibakod: %d)"
+ ita "Impossibile leggere lo stato di '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¤Î¥¹¥Æ¥¤¥¿¥¹¤¬ÆÀ¤é¤ì¤Þ¤»¤ó. (errno: %d)"
+ kor "'%-.200s'ÀÇ »óŸ¦ ¾òÁö ¸øÇß½À´Ï´Ù. (¿¡·¯¹øÈ£: %d)"
+ nor "Kan ikke lese statusen til '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Kan ikkje lese statusen til '%-.200s' (Feilkode: %d)"
+ pol "Nie mo¿na otrzymaæ statusu '%-.200s' (Kod b³êdu: %d)"
+ por "Não pode obter o status de '%-.200s' (erro no. %d)"
+ rum "Nu pot sa obtin statusul lui '%-.200s' (Eroare: %d)"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÐÏÌÕÞÉÔØ ÓÔÁÔÕÓÎÕÀ ÉÎÆÏÒÍÁÃÉÀ Ï '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Ne mogu da dobijem stanje file-a '%-.200s' (errno: %d)"
+ slo "Nemô¾em zisti» stav '%-.200s' (chybový kód: %d)"
+ spa "No puedo obtener el estado de '%-.200s' (Error: %d)"
+ swe "Kan inte läsa filinformationen (stat) från '%-.200s' (Felkod: %d)"
+ ukr "îÅ ÍÏÖÕ ÏÔÒÉÍÁÔÉ ÓÔÁÔÕÓ '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_CANT_GET_WD
cze "Chyba p-Bøi zji¹»ování pracovní adresáø (chybový kód: %d)"
dan "Kan ikke læse aktive folder (Fejlkode: %d)"
@@ -350,55 +350,55 @@ ER_CANT_LOCK
swe "Kan inte låsa filen. (Felkod: %d)"
ukr "îÅ ÍÏÖÕ ÚÁÂÌÏËÕ×ÁÔÉ ÆÁÊÌ (ÐÏÍÉÌËÁ: %d)"
ER_CANT_OPEN_FILE
- cze "Nemohu otev-Bøít soubor '%-.64s' (chybový kód: %d)"
- dan "Kan ikke åbne fil: '%-.64s' (Fejlkode: %d)"
- nla "Kan de file '%-.64s' niet openen (Errcode: %d)"
+ cze "Nemohu otev-Bøít soubor '%-.200s' (chybový kód: %d)"
+ dan "Kan ikke åbne fil: '%-.200s' (Fejlkode: %d)"
+ nla "Kan de file '%-.200s' niet openen (Errcode: %d)"
eng "Can't open file: '%-.200s' (errno: %d)"
- jps "'%-.64s' ƒtƒ@ƒCƒ‹‚ðŠJ‚­Ž–‚ª‚Å‚«‚Ü‚¹‚ñ (errno: %d)",
- est "Ei suuda avada faili '%-.64s' (veakood: %d)"
- fre "Ne peut ouvrir le fichier: '%-.64s' (Errcode: %d)"
- ger "Kann Datei '%-.64s' nicht öffnen (Fehler: %d)"
- greek "Äåí åßíáé äõíáôü íá áíïé÷ôåß ôï áñ÷åßï: '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "A '%-.64s' file nem nyithato meg (hibakod: %d)"
- ita "Impossibile aprire il file: '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¥Õ¥¡¥¤¥ë¤ò³«¤¯»ö¤¬¤Ç¤­¤Þ¤»¤ó (errno: %d)"
- kor "È­ÀÏÀ» ¿­Áö ¸øÇß½À´Ï´Ù.: '%-.64s' (¿¡·¯¹øÈ£: %d)"
- nor "Kan ikke åpne fila: '%-.64s' (Feilkode: %d)"
- norwegian-ny "Kan ikkje åpne fila: '%-.64s' (Feilkode: %d)"
- pol "Nie mo¿na otworzyæ pliku: '%-.64s' (Kod b³êdu: %d)"
- por "Não pode abrir o arquivo '%-.64s' (erro no. %d)"
- rum "Nu pot sa deschid fisierul: '%-.64s' (Eroare: %d)"
- rus "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ: '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Ne mogu da otvorim file: '%-.64s' (errno: %d)"
- slo "Nemô¾em otvori» súbor: '%-.64s' (chybový kód: %d)"
- spa "No puedo abrir archivo: '%-.64s' (Error: %d)"
- swe "Kan inte använda '%-.64s' (Felkod: %d)"
- ukr "îÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ ÆÁÊÌ: '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.200s' ƒtƒ@ƒCƒ‹‚ðŠJ‚­Ž–‚ª‚Å‚«‚Ü‚¹‚ñ (errno: %d)",
+ est "Ei suuda avada faili '%-.200s' (veakood: %d)"
+ fre "Ne peut ouvrir le fichier: '%-.200s' (Errcode: %d)"
+ ger "Kann Datei '%-.200s' nicht öffnen (Fehler: %d)"
+ greek "Äåí åßíáé äõíáôü íá áíïé÷ôåß ôï áñ÷åßï: '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "A '%-.200s' file nem nyithato meg (hibakod: %d)"
+ ita "Impossibile aprire il file: '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¥Õ¥¡¥¤¥ë¤ò³«¤¯»ö¤¬¤Ç¤­¤Þ¤»¤ó (errno: %d)"
+ kor "È­ÀÏÀ» ¿­Áö ¸øÇß½À´Ï´Ù.: '%-.200s' (¿¡·¯¹øÈ£: %d)"
+ nor "Kan ikke åpne fila: '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Kan ikkje åpne fila: '%-.200s' (Feilkode: %d)"
+ pol "Nie mo¿na otworzyæ pliku: '%-.200s' (Kod b³êdu: %d)"
+ por "Não pode abrir o arquivo '%-.200s' (erro no. %d)"
+ rum "Nu pot sa deschid fisierul: '%-.200s' (Eroare: %d)"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ: '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Ne mogu da otvorim file: '%-.200s' (errno: %d)"
+ slo "Nemô¾em otvori» súbor: '%-.200s' (chybový kód: %d)"
+ spa "No puedo abrir archivo: '%-.200s' (Error: %d)"
+ swe "Kan inte använda '%-.200s' (Felkod: %d)"
+ ukr "îÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ ÆÁÊÌ: '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_FILE_NOT_FOUND
- cze "Nemohu naj-Bít soubor '%-.64s' (chybový kód: %d)"
- dan "Kan ikke finde fila: '%-.64s' (Fejlkode: %d)"
- nla "Kan de file: '%-.64s' niet vinden (Errcode: %d)"
+ cze "Nemohu naj-Bít soubor '%-.200s' (chybový kód: %d)"
+ dan "Kan ikke finde fila: '%-.200s' (Fejlkode: %d)"
+ nla "Kan de file: '%-.200s' niet vinden (Errcode: %d)"
eng "Can't find file: '%-.200s' (errno: %d)"
- jps "'%-.64s' ƒtƒ@ƒCƒ‹‚ðŒ©•t‚¯‚鎖‚ª‚Å‚«‚Ü‚¹‚ñ.(errno: %d)",
- est "Ei suuda leida faili '%-.64s' (veakood: %d)"
- fre "Ne peut trouver le fichier: '%-.64s' (Errcode: %d)"
- ger "Kann Datei '%-.64s' nicht finden (Fehler: %d)"
- greek "Äåí âñÝèçêå ôï áñ÷åßï: '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "A(z) '%-.64s' file nem talalhato (hibakod: %d)"
- ita "Impossibile trovare il file: '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¥Õ¥¡¥¤¥ë¤ò¸«ÉÕ¤±¤ë»ö¤¬¤Ç¤­¤Þ¤»¤ó.(errno: %d)"
- kor "È­ÀÏÀ» ãÁö ¸øÇß½À´Ï´Ù.: '%-.64s' (¿¡·¯¹øÈ£: %d)"
- nor "Kan ikke finne fila: '%-.64s' (Feilkode: %d)"
- norwegian-ny "Kan ikkje finne fila: '%-.64s' (Feilkode: %d)"
- pol "Nie mo¿na znale¥æ pliku: '%-.64s' (Kod b³êdu: %d)"
- por "Não pode encontrar o arquivo '%-.64s' (erro no. %d)"
- rum "Nu pot sa gasesc fisierul: '%-.64s' (Eroare: %d)"
- rus "îÅ×ÏÚÍÏÖÎÏ ÎÁÊÔÉ ÆÁÊÌ: '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Ne mogu da pronaðem file: '%-.64s' (errno: %d)"
- slo "Nemô¾em nájs» súbor: '%-.64s' (chybový kód: %d)"
- spa "No puedo encontrar archivo: '%-.64s' (Error: %d)"
- swe "Hittar inte filen '%-.64s' (Felkod: %d)"
- ukr "îÅ ÍÏÖÕ ÚÎÁÊÔÉ ÆÁÊÌ: '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.200s' ƒtƒ@ƒCƒ‹‚ðŒ©•t‚¯‚鎖‚ª‚Å‚«‚Ü‚¹‚ñ.(errno: %d)",
+ est "Ei suuda leida faili '%-.200s' (veakood: %d)"
+ fre "Ne peut trouver le fichier: '%-.200s' (Errcode: %d)"
+ ger "Kann Datei '%-.200s' nicht finden (Fehler: %d)"
+ greek "Äåí âñÝèçêå ôï áñ÷åßï: '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "A(z) '%-.200s' file nem talalhato (hibakod: %d)"
+ ita "Impossibile trovare il file: '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¥Õ¥¡¥¤¥ë¤ò¸«ÉÕ¤±¤ë»ö¤¬¤Ç¤­¤Þ¤»¤ó.(errno: %d)"
+ kor "È­ÀÏÀ» ãÁö ¸øÇß½À´Ï´Ù.: '%-.200s' (¿¡·¯¹øÈ£: %d)"
+ nor "Kan ikke finne fila: '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Kan ikkje finne fila: '%-.200s' (Feilkode: %d)"
+ pol "Nie mo¿na znale¥æ pliku: '%-.200s' (Kod b³êdu: %d)"
+ por "Não pode encontrar o arquivo '%-.200s' (erro no. %d)"
+ rum "Nu pot sa gasesc fisierul: '%-.200s' (Eroare: %d)"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÎÁÊÔÉ ÆÁÊÌ: '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Ne mogu da pronaðem file: '%-.200s' (errno: %d)"
+ slo "Nemô¾em nájs» súbor: '%-.200s' (chybový kód: %d)"
+ spa "No puedo encontrar archivo: '%-.200s' (Error: %d)"
+ swe "Hittar inte filen '%-.200s' (Felkod: %d)"
+ ukr "îÅ ÍÏÖÕ ÚÎÁÊÔÉ ÆÁÊÌ: '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_CANT_READ_DIR
cze "Nemohu -Bèíst adresáø '%-.64s' (chybový kód: %d)"
dan "Kan ikke læse folder '%-.64s' (Fejlkode: %d)"
@@ -480,7 +480,7 @@ ER_DISK_FULL
jps "Disk full (%s). ’N‚©‚ª‰½‚©‚ðŒ¸‚ç‚·‚܂ł܂Á‚Ä‚­‚¾‚³‚¢...",
est "Ketas täis (%s). Ootame kuni tekib vaba ruumi..."
fre "Disque plein (%s). J'attend que quelqu'un libère de l'espace..."
- ger "Festplatte voll (%-.64s). Warte, bis jemand Platz schafft ..."
+ ger "Festplatte voll (%s). Warte, bis jemand Platz schafft ..."
greek "Äåí õðÜñ÷åé ÷þñïò óôï äßóêï (%s). Ðáñáêáëþ, ðåñéìÝíåôå íá åëåõèåñùèåß ÷þñïò..."
hun "A lemez megtelt (%s)."
ita "Disco pieno (%s). In attesa che qualcuno liberi un po' di spazio..."
@@ -546,80 +546,80 @@ ER_ERROR_ON_CLOSE
swe "Fick fel vid stängning av '%-.64s' (Felkod: %d)"
ukr "îÅ ÍÏÖÕ ÚÁËÒÉÔÉ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
ER_ERROR_ON_READ
- cze "Chyba p-Bøi ètení souboru '%-.64s' (chybový kód: %d)"
- dan "Fejl ved læsning af '%-.64s' (Fejlkode: %d)"
- nla "Fout bij het lezen van file '%-.64s' (Errcode: %d)"
+ cze "Chyba p-Bøi ètení souboru '%-.200s' (chybový kód: %d)"
+ dan "Fejl ved læsning af '%-.200s' (Fejlkode: %d)"
+ nla "Fout bij het lezen van file '%-.200s' (Errcode: %d)"
eng "Error reading file '%-.200s' (errno: %d)"
- jps "'%-.64s' ƒtƒ@ƒCƒ‹‚̓ǂݞ‚݃Gƒ‰[ (errno: %d)",
- est "Viga faili '%-.64s' lugemisel (veakood: %d)"
- fre "Erreur en lecture du fichier '%-.64s' (Errcode: %d)"
- ger "Fehler beim Lesen der Datei '%-.64s' (Fehler: %d)"
- greek "Ðñüâëçìá êáôÜ ôçí áíÜãíùóç ôïõ áñ÷åßïõ '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "Hiba a '%-.64s'file olvasasakor. (hibakod: %d)"
- ita "Errore durante la lettura del file '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß¥¨¥é¡¼ (errno: %d)"
- kor "'%-.64s'È­ÀÏ Àб⠿¡·¯ (¿¡·¯¹øÈ£: %d)"
- nor "Feil ved lesing av '%-.64s' (Feilkode: %d)"
- norwegian-ny "Feil ved lesing av '%-.64s' (Feilkode: %d)"
- pol "B³?d podczas odczytu pliku '%-.64s' (Kod b³êdu: %d)"
- por "Erro ao ler arquivo '%-.64s' (erro no. %d)"
- rum "Eroare citind fisierul '%-.64s' (errno: %d)"
- rus "ïÛÉÂËÁ ÞÔÅÎÉÑ ÆÁÊÌÁ '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Greška pri èitanju file-a '%-.64s' (errno: %d)"
- slo "Chyba pri èítaní súboru '%-.64s' (chybový kód: %d)"
- spa "Error leyendo el fichero '%-.64s' (Error: %d)"
- swe "Fick fel vid läsning av '%-.64s' (Felkod %d)"
- ukr "îÅ ÍÏÖÕ ÐÒÏÞÉÔÁÔÉ ÆÁÊÌ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.200s' ƒtƒ@ƒCƒ‹‚̓ǂݞ‚݃Gƒ‰[ (errno: %d)",
+ est "Viga faili '%-.200s' lugemisel (veakood: %d)"
+ fre "Erreur en lecture du fichier '%-.200s' (Errcode: %d)"
+ ger "Fehler beim Lesen der Datei '%-.200s' (Fehler: %d)"
+ greek "Ðñüâëçìá êáôÜ ôçí áíÜãíùóç ôïõ áñ÷åßïõ '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "Hiba a '%-.200s'file olvasasakor. (hibakod: %d)"
+ ita "Errore durante la lettura del file '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß¥¨¥é¡¼ (errno: %d)"
+ kor "'%-.200s'È­ÀÏ Àб⠿¡·¯ (¿¡·¯¹øÈ£: %d)"
+ nor "Feil ved lesing av '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Feil ved lesing av '%-.200s' (Feilkode: %d)"
+ pol "B³?d podczas odczytu pliku '%-.200s' (Kod b³êdu: %d)"
+ por "Erro ao ler arquivo '%-.200s' (erro no. %d)"
+ rum "Eroare citind fisierul '%-.200s' (errno: %d)"
+ rus "ïÛÉÂËÁ ÞÔÅÎÉÑ ÆÁÊÌÁ '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Greška pri èitanju file-a '%-.200s' (errno: %d)"
+ slo "Chyba pri èítaní súboru '%-.200s' (chybový kód: %d)"
+ spa "Error leyendo el fichero '%-.200s' (Error: %d)"
+ swe "Fick fel vid läsning av '%-.200s' (Felkod %d)"
+ ukr "îÅ ÍÏÖÕ ÐÒÏÞÉÔÁÔÉ ÆÁÊÌ '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_ERROR_ON_RENAME
- cze "Chyba p-Bøi pøejmenování '%-.64s' na '%-.64s' (chybový kód: %d)"
- dan "Fejl ved omdøbning af '%-.64s' til '%-.64s' (Fejlkode: %d)"
- nla "Fout bij het hernoemen van '%-.64s' naar '%-.64s' (Errcode: %d)"
+ cze "Chyba p-Bøi pøejmenování '%-.150s' na '%-.150s' (chybový kód: %d)"
+ dan "Fejl ved omdøbning af '%-.150s' til '%-.150s' (Fejlkode: %d)"
+ nla "Fout bij het hernoemen van '%-.150s' naar '%-.150s' (Errcode: %d)"
eng "Error on rename of '%-.150s' to '%-.150s' (errno: %d)"
- jps "'%-.64s' ‚ð '%-.64s' ‚É rename ‚Å‚«‚Ü‚¹‚ñ (errno: %d)",
- est "Viga faili '%-.64s' ümbernimetamisel '%-.64s'-ks (veakood: %d)"
- fre "Erreur en renommant '%-.64s' en '%-.64s' (Errcode: %d)"
- ger "Fehler beim Umbenennen von '%-.64s' in '%-.64s' (Fehler: %d)"
- greek "Ðñüâëçìá êáôÜ ôçí ìåôïíïìáóßá ôïõ áñ÷åßïõ '%-.64s' to '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "Hiba a '%-.64s' file atnevezesekor. (hibakod: %d)"
- ita "Errore durante la rinominazione da '%-.64s' a '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¤ò '%-.64s' ¤Ë rename ¤Ç¤­¤Þ¤»¤ó (errno: %d)"
- kor "'%-.64s'¸¦ '%-.64s'·Î À̸§ º¯°æÁß ¿¡·¯ (¿¡·¯¹øÈ£: %d)"
- nor "Feil ved omdøping av '%-.64s' til '%-.64s' (Feilkode: %d)"
- norwegian-ny "Feil ved omdøyping av '%-.64s' til '%-.64s' (Feilkode: %d)"
- pol "B³?d podczas zmieniania nazwy '%-.64s' na '%-.64s' (Kod b³êdu: %d)"
- por "Erro ao renomear '%-.64s' para '%-.64s' (erro no. %d)"
- rum "Eroare incercind sa renumesc '%-.64s' in '%-.64s' (errno: %d)"
- rus "ïÛÉÂËÁ ÐÒÉ ÐÅÒÅÉÍÅÎÏ×ÁÎÉÉ '%-.64s' × '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Greška pri promeni imena '%-.64s' na '%-.64s' (errno: %d)"
- slo "Chyba pri premenovávaní '%-.64s' na '%-.64s' (chybový kód: %d)"
- spa "Error en el renombrado de '%-.64s' a '%-.64s' (Error: %d)"
- swe "Kan inte byta namn från '%-.64s' till '%-.64s' (Felkod: %d)"
- ukr "îÅ ÍÏÖÕ ÐÅÒÅÊÍÅÎÕ×ÁÔÉ '%-.64s' Õ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.150s' ‚ð '%-.150s' ‚É rename ‚Å‚«‚Ü‚¹‚ñ (errno: %d)",
+ est "Viga faili '%-.150s' ümbernimetamisel '%-.150s'-ks (veakood: %d)"
+ fre "Erreur en renommant '%-.150s' en '%-.150s' (Errcode: %d)"
+ ger "Fehler beim Umbenennen von '%-.150s' in '%-.150s' (Fehler: %d)"
+ greek "Ðñüâëçìá êáôÜ ôçí ìåôïíïìáóßá ôïõ áñ÷åßïõ '%-.150s' to '%-.150s' (êùäéêüò ëÜèïõò: %d)"
+ hun "Hiba a '%-.150s' file atnevezesekor '%-.150s'. (hibakod: %d)"
+ ita "Errore durante la rinominazione da '%-.150s' a '%-.150s' (errno: %d)"
+ jpn "'%-.150s' ¤ò '%-.150s' ¤Ë rename ¤Ç¤­¤Þ¤»¤ó (errno: %d)"
+ kor "'%-.150s'¸¦ '%-.150s'·Î À̸§ º¯°æÁß ¿¡·¯ (¿¡·¯¹øÈ£: %d)"
+ nor "Feil ved omdøping av '%-.150s' til '%-.150s' (Feilkode: %d)"
+ norwegian-ny "Feil ved omdøyping av '%-.150s' til '%-.150s' (Feilkode: %d)"
+ pol "B³?d podczas zmieniania nazwy '%-.150s' na '%-.150s' (Kod b³êdu: %d)"
+ por "Erro ao renomear '%-.150s' para '%-.150s' (erro no. %d)"
+ rum "Eroare incercind sa renumesc '%-.150s' in '%-.150s' (errno: %d)"
+ rus "ïÛÉÂËÁ ÐÒÉ ÐÅÒÅÉÍÅÎÏ×ÁÎÉÉ '%-.150s' × '%-.150s' (ÏÛÉÂËÁ: %d)"
+ serbian "Greška pri promeni imena '%-.150s' na '%-.150s' (errno: %d)"
+ slo "Chyba pri premenovávaní '%-.150s' na '%-.150s' (chybový kód: %d)"
+ spa "Error en el renombrado de '%-.150s' a '%-.150s' (Error: %d)"
+ swe "Kan inte byta namn från '%-.150s' till '%-.150s' (Felkod: %d)"
+ ukr "îÅ ÍÏÖÕ ÐÅÒÅÊÍÅÎÕ×ÁÔÉ '%-.150s' Õ '%-.150s' (ÐÏÍÉÌËÁ: %d)"
ER_ERROR_ON_WRITE
- cze "Chyba p-Bøi zápisu do souboru '%-.64s' (chybový kód: %d)"
- dan "Fejl ved skriving av filen '%-.64s' (Fejlkode: %d)"
- nla "Fout bij het wegschrijven van file '%-.64s' (Errcode: %d)"
+ cze "Chyba p-Bøi zápisu do souboru '%-.200s' (chybový kód: %d)"
+ dan "Fejl ved skriving av filen '%-.200s' (Fejlkode: %d)"
+ nla "Fout bij het wegschrijven van file '%-.200s' (Errcode: %d)"
eng "Error writing file '%-.200s' (errno: %d)"
- jps "'%-.64s' ƒtƒ@ƒCƒ‹‚ð‘‚­Ž–‚ª‚Å‚«‚Ü‚¹‚ñ (errno: %d)",
- est "Viga faili '%-.64s' kirjutamisel (veakood: %d)"
- fre "Erreur d'écriture du fichier '%-.64s' (Errcode: %d)"
- ger "Fehler beim Speichern der Datei '%-.64s' (Fehler: %d)"
- greek "Ðñüâëçìá êáôÜ ôçí áðïèÞêåõóç ôïõ áñ÷åßïõ '%-.64s' (êùäéêüò ëÜèïõò: %d)"
- hun "Hiba a '%-.64s' file irasakor. (hibakod: %d)"
- ita "Errore durante la scrittura del file '%-.64s' (errno: %d)"
- jpn "'%-.64s' ¥Õ¥¡¥¤¥ë¤ò½ñ¤¯»ö¤¬¤Ç¤­¤Þ¤»¤ó (errno: %d)"
- kor "'%-.64s'È­ÀÏ ±â·Ï Áß ¿¡·¯ (¿¡·¯¹øÈ£: %d)"
- nor "Feil ved skriving av fila '%-.64s' (Feilkode: %d)"
- norwegian-ny "Feil ved skriving av fila '%-.64s' (Feilkode: %d)"
- pol "B³?d podczas zapisywania pliku '%-.64s' (Kod b³êdu: %d)"
- por "Erro ao gravar arquivo '%-.64s' (erro no. %d)"
- rum "Eroare scriind fisierul '%-.64s' (errno: %d)"
- rus "ïÛÉÂËÁ ÚÁÐÉÓÉ × ÆÁÊÌ '%-.64s' (ÏÛÉÂËÁ: %d)"
- serbian "Greška pri upisu '%-.64s' (errno: %d)"
- slo "Chyba pri zápise do súboru '%-.64s' (chybový kód: %d)"
- spa "Error escribiendo el archivo '%-.64s' (Error: %d)"
- swe "Fick fel vid skrivning till '%-.64s' (Felkod %d)"
- ukr "îÅ ÍÏÖÕ ÚÁÐÉÓÁÔÉ ÆÁÊÌ '%-.64s' (ÐÏÍÉÌËÁ: %d)"
+ jps "'%-.200s' ƒtƒ@ƒCƒ‹‚ð‘‚­Ž–‚ª‚Å‚«‚Ü‚¹‚ñ (errno: %d)",
+ est "Viga faili '%-.200s' kirjutamisel (veakood: %d)"
+ fre "Erreur d'écriture du fichier '%-.200s' (Errcode: %d)"
+ ger "Fehler beim Speichern der Datei '%-.200s' (Fehler: %d)"
+ greek "Ðñüâëçìá êáôÜ ôçí áðïèÞêåõóç ôïõ áñ÷åßïõ '%-.200s' (êùäéêüò ëÜèïõò: %d)"
+ hun "Hiba a '%-.200s' file irasakor. (hibakod: %d)"
+ ita "Errore durante la scrittura del file '%-.200s' (errno: %d)"
+ jpn "'%-.200s' ¥Õ¥¡¥¤¥ë¤ò½ñ¤¯»ö¤¬¤Ç¤­¤Þ¤»¤ó (errno: %d)"
+ kor "'%-.200s'È­ÀÏ ±â·Ï Áß ¿¡·¯ (¿¡·¯¹øÈ£: %d)"
+ nor "Feil ved skriving av fila '%-.200s' (Feilkode: %d)"
+ norwegian-ny "Feil ved skriving av fila '%-.200s' (Feilkode: %d)"
+ pol "B³?d podczas zapisywania pliku '%-.200s' (Kod b³êdu: %d)"
+ por "Erro ao gravar arquivo '%-.200s' (erro no. %d)"
+ rum "Eroare scriind fisierul '%-.200s' (errno: %d)"
+ rus "ïÛÉÂËÁ ÚÁÐÉÓÉ × ÆÁÊÌ '%-.200s' (ÏÛÉÂËÁ: %d)"
+ serbian "Greška pri upisu '%-.200s' (errno: %d)"
+ slo "Chyba pri zápise do súboru '%-.200s' (chybový kód: %d)"
+ spa "Error escribiendo el archivo '%-.200s' (Error: %d)"
+ swe "Fick fel vid skrivning till '%-.200s' (Felkod %d)"
+ ukr "îÅ ÍÏÖÕ ÚÁÐÉÓÁÔÉ ÆÁÊÌ '%-.200s' (ÐÏÍÉÌËÁ: %d)"
ER_FILE_USED
cze "'%-.64s' je zam-Bèen proti zmìnám"
dan "'%-.64s' er låst mod opdateringer"
@@ -741,7 +741,7 @@ ER_ILLEGAL_HA
serbian "Handler tabela za '%-.64s' nema ovu opciju"
slo "Obsluha tabuµky '%-.64s' nemá tento parameter"
spa "El manejador de la tabla de '%-.64s' no tiene esta opcion"
- swe "Registrets databas har inte denna facilitet"
+ swe "Tabellhanteraren for tabell '%-.64s' stödjer ej detta"
ukr "äÅÓËÒÉÐÔÏÒ ÔÁÂÌÉæ '%-.64s' ÎÅ ÍÁ¤ 椧 ×ÌÁÓÔÉ×ÏÓÔ¦"
ER_KEY_NOT_FOUND
cze "Nemohu naj-Bít záznam v '%-.64s'"
@@ -766,58 +766,58 @@ ER_KEY_NOT_FOUND
serbian "Ne mogu da pronaðem slog u '%-.64s'"
slo "Nemô¾em nájs» záznam v '%-.64s'"
spa "No puedo encontrar el registro en '%-.64s'"
- swe "Hittar inte posten"
+ swe "Hittar inte posten '%-.64s'"
ukr "îÅ ÍÏÖÕ ÚÁÐÉÓÁÔÉ Õ '%-.64s'"
ER_NOT_FORM_FILE
- cze "Nespr-Bávná informace v souboru '%-.64s'"
- dan "Forkert indhold i: '%-.64s'"
- nla "Verkeerde info in file: '%-.64s'"
+ cze "Nespr-Bávná informace v souboru '%-.200s'"
+ dan "Forkert indhold i: '%-.200s'"
+ nla "Verkeerde info in file: '%-.200s'"
eng "Incorrect information in file: '%-.200s'"
- jps "ƒtƒ@ƒCƒ‹ '%-.64s' ‚Ì info ‚ªŠÔˆá‚Á‚Ä‚¢‚邿‚¤‚Å‚·",
- est "Vigane informatsioon failis '%-.64s'"
- fre "Information erronnée dans le fichier: '%-.64s'"
- ger "Falsche Information in Datei '%-.64s'"
- greek "ËÜèïò ðëçñïöïñßåò óôï áñ÷åßï: '%-.64s'"
- hun "Ervenytelen info a file-ban: '%-.64s'"
- ita "Informazione errata nel file: '%-.64s'"
- jpn "¥Õ¥¡¥¤¥ë '%-.64s' ¤Î info ¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤è¤¦¤Ç¤¹"
- kor "È­ÀÏÀÇ ºÎÁ¤È®ÇÑ Á¤º¸: '%-.64s'"
- nor "Feil informasjon i filen: '%-.64s'"
- norwegian-ny "Feil informasjon i fila: '%-.64s'"
- pol "Niew³a?ciwa informacja w pliku: '%-.64s'"
- por "Informação incorreta no arquivo '%-.64s'"
- rum "Informatie incorecta in fisierul: '%-.64s'"
- rus "îÅËÏÒÒÅËÔÎÁÑ ÉÎÆÏÒÍÁÃÉÑ × ÆÁÊÌÅ '%-.64s'"
- serbian "Pogrešna informacija u file-u: '%-.64s'"
- slo "Nesprávna informácia v súbore: '%-.64s'"
- spa "Informacion erronea en el archivo: '%-.64s'"
- swe "Felaktig fil: '%-.64s'"
- ukr "èÉÂÎÁ ¦ÎÆÏÒÍÁÃ¦Ñ Õ ÆÁÊ̦: '%-.64s'"
+ jps "ƒtƒ@ƒCƒ‹ '%-.200s' ‚Ì info ‚ªŠÔˆá‚Á‚Ä‚¢‚邿‚¤‚Å‚·",
+ est "Vigane informatsioon failis '%-.200s'"
+ fre "Information erronnée dans le fichier: '%-.200s'"
+ ger "Falsche Information in Datei '%-.200s'"
+ greek "ËÜèïò ðëçñïöïñßåò óôï áñ÷åßï: '%-.200s'"
+ hun "Ervenytelen info a file-ban: '%-.200s'"
+ ita "Informazione errata nel file: '%-.200s'"
+ jpn "¥Õ¥¡¥¤¥ë '%-.200s' ¤Î info ¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤è¤¦¤Ç¤¹"
+ kor "È­ÀÏÀÇ ºÎÁ¤È®ÇÑ Á¤º¸: '%-.200s'"
+ nor "Feil informasjon i filen: '%-.200s'"
+ norwegian-ny "Feil informasjon i fila: '%-.200s'"
+ pol "Niew³a?ciwa informacja w pliku: '%-.200s'"
+ por "Informação incorreta no arquivo '%-.200s'"
+ rum "Informatie incorecta in fisierul: '%-.200s'"
+ rus "îÅËÏÒÒÅËÔÎÁÑ ÉÎÆÏÒÍÁÃÉÑ × ÆÁÊÌÅ '%-.200s'"
+ serbian "Pogrešna informacija u file-u: '%-.200s'"
+ slo "Nesprávna informácia v súbore: '%-.200s'"
+ spa "Informacion erronea en el archivo: '%-.200s'"
+ swe "Felaktig fil: '%-.200s'"
+ ukr "èÉÂÎÁ ¦ÎÆÏÒÍÁÃ¦Ñ Õ ÆÁÊ̦: '%-.200s'"
ER_NOT_KEYFILE
- cze "Nespr-Bávný klíè pro tabulku '%-.64s'; pokuste se ho opravit"
- dan "Fejl i indeksfilen til tabellen '%-.64s'; prøv at reparere den"
- nla "Verkeerde zoeksleutel file voor tabel: '%-.64s'; probeer het te repareren"
+ cze "Nespr-Bávný klíè pro tabulku '%-.200s'; pokuste se ho opravit"
+ dan "Fejl i indeksfilen til tabellen '%-.200s'; prøv at reparere den"
+ nla "Verkeerde zoeksleutel file voor tabel: '%-.200s'; probeer het te repareren"
eng "Incorrect key file for table '%-.200s'; try to repair it"
- jps "'%-.64s' ƒe[ƒuƒ‹‚Ì key file ‚ªŠÔˆá‚Á‚Ä‚¢‚邿‚¤‚Å‚·. C•œ‚ð‚µ‚Ä‚­‚¾‚³‚¢",
- est "Tabeli '%-.64s' võtmefail on vigane; proovi seda parandada"
- fre "Index corrompu dans la table: '%-.64s'; essayez de le réparer"
- ger "Fehlerhafte Index-Datei für Tabelle '%-.64s'; versuche zu reparieren"
- greek "ËÜèïò áñ÷åßï ôáîéíüìéóçò (key file) ãéá ôïí ðßíáêá: '%-.64s'; Ðáñáêáëþ, äéïñèþóôå ôï!"
- hun "Ervenytelen kulcsfile a tablahoz: '%-.64s'; probalja kijavitani!"
- ita "File chiave errato per la tabella : '%-.64s'; prova a riparalo"
- jpn "'%-.64s' ¥Æ¡¼¥Ö¥ë¤Î key file ¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤è¤¦¤Ç¤¹. ½¤Éü¤ò¤·¤Æ¤¯¤À¤µ¤¤"
- kor "'%-.64s' Å×À̺íÀÇ ºÎÁ¤È®ÇÑ Å° Á¸Àç. ¼öÁ¤ÇϽÿÀ!"
- nor "Tabellen '%-.64s' har feil i nøkkelfilen; forsøk å reparer den"
- norwegian-ny "Tabellen '%-.64s' har feil i nykkelfila; prøv å reparere den"
- pol "Niew³a?ciwy plik kluczy dla tabeli: '%-.64s'; spróbuj go naprawiæ"
- por "Arquivo de índice incorreto para tabela '%-.64s'; tente repará-lo"
- rum "Cheia fisierului incorecta pentru tabela: '%-.64s'; incearca s-o repari"
- rus "îÅËÏÒÒÅËÔÎÙÊ ÉÎÄÅËÓÎÙÊ ÆÁÊÌ ÄÌÑ ÔÁÂÌÉÃÙ: '%-.64s'. ðÏÐÒÏÂÕÊÔÅ ×ÏÓÓÔÁÎÏ×ÉÔØ ÅÇÏ"
- serbian "Pogrešan key file za tabelu: '%-.64s'; probajte da ga ispravite"
- slo "Nesprávny kµúè pre tabuµku '%-.64s'; pokúste sa ho opravi»"
- spa "Clave de archivo erronea para la tabla: '%-.64s'; intente repararlo"
- swe "Fatalt fel vid hantering av register '%-.64s'; kör en reparation"
- ukr "èÉÂÎÉÊ ÆÁÊÌ ËÌÀÞÅÊ ÄÌÑ ÔÁÂÌÉæ: '%-.64s'; óÐÒÏÂÕÊÔÅ ÊÏÇÏ ×¦ÄÎÏ×ÉÔÉ"
+ jps "'%-.200s' ƒe[ƒuƒ‹‚Ì key file ‚ªŠÔˆá‚Á‚Ä‚¢‚邿‚¤‚Å‚·. C•œ‚ð‚µ‚Ä‚­‚¾‚³‚¢",
+ est "Tabeli '%-.200s' võtmefail on vigane; proovi seda parandada"
+ fre "Index corrompu dans la table: '%-.200s'; essayez de le réparer"
+ ger "Fehlerhafte Index-Datei für Tabelle '%-.200s'; versuche zu reparieren"
+ greek "ËÜèïò áñ÷åßï ôáîéíüìéóçò (key file) ãéá ôïí ðßíáêá: '%-.200s'; Ðáñáêáëþ, äéïñèþóôå ôï!"
+ hun "Ervenytelen kulcsfile a tablahoz: '%-.200s'; probalja kijavitani!"
+ ita "File chiave errato per la tabella : '%-.200s'; prova a riparalo"
+ jpn "'%-.200s' ¥Æ¡¼¥Ö¥ë¤Î key file ¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤è¤¦¤Ç¤¹. ½¤Éü¤ò¤·¤Æ¤¯¤À¤µ¤¤"
+ kor "'%-.200s' Å×À̺íÀÇ ºÎÁ¤È®ÇÑ Å° Á¸Àç. ¼öÁ¤ÇϽÿÀ!"
+ nor "Tabellen '%-.200s' har feil i nøkkelfilen; forsøk å reparer den"
+ norwegian-ny "Tabellen '%-.200s' har feil i nykkelfila; prøv å reparere den"
+ pol "Niew³a?ciwy plik kluczy dla tabeli: '%-.200s'; spróbuj go naprawiæ"
+ por "Arquivo de índice incorreto para tabela '%-.200s'; tente repará-lo"
+ rum "Cheia fisierului incorecta pentru tabela: '%-.200s'; incearca s-o repari"
+ rus "îÅËÏÒÒÅËÔÎÙÊ ÉÎÄÅËÓÎÙÊ ÆÁÊÌ ÄÌÑ ÔÁÂÌÉÃÙ: '%-.200s'. ðÏÐÒÏÂÕÊÔÅ ×ÏÓÓÔÁÎÏ×ÉÔØ ÅÇÏ"
+ serbian "Pogrešan key file za tabelu: '%-.200s'; probajte da ga ispravite"
+ slo "Nesprávny kµúè pre tabuµku '%-.200s'; pokúste sa ho opravi»"
+ spa "Clave de archivo erronea para la tabla: '%-.200s'; intente repararlo"
+ swe "Fatalt fel vid hantering av register '%-.200s'; kör en reparation"
+ ukr "èÉÂÎÉÊ ÆÁÊÌ ËÌÀÞÅÊ ÄÌÑ ÔÁÂÌÉæ: '%-.200s'; óÐÒÏÂÕÊÔÅ ÊÏÇÏ ×¦ÄÎÏ×ÉÔÉ"
ER_OLD_KEYFILE
cze "Star-Bý klíèový soubor pro '%-.64s'; opravte ho."
dan "Gammel indeksfil for tabellen '%-.64s'; reparer den"
@@ -1072,7 +1072,7 @@ ER_ACCESS_DENIED_ERROR 28000
jps "ƒ†[ƒU[ '%-.32s'@'%-.64s' ‚ð‹‘”Û‚µ‚Ü‚·.uUsing password: %s)",
est "Ligipääs keelatud kasutajale '%-.32s'@'%-.64s' (kasutab parooli: %s)"
fre "Accès refusé pour l'utilisateur: '%-.32s'@'@%-.64s' (mot de passe: %s)"
- ger "Benutzer '%-.32s'@'%-.64s' hat keine Zugriffsberechtigung (verwendetes Passwort: %-.64s)"
+ ger "Benutzer '%-.32s'@'%-.64s' hat keine Zugriffsberechtigung (verwendetes Passwort: %s)"
greek "Äåí åðéôÝñåôáé ç ðñüóâáóç óôï ÷ñÞóôç: '%-.32s'@'%-.64s' (÷ñÞóç password: %s)"
hun "A(z) '%-.32s'@'%-.64s' felhasznalo szamara tiltott eleres. (Hasznalja a jelszot: %s)"
ita "Accesso non consentito per l'utente: '%-.32s'@'%-.64s' (Password: %s)"
@@ -1239,28 +1239,28 @@ ER_BAD_TABLE_ERROR 42S02
swe "Okänd tabell '%-.100s'"
ukr "îÅצÄÏÍÁ ÔÁÂÌÉÃÑ '%-.100s'"
ER_NON_UNIQ_ERROR 23000
- cze "Sloupec '%-.64s' v %s nen-Bí zcela jasný"
- dan "Felt: '%-.64s' i tabel %s er ikke entydigt"
- nla "Kolom: '%-.64s' in %s is niet eenduidig"
+ cze "Sloupec '%-.64s' v %-.64s nen-Bí zcela jasný"
+ dan "Felt: '%-.64s' i tabel %-.64s er ikke entydigt"
+ nla "Kolom: '%-.64s' in %-.64s is niet eenduidig"
eng "Column '%-.64s' in %-.64s is ambiguous"
est "Väli '%-.64s' %-.64s-s ei ole ühene"
- fre "Champ: '%-.64s' dans %s est ambigu"
+ fre "Champ: '%-.64s' dans %-.64s est ambigu"
ger "Feld '%-.64s' in %-.64s ist nicht eindeutig"
greek "Ôï ðåäßï: '%-.64s' óå %-.64s äåí Ý÷åé êáèïñéóôåß"
hun "A(z) '%-.64s' oszlop %-.64s-ben ketertelmu"
ita "Colonna: '%-.64s' di %-.64s e` ambigua"
jpn "Column: '%-.64s' in %-.64s is ambiguous"
kor "Ä®·³: '%-.64s' in '%-.64s' ÀÌ ¸ðÈ£ÇÔ"
- nor "Felt: '%-.64s' i tabell %s er ikke entydig"
- norwegian-ny "Kolonne: '%-.64s' i tabell %s er ikkje eintydig"
- pol "Kolumna: '%-.64s' w %s jest dwuznaczna"
+ nor "Felt: '%-.64s' i tabell %-.64s er ikke entydig"
+ norwegian-ny "Kolonne: '%-.64s' i tabell %-.64s er ikkje eintydig"
+ pol "Kolumna: '%-.64s' w %-.64s jest dwuznaczna"
por "Coluna '%-.64s' em '%-.64s' é ambígua"
rum "Coloana: '%-.64s' in %-.64s este ambigua"
rus "óÔÏÌÂÅÃ '%-.64s' × %-.64s ÚÁÄÁÎ ÎÅÏÄÎÏÚÎÁÞÎÏ"
serbian "Kolona '%-.64s' u %-.64s nije jedinstvena u kontekstu"
slo "Pole: '%-.64s' v %-.64s je nejasné"
- spa "La columna: '%-.64s' en %s es ambigua"
- swe "Kolumn '%-.64s' i %s är inte unik"
+ spa "La columna: '%-.64s' en %-.64s es ambigua"
+ swe "Kolumn '%-.64s' i %-.64s är inte unik"
ukr "óÔÏ×ÂÅÃØ '%-.64s' Õ %-.64s ×ÉÚÎÁÞÅÎÉÊ ÎÅÏÄÎÏÚÎÁÞÎÏ"
ER_SERVER_SHUTDOWN 08S01
cze "Prob-Bíhá ukonèování práce serveru"
@@ -1288,29 +1288,29 @@ ER_SERVER_SHUTDOWN 08S01
swe "Servern går nu ned"
ukr "úÁ×ÅÒÛÕ¤ÔØÓÑ ÒÁÂÏÔÁ ÓÅÒ×ÅÒÁ"
ER_BAD_FIELD_ERROR 42S22 S0022
- cze "Nezn-Bámý sloupec '%-.64s' v %s"
- dan "Ukendt kolonne '%-.64s' i tabel %s"
- nla "Onbekende kolom '%-.64s' in %s"
+ cze "Nezn-Bámý sloupec '%-.64s' v %-.64s"
+ dan "Ukendt kolonne '%-.64s' i tabel %-.64s"
+ nla "Onbekende kolom '%-.64s' in %-.64s"
eng "Unknown column '%-.64s' in '%-.64s'"
jps "'%-.64s' column ‚Í '%-.64s' ‚ɂ͂ ‚è‚Ü‚¹‚ñ.",
est "Tundmatu tulp '%-.64s' '%-.64s'-s"
- fre "Champ '%-.64s' inconnu dans %s"
+ fre "Champ '%-.64s' inconnu dans %-.64s"
ger "Unbekanntes Tabellenfeld '%-.64s' in %-.64s"
greek "Áãíùóôï ðåäßï '%-.64s' óå '%-.64s'"
hun "A(z) '%-.64s' oszlop ervenytelen '%-.64s'-ben"
ita "Colonna sconosciuta '%-.64s' in '%-.64s'"
jpn "'%-.64s' column ¤Ï '%-.64s' ¤Ë¤Ï¤¢¤ê¤Þ¤»¤ó."
kor "Unknown Ä®·³ '%-.64s' in '%-.64s'"
- nor "Ukjent kolonne '%-.64s' i tabell %s"
- norwegian-ny "Ukjent felt '%-.64s' i tabell %s"
- pol "Nieznana kolumna '%-.64s' w %s"
+ nor "Ukjent kolonne '%-.64s' i tabell %-.64s"
+ norwegian-ny "Ukjent felt '%-.64s' i tabell %-.64s"
+ pol "Nieznana kolumna '%-.64s' w %-.64s"
por "Coluna '%-.64s' desconhecida em '%-.64s'"
rum "Coloana invalida '%-.64s' in '%-.64s'"
rus "îÅÉÚ×ÅÓÔÎÙÊ ÓÔÏÌÂÅà '%-.64s' × '%-.64s'"
serbian "Nepoznata kolona '%-.64s' u '%-.64s'"
slo "Neznáme pole '%-.64s' v '%-.64s'"
- spa "La columna '%-.64s' en %s es desconocida"
- swe "Okänd kolumn '%-.64s' i %s"
+ spa "La columna '%-.64s' en %-.64s es desconocida"
+ swe "Okänd kolumn '%-.64s' i %-.64s"
ukr "îÅצÄÏÍÉÊ ÓÔÏ×ÂÅÃØ '%-.64s' Õ '%-.64s'"
ER_WRONG_FIELD_WITH_GROUP 42000 S1009
cze "Pou-B¾ité '%-.64s' nebylo v group by"
@@ -1404,29 +1404,29 @@ ER_WRONG_VALUE_COUNT 21S01
swe "Antalet kolumner motsvarar inte antalet värden"
ukr "ë¦ÌØË¦ÓÔØ ÓÔÏ×ÂÃ¦× ÎÅ ÓЦ×ÐÁÄÁ¤ Ú Ë¦ÌØË¦ÓÔÀ ÚÎÁÞÅÎØ"
ER_TOO_LONG_IDENT 42000 S1009
- cze "Jm-Béno identifikátoru '%-.64s' je pøíli¹ dlouhé"
- dan "Navnet '%-.64s' er for langt"
- nla "Naam voor herkenning '%-.64s' is te lang"
+ cze "Jm-Béno identifikátoru '%-.100s' je pøíli¹ dlouhé"
+ dan "Navnet '%-.100s' er for langt"
+ nla "Naam voor herkenning '%-.100s' is te lang"
eng "Identifier name '%-.100s' is too long"
jps "Identifier name '%-.100s' ‚Í’·‚·‚¬‚Ü‚·",
est "Identifikaatori '%-.100s' nimi on liiga pikk"
- fre "Le nom de l'identificateur '%-.64s' est trop long"
+ fre "Le nom de l'identificateur '%-.100s' est trop long"
ger "Name des Bezeichners '%-.100s' ist zu lang"
greek "Ôï identifier name '%-.100s' åßíáé ðïëý ìåãÜëï"
hun "A(z) '%-.100s' azonositonev tul hosszu."
ita "Il nome dell'identificatore '%-.100s' e` troppo lungo"
jpn "Identifier name '%-.100s' ¤ÏŤ¹¤®¤Þ¤¹"
kor "Identifier '%-.100s'´Â ³Ê¹« ±æ±º¿ä."
- nor "Identifikator '%-.64s' er for lang"
- norwegian-ny "Identifikator '%-.64s' er for lang"
- pol "Nazwa identyfikatora '%-.64s' jest zbyt d³uga"
+ nor "Identifikator '%-.100s' er for lang"
+ norwegian-ny "Identifikator '%-.100s' er for lang"
+ pol "Nazwa identyfikatora '%-.100s' jest zbyt d³uga"
por "Nome identificador '%-.100s' é longo demais"
rum "Numele indentificatorului '%-.100s' este prea lung"
rus "óÌÉÛËÏÍ ÄÌÉÎÎÙÊ ÉÄÅÎÔÉÆÉËÁÔÏÒ '%-.100s'"
serbian "Ime '%-.100s' je predugaèko"
slo "Meno identifikátora '%-.100s' je príli¹ dlhé"
- spa "El nombre del identificador '%-.64s' es demasiado grande"
- swe "Kolumnnamn '%-.64s' är för långt"
+ spa "El nombre del identificador '%-.100s' es demasiado grande"
+ swe "Kolumnnamn '%-.100s' är för långt"
ukr "¶Í'Ñ ¦ÄÅÎÔÉÆ¦ËÁÔÏÒÁ '%-.100s' ÚÁÄÏ×ÇÅ"
ER_DUP_FIELDNAME 42S21 S1009
cze "Zdvojen-Bé jméno sloupce '%-.64s'"
@@ -1479,7 +1479,7 @@ ER_DUP_KEYNAME 42000 S1009
swe "Nyckelnamn '%-.64s' finns flera gånger"
ukr "äÕÂÌÀÀÞÅ ¦Í'Ñ ËÌÀÞÁ '%-.64s'"
ER_DUP_ENTRY 23000 S1009
- cze "Zvojen-Bý klíè '%-.64s' (èíslo klíèe %d)"
+ cze "Zdvojen-Bý klíè '%-.64s' (èíslo klíèe %d)"
dan "Ens værdier '%-.64s' for indeks %d"
nla "Dubbele ingang '%-.64s' voor zoeksleutel %d"
eng "Duplicate entry '%-.64s' for key %d"
@@ -1527,29 +1527,29 @@ ER_WRONG_FIELD_SPEC 42000 S1009
swe "Felaktigt kolumntyp för kolumn '%-.64s'"
ukr "îÅצÒÎÉÊ ÓÐÅÃÉÆ¦ËÁÔÏÒ ÓÔÏ×ÂÃÑ '%-.64s'"
ER_PARSE_ERROR 42000
- cze "%s bl-Bízko '%-.64s' na øádku %d"
- dan "%s nær '%-.64s' på linje %d"
- nla "%s bij '%-.64s' in regel %d"
+ cze "%s bl-Bízko '%-.80s' na øádku %d"
+ dan "%s nær '%-.80s' på linje %d"
+ nla "%s bij '%-.80s' in regel %d"
eng "%s near '%-.80s' at line %d"
jps "%s : '%-.80s' •t‹ß : %d s–Ú",
est "%s '%-.80s' ligidal real %d"
- fre "%s près de '%-.64s' à la ligne %d"
+ fre "%s près de '%-.80s' à la ligne %d"
ger "%s bei '%-.80s' in Zeile %d"
greek "%s ðëçóßïí '%-.80s' óôç ãñáììÞ %d"
hun "A %s a '%-.80s'-hez kozeli a %d sorban"
ita "%s vicino a '%-.80s' linea %d"
jpn "%s : '%-.80s' ÉÕ¶á : %d ¹ÔÌÜ"
- kor "'%-.64s' ¿¡·¯ °°À¾´Ï´Ù. ('%-.80s' ¸í·É¾î ¶óÀÎ %d)"
- nor "%s nær '%-.64s' på linje %d"
- norwegian-ny "%s attmed '%-.64s' på line %d"
- pol "%s obok '%-.64s' w linii %d"
+ kor "'%s' ¿¡·¯ °°À¾´Ï´Ù. ('%-.80s' ¸í·É¾î ¶óÀÎ %d)"
+ nor "%s nær '%-.80s' på linje %d"
+ norwegian-ny "%s attmed '%-.80s' på line %d"
+ pol "%s obok '%-.80s' w linii %d"
por "%s próximo a '%-.80s' na linha %d"
rum "%s linga '%-.80s' pe linia %d"
rus "%s ÏËÏÌÏ '%-.80s' ÎÁ ÓÔÒÏËÅ %d"
serbian "'%s' u iskazu '%-.80s' na liniji %d"
slo "%s blízko '%-.80s' na riadku %d"
- spa "%s cerca '%-.64s' en la linea %d"
- swe "%s nära '%-.64s' på rad %d"
+ spa "%s cerca '%-.80s' en la linea %d"
+ swe "%s nära '%-.80s' på rad %d"
ukr "%s ¦ÌÑ '%-.80s' × ÓÔÒÏæ %d"
ER_EMPTY_QUERY 42000
cze "V-Býsledek dotazu je prázdný"
@@ -1821,30 +1821,30 @@ ER_WRONG_AUTO_KEY 42000 S1009
swe "Det får finnas endast ett AUTO_INCREMENT-fält och detta måste vara en nyckel"
ukr "îÅצÒÎÅ ×ÉÚÎÁÞÅÎÎÑ ÔÁÂÌÉæ; íÏÖÅ ÂÕÔÉ ÌÉÛÅ ÏÄÉÎ Á×ÔÏÍÁÔÉÞÎÉÊ ÓÔÏ×ÂÅÃØ, ÝÏ ÐÏ×ÉÎÅÎ ÂÕÔÉ ×ÉÚÎÁÞÅÎÉÊ ÑË ËÌÀÞ"
ER_READY
- cze "%s: p-Bøipraven na spojení"
- dan "%s: klar til tilslutninger"
- nla "%s: klaar voor verbindingen"
+ cze "%s: p-Bøipraven na spojení\nVersion: '%s' socket: '%s' port: %d"
+ dan "%s: klar til tilslutninger\nVersion: '%s' socket: '%s' port: %d"
+ nla "%s: klaar voor verbindingen\nVersion: '%s' socket: '%s' port: %d"
eng "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d"
- jps "%s: €”õŠ®—¹",
- est "%s: ootab ühendusi"
- fre "%s: Prêt pour des connections"
- ger "%-.64s: Bereit für Verbindungen.\nVersion: '%2' Socket: '%s' Port: %d"
- greek "%s: óå áíáìïíÞ óõíäÝóåùí"
- hun "%s: kapcsolatra kesz"
- ita "%s: Pronto per le connessioni\n"
- jpn "%s: ½àÈ÷´°Î»"
- kor "%s: ¿¬°á ÁغñÁßÀÔ´Ï´Ù"
- nor "%s: klar for tilkoblinger"
- norwegian-ny "%s: klar for tilkoblingar"
- pol "%s: gotowe do po³?czenia"
- por "%s: Pronto para conexões"
- rum "%s: sint gata pentru conectii"
- rus "%s: çÏÔÏ× ÐÒÉÎÉÍÁÔØ ÓÏÅÄÉÎÅÎÉÑ.\n÷ÅÒÓÉÑ: '%s' ÓÏËÅÔ: '%s' ÐÏÒÔ: %d %s"
- serbian "%s: Spreman za konekcije\n"
- slo "%s: pripravený na spojenie"
- spa "%s: preparado para conexiones"
- swe "%s: klar att ta emot klienter"
- ukr "%s: çÏÔÏ×ÉÊ ÄÌÑ Ú'¤ÄÎÁÎØ!"
+ jps "%s: €”õŠ®—¹\nVersion: '%s' socket: '%s' port: %d",
+ est "%s: ootab ühendusi\nVersion: '%s' socket: '%s' port: %d"
+ fre "%s: Prêt pour des connections\nVersion: '%s' socket: '%s' port: %d"
+ ger "%s: Bereit für Verbindungen.\nVersion: '%s' Socket: '%s' Port: %d"
+ greek "%s: óå áíáìïíÞ óõíäÝóåùí\nVersion: '%s' socket: '%s' port: %d"
+ hun "%s: kapcsolatra kesz\nVersion: '%s' socket: '%s' port: %d"
+ ita "%s: Pronto per le connessioni\nVersion: '%s' socket: '%s' port: %d"
+ jpn "%s: ½àÈ÷´°Î»\nVersion: '%s' socket: '%s' port: %d"
+ kor "%s: ¿¬°á ÁغñÁßÀÔ´Ï´Ù\nVersion: '%s' socket: '%s' port: %d"
+ nor "%s: klar for tilkoblinger\nVersion: '%s' socket: '%s' port: %d"
+ norwegian-ny "%s: klar for tilkoblingar\nVersion: '%s' socket: '%s' port: %d"
+ pol "%s: gotowe do po³?czenia\nVersion: '%s' socket: '%s' port: %d"
+ por "%s: Pronto para conexões\nVersion: '%s' socket: '%s' port: %d"
+ rum "%s: sint gata pentru conectii\nVersion: '%s' socket: '%s' port: %d"
+ rus "%s: çÏÔÏ× ÐÒÉÎÉÍÁÔØ ÓÏÅÄÉÎÅÎÉÑ.\n÷ÅÒÓÉÑ: '%s' ÓÏËÅÔ: '%s' ÐÏÒÔ: %d"
+ serbian "%s: Spreman za konekcije\nVersion: '%s' socket: '%s' port: %d"
+ slo "%s: pripravený na spojenie\nVersion: '%s' socket: '%s' port: %d"
+ spa "%s: preparado para conexiones\nVersion: '%s' socket: '%s' port: %d"
+ swe "%s: klar att ta emot klienter\nVersion: '%s' socket: '%s' port: %d"
+ ukr "%s: çÏÔÏ×ÉÊ ÄÌÑ Ú'¤ÄÎÁÎØ!\nVersion: '%s' socket: '%s' port: %d"
ER_NORMAL_SHUTDOWN
cze "%s: norm-Bální ukonèení\n"
dan "%s: Normal nedlukning\n"
@@ -1852,7 +1852,7 @@ ER_NORMAL_SHUTDOWN
eng "%s: Normal shutdown\n"
est "%s: MySQL lõpetas\n"
fre "%s: Arrêt normal du serveur\n"
- ger "%-.64s: Normal heruntergefahren\n"
+ ger "%s: Normal heruntergefahren\n"
greek "%s: ÖõóéïëïãéêÞ äéáäéêáóßá shutdown\n"
hun "%s: Normal leallitas\n"
ita "%s: Shutdown normale\n"
@@ -1876,7 +1876,7 @@ ER_GOT_SIGNAL
jps "%s: Got signal %d. ’†’f!\n",
est "%s: sain signaali %d. Lõpetan!\n"
fre "%s: Reçu le signal %d. Abandonne!\n"
- ger "%-.64s: Signal %d erhalten. Abbruch!\n"
+ ger "%s: Signal %d erhalten. Abbruch!\n"
greek "%s: ÅëÞöèç ôï ìÞíõìá %d. Ç äéáäéêáóßá åãêáôáëåßðåôáé!\n"
hun "%s: %d jelzes. Megszakitva!\n"
ita "%s: Ricevuto segnale %d. Interruzione!\n"
@@ -1901,7 +1901,7 @@ ER_SHUTDOWN_COMPLETE
jps "%s: Shutdown Š®—¹\n",
est "%s: Lõpp\n"
fre "%s: Arrêt du serveur terminé\n"
- ger "%-.64s: Herunterfahren beendet\n"
+ ger "%s: Herunterfahren beendet\n"
greek "%s: Ç äéáäéêáóßá Shutdown ïëïêëçñþèçêå\n"
hun "%s: A leallitas kesz\n"
ita "%s: Shutdown completato\n"
@@ -1919,29 +1919,29 @@ ER_SHUTDOWN_COMPLETE
swe "%s: Avslutning klar\n"
ukr "%s: òÏÂÏÔÕ ÚÁ×ÅÒÛÅÎÏ\n"
ER_FORCING_CLOSE 08S01
- cze "%s: n-Básilné uzavøení threadu %ld u¾ivatele '%-.64s'\n"
- dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.64s'\n"
- nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.64s'\n"
+ cze "%s: n-Básilné uzavøení threadu %ld u¾ivatele '%-.32s'\n"
+ dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.32s'\n"
+ nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.32s'\n"
eng "%s: Forcing close of thread %ld user: '%-.32s'\n"
- jps "%s: ƒXƒŒƒbƒh %ld ‹­§I—¹ user: '%-.64s'\n",
+ jps "%s: ƒXƒŒƒbƒh %ld ‹­§I—¹ user: '%-.32s'\n",
est "%s: Sulgen jõuga lõime %ld kasutaja: '%-.32s'\n"
- fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.64s'\n"
+ fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.32s'\n"
ger "%s: Thread %ld zwangsweise beendet. Benutzer: '%-.32s'\n"
- greek "%s: Ôï thread èá êëåßóåé %ld user: '%-.64s'\n"
- hun "%s: A(z) %ld thread kenyszeritett zarasa. Felhasznalo: '%-.64s'\n"
- ita "%s: Forzata la chiusura del thread %ld utente: '%-.64s'\n"
- jpn "%s: ¥¹¥ì¥Ã¥É %ld ¶¯À©½ªÎ» user: '%-.64s'\n"
- kor "%s: thread %ldÀÇ °­Á¦ Á¾·á user: '%-.64s'\n"
- nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.64s'\n"
- norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.64s'\n"
- pol "%s: Wymuszenie zamkniêcia w?tku %ld u¿ytkownik: '%-.64s'\n"
+ greek "%s: Ôï thread èá êëåßóåé %ld user: '%-.32s'\n"
+ hun "%s: A(z) %ld thread kenyszeritett zarasa. Felhasznalo: '%-.32s'\n"
+ ita "%s: Forzata la chiusura del thread %ld utente: '%-.32s'\n"
+ jpn "%s: ¥¹¥ì¥Ã¥É %ld ¶¯À©½ªÎ» user: '%-.32s'\n"
+ kor "%s: thread %ldÀÇ °­Á¦ Á¾·á user: '%-.32s'\n"
+ nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.32s'\n"
+ norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.32s'\n"
+ pol "%s: Wymuszenie zamkniêcia w?tku %ld u¿ytkownik: '%-.32s'\n"
por "%s: Forçando finalização da 'thread' %ld - usuário '%-.32s'\n"
rum "%s: Terminare fortata a thread-ului %ld utilizatorului: '%-.32s'\n"
rus "%s: ðÒÉÎÕÄÉÔÅÌØÎÏ ÚÁËÒÙ×ÁÅÍ ÐÏÔÏË %ld ÐÏÌØÚÏ×ÁÔÅÌÑ: '%-.32s'\n"
serbian "%s: Usiljeno gašenje thread-a %ld koji pripada korisniku: '%-.32s'\n"
- slo "%s: násilné ukonèenie vlákna %ld u¾ívateµa '%-.64s'\n"
- spa "%s: Forzando a cerrar el thread %ld usuario: '%-.64s'\n"
- swe "%s: Stänger av tråd %ld; användare: '%-.64s'\n"
+ slo "%s: násilné ukonèenie vlákna %ld u¾ívateµa '%-.32s'\n"
+ spa "%s: Forzando a cerrar el thread %ld usuario: '%-.32s'\n"
+ swe "%s: Stänger av tråd %ld; användare: '%-.32s'\n"
ukr "%s: ðÒÉÓËÏÒÀÀ ÚÁËÒÉÔÔÑ Ç¦ÌËÉ %ld ËÏÒÉÓÔÕ×ÁÞÁ: '%-.32s'\n"
ER_IPSOCK_ERROR 08S01
cze "Nemohu vytvo-Bøit IP socket"
@@ -2041,55 +2041,55 @@ ER_BLOBS_AND_NO_TERMINATED 42000 S1009
swe "Man kan inte använda fast radlängd med blobs. Använd 'fields terminated by'"
ukr "îÅ ÍÏÖÎÁ ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ ÓÔÁÌÕ ÄÏ×ÖÉÎÕ ÓÔÒÏËÉ Ú BLOB. úËÏÒÉÓÔÁÊÔÅÓÑ 'fields terminated by'"
ER_TEXTFILE_NOT_READABLE
- cze "Soubor '%-.64s' mus-Bí být v adresáøi databáze nebo èitelný pro v¹echny"
- dan "Filen '%-.64s' skal være i database-folderen og kunne læses af alle"
- nla "Het bestand '%-.64s' dient in de database directory voor the komen of leesbaar voor iedereen te zijn."
+ cze "Soubor '%-.128s' mus-Bí být v adresáøi databáze nebo èitelný pro v¹echny"
+ dan "Filen '%-.128s' skal være i database-folderen og kunne læses af alle"
+ nla "Het bestand '%-.128s' dient in de database directory voor the komen of leesbaar voor iedereen te zijn."
eng "The file '%-.128s' must be in the database directory or be readable by all"
- jps "ƒtƒ@ƒCƒ‹ '%-.64s' ‚Í databse ‚Ì directory ‚É‚ ‚é‚©‘S‚Ẵ†[ƒU[‚ª“Ç‚ß‚é‚æ‚¤‚É‹–‰Â‚³‚ê‚Ä‚¢‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ.",
- est "Fail '%-.64s' peab asuma andmebaasi kataloogis või olema kõigile loetav"
- fre "Le fichier '%-.64s' doit être dans le répertoire de la base et lisible par tous"
- ger "Datei '%-.64s' muss im Datenbank-Verzeichnis vorhanden oder lesbar für alle sein"
- greek "Ôï áñ÷åßï '%-.64s' ðñÝðåé íá õðÜñ÷åé óôï database directory Þ íá ìðïñåß íá äéáâáóôåß áðü üëïõò"
- hun "A(z) '%-.64s'-nak az adatbazis konyvtarban kell lennie, vagy mindenki szamara olvashatonak"
- ita "Il file '%-.64s' deve essere nella directory del database e deve essere leggibile da tutti"
- jpn "¥Õ¥¡¥¤¥ë '%-.64s' ¤Ï databse ¤Î directory ¤Ë¤¢¤ë¤«Á´¤Æ¤Î¥æ¡¼¥¶¡¼¤¬ÆÉ¤á¤ë¤è¤¦¤Ëµö²Ä¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó."
- kor "'%-.64s' È­ÀÏ´Â µ¥ÀÌŸº£À̽º µð·ºÅ丮¿¡ Á¸ÀçÇϰųª ¸ðµÎ¿¡°Ô Àб⠰¡´ÉÇÏ¿©¾ß ÇÕ´Ï´Ù."
- nor "Filen '%-.64s' må være i database-katalogen for å være lesbar for alle"
- norwegian-ny "Filen '%-.64s' må være i database-katalogen for å være lesbar for alle"
- pol "Plik '%-.64s' musi znajdowaæ sie w katalogu bazy danych lub mieæ prawa czytania przez wszystkich"
- por "Arquivo '%-.64s' tem que estar no diretório do banco de dados ou ter leitura possível para todos"
- rum "Fisierul '%-.64s' trebuie sa fie in directorul bazei de data sau trebuie sa poata sa fie citit de catre toata lumea (verifica permisiile)"
- rus "æÁÊÌ '%-.64s' ÄÏÌÖÅÎ ÎÁÈÏÄÉÔØÓÑ × ÔÏÍ ÖÅ ËÁÔÁÌÏÇÅ, ÞÔÏ É ÂÁÚÁ ÄÁÎÎÙÈ, ÉÌÉ ÂÙÔØ ÏÂÝÅÄÏÓÔÕÐÎÙÍ ÄÌÑ ÞÔÅÎÉÑ"
- serbian "File '%-.64s' mora biti u direktorijumu gde su file-ovi baze i mora imati odgovarajuæa prava pristupa"
- slo "Súbor '%-.64s' musí by» v adresári databázy, alebo èitateµný pre v¹etkých"
- spa "El archivo '%-.64s' debe estar en el directorio de la base de datos o ser de lectura por todos"
- swe "Textfilen '%.64s' måste finnas i databasbiblioteket eller vara läsbar för alla"
- ukr "æÁÊÌ '%-.64s' ÐÏ×ÉÎÅÎ ÂÕÔÉ Õ ÔÅæ ÂÁÚÉ ÄÁÎÎÉÈ ÁÂÏ ÍÁÔÉ ×ÓÔÁÎÏ×ÌÅÎÅ ÐÒÁ×Ï ÎÁ ÞÉÔÁÎÎÑ ÄÌÑ ÕÓ¦È"
+ jps "ƒtƒ@ƒCƒ‹ '%-.128s' ‚Í databse ‚Ì directory ‚É‚ ‚é‚©‘S‚Ẵ†[ƒU[‚ª“Ç‚ß‚é‚æ‚¤‚É‹–‰Â‚³‚ê‚Ä‚¢‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ.",
+ est "Fail '%-.128s' peab asuma andmebaasi kataloogis või olema kõigile loetav"
+ fre "Le fichier '%-.128s' doit être dans le répertoire de la base et lisible par tous"
+ ger "Datei '%-.128s' muss im Datenbank-Verzeichnis vorhanden oder lesbar für alle sein"
+ greek "Ôï áñ÷åßï '%-.128s' ðñÝðåé íá õðÜñ÷åé óôï database directory Þ íá ìðïñåß íá äéáâáóôåß áðü üëïõò"
+ hun "A(z) '%-.128s'-nak az adatbazis konyvtarban kell lennie, vagy mindenki szamara olvashatonak"
+ ita "Il file '%-.128s' deve essere nella directory del database e deve essere leggibile da tutti"
+ jpn "¥Õ¥¡¥¤¥ë '%-.128s' ¤Ï databse ¤Î directory ¤Ë¤¢¤ë¤«Á´¤Æ¤Î¥æ¡¼¥¶¡¼¤¬ÆÉ¤á¤ë¤è¤¦¤Ëµö²Ä¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó."
+ kor "'%-.128s' È­ÀÏ´Â µ¥ÀÌŸº£À̽º µð·ºÅ丮¿¡ Á¸ÀçÇϰųª ¸ðµÎ¿¡°Ô Àб⠰¡´ÉÇÏ¿©¾ß ÇÕ´Ï´Ù."
+ nor "Filen '%-.128s' må være i database-katalogen for å være lesbar for alle"
+ norwegian-ny "Filen '%-.128s' må være i database-katalogen for å være lesbar for alle"
+ pol "Plik '%-.128s' musi znajdowaæ sie w katalogu bazy danych lub mieæ prawa czytania przez wszystkich"
+ por "Arquivo '%-.128s' tem que estar no diretório do banco de dados ou ter leitura possível para todos"
+ rum "Fisierul '%-.128s' trebuie sa fie in directorul bazei de data sau trebuie sa poata sa fie citit de catre toata lumea (verifica permisiile)"
+ rus "æÁÊÌ '%-.128s' ÄÏÌÖÅÎ ÎÁÈÏÄÉÔØÓÑ × ÔÏÍ ÖÅ ËÁÔÁÌÏÇÅ, ÞÔÏ É ÂÁÚÁ ÄÁÎÎÙÈ, ÉÌÉ ÂÙÔØ ÏÂÝÅÄÏÓÔÕÐÎÙÍ ÄÌÑ ÞÔÅÎÉÑ"
+ serbian "File '%-.128s' mora biti u direktorijumu gde su file-ovi baze i mora imati odgovarajuæa prava pristupa"
+ slo "Súbor '%-.128s' musí by» v adresári databázy, alebo èitateµný pre v¹etkých"
+ spa "El archivo '%-.128s' debe estar en el directorio de la base de datos o ser de lectura por todos"
+ swe "Textfilen '%-.128s' måste finnas i databasbiblioteket eller vara läsbar för alla"
+ ukr "æÁÊÌ '%-.128s' ÐÏ×ÉÎÅÎ ÂÕÔÉ Õ ÔÅæ ÂÁÚÉ ÄÁÎÎÉÈ ÁÂÏ ÍÁÔÉ ×ÓÔÁÎÏ×ÌÅÎÅ ÐÒÁ×Ï ÎÁ ÞÉÔÁÎÎÑ ÄÌÑ ÕÓ¦È"
ER_FILE_EXISTS_ERROR
- cze "Soubor '%-.64s' ji-B¾ existuje"
- dan "Filen '%-.64s' eksisterer allerede"
- nla "Het bestand '%-.64s' bestaat reeds"
+ cze "Soubor '%-.200s' ji-B¾ existuje"
+ dan "Filen '%-.200s' eksisterer allerede"
+ nla "Het bestand '%-.200s' bestaat reeds"
eng "File '%-.200s' already exists"
- jps "File '%-.64s' ‚ÍŠù‚É‘¶Ý‚µ‚Ü‚·",
- est "Fail '%-.80s' juba eksisteerib"
- fre "Le fichier '%-.64s' existe déjà"
- ger "Datei '%-.80s' bereits vorhanden"
- greek "Ôï áñ÷åßï '%-.64s' õðÜñ÷åé Þäç"
- hun "A '%-.64s' file mar letezik."
- ita "Il file '%-.64s' esiste gia`"
- jpn "File '%-.64s' ¤Ï´û¤Ë¸ºß¤·¤Þ¤¹"
- kor "'%-.64s' È­ÀÏÀº ÀÌ¹Ì Á¸ÀçÇÕ´Ï´Ù."
- nor "Filen '%-.64s' eksisterte allerede"
- norwegian-ny "Filen '%-.64s' eksisterte allereide"
- pol "Plik '%-.64s' ju¿ istnieje"
- por "Arquivo '%-.80s' já existe"
- rum "Fisierul '%-.80s' exista deja"
- rus "æÁÊÌ '%-.80s' ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ"
- serbian "File '%-.80s' veæ postoji"
- slo "Súbor '%-.64s' u¾ existuje"
- spa "El archivo '%-.64s' ya existe"
- swe "Filen '%-.64s' existerar redan"
- ukr "æÁÊÌ '%-.80s' ×ÖÅ ¦ÓÎÕ¤"
+ jps "File '%-.200s' ‚ÍŠù‚É‘¶Ý‚µ‚Ü‚·",
+ est "Fail '%-.200s' juba eksisteerib"
+ fre "Le fichier '%-.200s' existe déjà"
+ ger "Datei '%-.200s' bereits vorhanden"
+ greek "Ôï áñ÷åßï '%-.200s' õðÜñ÷åé Þäç"
+ hun "A '%-.200s' file mar letezik."
+ ita "Il file '%-.200s' esiste gia`"
+ jpn "File '%-.200s' ¤Ï´û¤Ë¸ºß¤·¤Þ¤¹"
+ kor "'%-.200s' È­ÀÏÀº ÀÌ¹Ì Á¸ÀçÇÕ´Ï´Ù."
+ nor "Filen '%-.200s' eksisterte allerede"
+ norwegian-ny "Filen '%-.200s' eksisterte allereide"
+ pol "Plik '%-.200s' ju¿ istnieje"
+ por "Arquivo '%-.200s' já existe"
+ rum "Fisierul '%-.200s' exista deja"
+ rus "æÁÊÌ '%-.200s' ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ"
+ serbian "File '%-.200s' veæ postoji"
+ slo "Súbor '%-.200s' u¾ existuje"
+ spa "El archivo '%-.200s' ya existe"
+ swe "Filen '%-.200s' existerar redan"
+ ukr "æÁÊÌ '%-.200s' ×ÖÅ ¦ÓÎÕ¤"
ER_LOAD_INFO
cze "Z-Báznamù: %ld Vymazáno: %ld Pøeskoèeno: %ld Varování: %ld"
dan "Poster: %ld Fjernet: %ld Sprunget over: %ld Advarsler: %ld"
@@ -2319,51 +2319,51 @@ ER_NO_TABLES_USED
swe "Inga tabeller angivna"
ukr "îÅ ×ÉËÏÒÉÓÔÁÎÏ ÔÁÂÌÉÃØ"
ER_TOO_BIG_SET
- cze "P-Bøíli¹ mnoho øetìzcù pro sloupec %s a SET"
+ cze "P-Bøíli¹ mnoho øetìzcù pro sloupec %-.64s a SET"
dan "For mange tekststrenge til specifikationen af SET i kolonne %-.64s"
- nla "Teveel strings voor kolom %s en SET"
+ nla "Teveel strings voor kolom %-.64s en SET"
eng "Too many strings for column %-.64s and SET"
est "Liiga palju string tulbale %-.64s tüübile SET"
- fre "Trop de chaînes dans la colonne %s avec SET"
+ fre "Trop de chaînes dans la colonne %-.64s avec SET"
ger "Zu viele Strings für Feld %-.64s und SET angegeben"
greek "ÐÜñá ðïëëÜ strings ãéá ôï ðåäßï %-.64s êáé SET"
hun "Tul sok karakter: %-.64s es SET"
ita "Troppe stringhe per la colonna %-.64s e la SET"
kor "Ä®·³ %-.64s¿Í SET¿¡¼­ ½ºÆ®¸µÀÌ ³Ê¹« ¸¹½À´Ï´Ù."
- nor "For mange tekststrenger kolonne %s og SET"
- norwegian-ny "For mange tekststrengar felt %s og SET"
- pol "Zbyt wiele ³añcuchów dla kolumny %s i polecenia SET"
+ nor "For mange tekststrenger kolonne %-.64s og SET"
+ norwegian-ny "For mange tekststrengar felt %-.64s og SET"
+ pol "Zbyt wiele ³añcuchów dla kolumny %-.64s i polecenia SET"
por "'Strings' demais para coluna '%-.64s' e SET"
rum "Prea multe siruri pentru coloana %-.64s si SET"
rus "óÌÉÛËÏÍ ÍÎÏÇÏ ÚÎÁÞÅÎÉÊ ÄÌÑ ÓÔÏÌÂÃÁ %-.64s × SET"
serbian "Previše string-ova za kolonu '%-.64s' i komandu 'SET'"
slo "Príli¹ mnoho re»azcov pre pole %-.64s a SET"
- spa "Muchas strings para columna %s y SET"
- swe "För många alternativ till kolumn %s för SET"
+ spa "Muchas strings para columna %-.64s y SET"
+ swe "För många alternativ till kolumn %-.64s för SET"
ukr "úÁÂÁÇÁÔÏ ÓÔÒÏË ÄÌÑ ÓÔÏ×ÂÃÑ %-.64s ÔÁ SET"
ER_NO_UNIQUE_LOGFILE
- cze "Nemohu vytvo-Bøit jednoznaèné jméno logovacího souboru %s.(1-999)\n"
- dan "Kan ikke lave unikt log-filnavn %s.(1-999)\n"
- nla "Het is niet mogelijk een unieke naam te maken voor de logfile %s.(1-999)\n"
+ cze "Nemohu vytvo-Bøit jednoznaèné jméno logovacího souboru %-.200s.(1-999)\n"
+ dan "Kan ikke lave unikt log-filnavn %-.200s.(1-999)\n"
+ nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)\n"
eng "Can't generate a unique log-filename %-.200s.(1-999)\n"
- est "Ei suuda luua unikaalset logifaili nime %-.64s.(1-999)\n"
- fre "Ne peut générer un unique nom de journal %s.(1-999)\n"
- ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.64s(1-999) erzeugen\n"
- greek "Áäýíáôç ç äçìéïõñãßá unique log-filename %-.64s.(1-999)\n"
- hun "Egyedi log-filenev nem generalhato: %-.64s.(1-999)\n"
- ita "Impossibile generare un nome del file log unico %-.64s.(1-999)\n"
- kor "Unique ·Î±×È­ÀÏ '%-.64s'¸¦ ¸¸µé¼ö ¾ø½À´Ï´Ù.(1-999)\n"
- nor "Kan ikke lage unikt loggfilnavn %s.(1-999)\n"
- norwegian-ny "Kan ikkje lage unikt loggfilnavn %s.(1-999)\n"
- pol "Nie mo¿na stworzyæ unikalnej nazwy pliku z logiem %s.(1-999)\n"
- por "Não pode gerar um nome de arquivo de 'log' único '%-.64s'.(1-999)\n"
- rum "Nu pot sa generez un nume de log unic %-.64s.(1-999)\n"
- rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÕÎÉËÁÌØÎÏÅ ÉÍÑ ÆÁÊÌÁ ÖÕÒÎÁÌÁ %-.64s.(1-999)\n"
- serbian "Ne mogu da generišem jedinstveno ime log-file-a: '%-.64s.(1-999)'\n"
- slo "Nemô¾em vytvori» unikátne meno log-súboru %-.64s.(1-999)\n"
- spa "No puede crear un unico archivo log %s.(1-999)\n"
- swe "Kan inte generera ett unikt filnamn %s.(1-999)\n"
- ukr "îÅ ÍÏÖÕ ÚÇÅÎÅÒÕ×ÁÔÉ ÕΦËÁÌØÎÅ ¦Í'Ñ log-ÆÁÊÌÕ %-.64s.(1-999)\n"
+ est "Ei suuda luua unikaalset logifaili nime %-.200s.(1-999)\n"
+ fre "Ne peut générer un unique nom de journal %-.200s.(1-999)\n"
+ ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.200s(1-999) erzeugen\n"
+ greek "Áäýíáôç ç äçìéïõñãßá unique log-filename %-.200s.(1-999)\n"
+ hun "Egyedi log-filenev nem generalhato: %-.200s.(1-999)\n"
+ ita "Impossibile generare un nome del file log unico %-.200s.(1-999)\n"
+ kor "Unique ·Î±×È­ÀÏ '%-.200s'¸¦ ¸¸µé¼ö ¾ø½À´Ï´Ù.(1-999)\n"
+ nor "Kan ikke lage unikt loggfilnavn %-.200s.(1-999)\n"
+ norwegian-ny "Kan ikkje lage unikt loggfilnavn %-.200s.(1-999)\n"
+ pol "Nie mo¿na stworzyæ unikalnej nazwy pliku z logiem %-.200s.(1-999)\n"
+ por "Não pode gerar um nome de arquivo de 'log' único '%-.200s'.(1-999)\n"
+ rum "Nu pot sa generez un nume de log unic %-.200s.(1-999)\n"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÕÎÉËÁÌØÎÏÅ ÉÍÑ ÆÁÊÌÁ ÖÕÒÎÁÌÁ %-.200s.(1-999)\n"
+ serbian "Ne mogu da generišem jedinstveno ime log-file-a: '%-.200s.(1-999)'\n"
+ slo "Nemô¾em vytvori» unikátne meno log-súboru %-.200s.(1-999)\n"
+ spa "No puede crear un unico archivo log %-.200s.(1-999)\n"
+ swe "Kan inte generera ett unikt filnamn %-.200s.(1-999)\n"
+ ukr "îÅ ÍÏÖÕ ÚÇÅÎÅÒÕ×ÁÔÉ ÕΦËÁÌØÎÅ ¦Í'Ñ log-ÆÁÊÌÕ %-.200s.(1-999)\n"
ER_TABLE_NOT_LOCKED_FOR_WRITE
cze "Tabulka '%-.64s' byla zam-Bèena s READ a nemù¾e být zmìnìna"
dan "Tabellen '%-.64s' var låst med READ lås og kan ikke opdateres"
@@ -2439,54 +2439,54 @@ ER_BLOB_CANT_HAVE_DEFAULT 42000
swe "BLOB fält '%-.64s' kan inte ha ett DEFAULT-värde"
ukr "óÔÏ×ÂÅÃØ BLOB '%-.64s' ÎÅ ÍÏÖÅ ÍÁÔÉ ÚÎÁÞÅÎÎÑ ÐÏ ÚÁÍÏ×ÞÕ×ÁÎÎÀ"
ER_WRONG_DB_NAME 42000
- cze "Nep-Bøípustné jméno databáze '%-.64s'"
- dan "Ugyldigt database navn '%-.64s'"
- nla "Databasenaam '%-.64s' is niet getoegestaan"
+ cze "Nep-Bøípustné jméno databáze '%-.100s'"
+ dan "Ugyldigt database navn '%-.100s'"
+ nla "Databasenaam '%-.100s' is niet getoegestaan"
eng "Incorrect database name '%-.100s'"
jps "Žw’肵‚½ database –¼ '%-.100s' ‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·",
est "Vigane andmebaasi nimi '%-.100s'"
- fre "Nom de base de donnée illégal: '%-.64s'"
+ fre "Nom de base de donnée illégal: '%-.100s'"
ger "Unerlaubter Datenbankname '%-.100s'"
greek "ËÜèïò üíïìá âÜóçò äåäïìÝíùí '%-.100s'"
hun "Hibas adatbazisnev: '%-.100s'"
ita "Nome database errato '%-.100s'"
jpn "»ØÄꤷ¤¿ database ̾ '%-.100s' ¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹"
kor "'%-.100s' µ¥ÀÌŸº£À̽ºÀÇ À̸§ÀÌ ºÎÁ¤È®ÇÕ´Ï´Ù."
- nor "Ugyldig database navn '%-.64s'"
- norwegian-ny "Ugyldig database namn '%-.64s'"
- pol "Niedozwolona nazwa bazy danych '%-.64s'"
+ nor "Ugyldig database navn '%-.100s'"
+ norwegian-ny "Ugyldig database namn '%-.100s'"
+ pol "Niedozwolona nazwa bazy danych '%-.100s'"
por "Nome de banco de dados '%-.100s' incorreto"
rum "Numele bazei de date este incorect '%-.100s'"
rus "îÅËÏÒÒÅËÔÎÏÅ ÉÍÑ ÂÁÚÙ ÄÁÎÎÙÈ '%-.100s'"
serbian "Pogrešno ime baze '%-.100s'"
slo "Neprípustné meno databázy '%-.100s'"
- spa "Nombre de base de datos ilegal '%-.64s'"
- swe "Felaktigt databasnamn '%-.64s'"
+ spa "Nombre de base de datos ilegal '%-.100s'"
+ swe "Felaktigt databasnamn '%-.100s'"
ukr "îÅצÒÎÅ ¦Í'Ñ ÂÁÚÉ ÄÁÎÎÉÈ '%-.100s'"
ER_WRONG_TABLE_NAME 42000
- cze "Nep-Bøípustné jméno tabulky '%-.64s'"
- dan "Ugyldigt tabel navn '%-.64s'"
- nla "Niet toegestane tabelnaam '%-.64s'"
+ cze "Nep-Bøípustné jméno tabulky '%-.100s'"
+ dan "Ugyldigt tabel navn '%-.100s'"
+ nla "Niet toegestane tabelnaam '%-.100s'"
eng "Incorrect table name '%-.100s'"
jps "Žw’肵‚½ table –¼ '%-.100s' ‚͂܂¿‚ª‚Á‚Ä‚¢‚Ü‚·",
est "Vigane tabeli nimi '%-.100s'"
- fre "Nom de table illégal: '%-.64s'"
+ fre "Nom de table illégal: '%-.100s'"
ger "Unerlaubter Tabellenname '%-.100s'"
greek "ËÜèïò üíïìá ðßíáêá '%-.100s'"
hun "Hibas tablanev: '%-.100s'"
ita "Nome tabella errato '%-.100s'"
jpn "»ØÄꤷ¤¿ table ̾ '%-.100s' ¤Ï¤Þ¤Á¤¬¤Ã¤Æ¤¤¤Þ¤¹"
kor "'%-.100s' Å×À̺í À̸§ÀÌ ºÎÁ¤È®ÇÕ´Ï´Ù."
- nor "Ugyldig tabell navn '%-.64s'"
- norwegian-ny "Ugyldig tabell namn '%-.64s'"
- pol "Niedozwolona nazwa tabeli '%-.64s'..."
+ nor "Ugyldig tabell navn '%-.100s'"
+ norwegian-ny "Ugyldig tabell namn '%-.100s'"
+ pol "Niedozwolona nazwa tabeli '%-.100s'..."
por "Nome de tabela '%-.100s' incorreto"
rum "Numele tabelei este incorect '%-.100s'"
rus "îÅËÏÒÒÅËÔÎÏÅ ÉÍÑ ÔÁÂÌÉÃÙ '%-.100s'"
serbian "Pogrešno ime tabele '%-.100s'"
slo "Neprípustné meno tabuµky '%-.100s'"
- spa "Nombre de tabla ilegal '%-.64s'"
- swe "Felaktigt tabellnamn '%-.64s'"
+ spa "Nombre de tabla ilegal '%-.100s'"
+ swe "Felaktigt tabellnamn '%-.100s'"
ukr "îÅצÒÎÅ ¦Í'Ñ ÔÁÂÌÉæ '%-.100s'"
ER_TOO_BIG_SELECT 42000
cze "Zadan-Bý SELECT by procházel pøíli¹ mnoho záznamù a trval velmi dlouho. Zkontrolujte tvar WHERE a je-li SELECT v poøádku, pou¾ijte SET SQL_BIG_SELECTS=1"
@@ -2534,97 +2534,97 @@ ER_UNKNOWN_ERROR
swe "Oidentifierat fel"
ukr "îÅצÄÏÍÁ ÐÏÍÉÌËÁ"
ER_UNKNOWN_PROCEDURE 42000
- cze "Nezn-Bámá procedura %s"
- dan "Ukendt procedure %s"
- nla "Onbekende procedure %s"
+ cze "Nezn-Bámá procedura %-.64s"
+ dan "Ukendt procedure %-.64s"
+ nla "Onbekende procedure %-.64s"
eng "Unknown procedure '%-.64s'"
est "Tundmatu protseduur '%-.64s'"
- fre "Procédure %s inconnue"
+ fre "Procédure %-.64s inconnue"
ger "Unbekannte Prozedur '%-.64s'"
greek "Áãíùóôç äéáäéêáóßá '%-.64s'"
hun "Ismeretlen eljaras: '%-.64s'"
ita "Procedura '%-.64s' sconosciuta"
kor "¾Ë¼ö ¾ø´Â ¼öÇ๮ : '%-.64s'"
- nor "Ukjent prosedyre %s"
- norwegian-ny "Ukjend prosedyre %s"
- pol "Unkown procedure %s"
+ nor "Ukjent prosedyre %-.64s"
+ norwegian-ny "Ukjend prosedyre %-.64s"
+ pol "Unkown procedure %-.64s"
por "'Procedure' '%-.64s' desconhecida"
rum "Procedura unknown '%-.64s'"
rus "îÅÉÚ×ÅÓÔÎÁÑ ÐÒÏÃÅÄÕÒÁ '%-.64s'"
serbian "Nepoznata procedura '%-.64s'"
slo "Neznámá procedúra '%-.64s'"
- spa "Procedimiento desconocido %s"
- swe "Okänd procedur: %s"
+ spa "Procedimiento desconocido %-.64s"
+ swe "Okänd procedur: %-.64s"
ukr "îÅצÄÏÍÁ ÐÒÏÃÅÄÕÒÁ '%-.64s'"
ER_WRONG_PARAMCOUNT_TO_PROCEDURE 42000
- cze "Chybn-Bý poèet parametrù procedury %s"
- dan "Forkert antal parametre til proceduren %s"
- nla "Foutief aantal parameters doorgegeven aan procedure %s"
+ cze "Chybn-Bý poèet parametrù procedury %-.64s"
+ dan "Forkert antal parametre til proceduren %-.64s"
+ nla "Foutief aantal parameters doorgegeven aan procedure %-.64s"
eng "Incorrect parameter count to procedure '%-.64s'"
est "Vale parameetrite hulk protseduurile '%-.64s'"
- fre "Mauvais nombre de paramètres pour la procedure %s"
+ fre "Mauvais nombre de paramètres pour la procedure %-.64s"
ger "Falsche Parameterzahl für Prozedur '%-.64s'"
greek "ËÜèïò áñéèìüò ðáñáìÝôñùí óôç äéáäéêáóßá '%-.64s'"
hun "Rossz parameter a(z) '%-.64s'eljaras szamitasanal"
ita "Numero di parametri errato per la procedura '%-.64s'"
kor "'%-.64s' ¼öÇ๮¿¡ ´ëÇÑ ºÎÁ¤È®ÇÑ ÆÄ¶ó¸ÞÅÍ"
- nor "Feil parameter antall til prosedyren %s"
- norwegian-ny "Feil parameter tal til prosedyra %s"
- pol "Incorrect parameter count to procedure %s"
+ nor "Feil parameter antall til prosedyren %-.64s"
+ norwegian-ny "Feil parameter tal til prosedyra %-.64s"
+ pol "Incorrect parameter count to procedure %-.64s"
por "Número de parâmetros incorreto para a 'procedure' '%-.64s'"
rum "Procedura '%-.64s' are un numar incorect de parametri"
rus "îÅËÏÒÒÅËÔÎÏÅ ËÏÌÉÞÅÓÔ×Ï ÐÁÒÁÍÅÔÒÏ× ÄÌÑ ÐÒÏÃÅÄÕÒÙ '%-.64s'"
serbian "Pogrešan broj parametara za proceduru '%-.64s'"
slo "Chybný poèet parametrov procedúry '%-.64s'"
- spa "Equivocado parametro count para procedimiento %s"
- swe "Felaktigt antal parametrar till procedur %s"
+ spa "Equivocado parametro count para procedimiento %-.64s"
+ swe "Felaktigt antal parametrar till procedur %-.64s"
ukr "èÉÂÎÁ Ë¦ÌØË¦ÓÔØ ÐÁÒÁÍÅÔÒ¦× ÐÒÏÃÅÄÕÒÉ '%-.64s'"
ER_WRONG_PARAMETERS_TO_PROCEDURE
- cze "Chybn-Bé parametry procedury %s"
- dan "Forkert(e) parametre til proceduren %s"
- nla "Foutieve parameters voor procedure %s"
+ cze "Chybn-Bé parametry procedury %-.64s"
+ dan "Forkert(e) parametre til proceduren %-.64s"
+ nla "Foutieve parameters voor procedure %-.64s"
eng "Incorrect parameters to procedure '%-.64s'"
est "Vigased parameetrid protseduurile '%-.64s'"
- fre "Paramètre erroné pour la procedure %s"
+ fre "Paramètre erroné pour la procedure %-.64s"
ger "Falsche Parameter für Prozedur '%-.64s'"
greek "ËÜèïò ðáñÜìåôñïé óôçí äéáäéêáóßá '%-.64s'"
hun "Rossz parameter a(z) '%-.64s' eljarasban"
ita "Parametri errati per la procedura '%-.64s'"
kor "'%-.64s' ¼öÇ๮¿¡ ´ëÇÑ ºÎÁ¤È®ÇÑ ÆÄ¶ó¸ÞÅÍ"
- nor "Feil parametre til prosedyren %s"
- norwegian-ny "Feil parameter til prosedyra %s"
- pol "Incorrect parameters to procedure %s"
+ nor "Feil parametre til prosedyren %-.64s"
+ norwegian-ny "Feil parameter til prosedyra %-.64s"
+ pol "Incorrect parameters to procedure %-.64s"
por "Parâmetros incorretos para a 'procedure' '%-.64s'"
rum "Procedura '%-.64s' are parametrii incorecti"
rus "îÅËÏÒÒÅËÔÎÙÅ ÐÁÒÁÍÅÔÒÙ ÄÌÑ ÐÒÏÃÅÄÕÒÙ '%-.64s'"
serbian "Pogrešni parametri prosleðeni proceduri '%-.64s'"
slo "Chybné parametre procedúry '%-.64s'"
- spa "Equivocados parametros para procedimiento %s"
- swe "Felaktiga parametrar till procedur %s"
+ spa "Equivocados parametros para procedimiento %-.64s"
+ swe "Felaktiga parametrar till procedur %-.64s"
ukr "èÉÂÎÉÊ ÐÁÒÁÍÅÔÅÒ ÐÒÏÃÅÄÕÒÉ '%-.64s'"
ER_UNKNOWN_TABLE 42S02
- cze "Nezn-Bámá tabulka '%-.64s' v %s"
- dan "Ukendt tabel '%-.64s' i %s"
- nla "Onbekende tabel '%-.64s' in %s"
+ cze "Nezn-Bámá tabulka '%-.64s' v %-.32s"
+ dan "Ukendt tabel '%-.64s' i %-.32s"
+ nla "Onbekende tabel '%-.64s' in %-.32s"
eng "Unknown table '%-.64s' in %-.32s"
est "Tundmatu tabel '%-.64s' %-.32s-s"
- fre "Table inconnue '%-.64s' dans %s"
- ger "Unbekannte Tabelle '%-.64s' in '%-.64s'"
- greek "Áãíùóôïò ðßíáêáò '%-.64s' óå %s"
- hun "Ismeretlen tabla: '%-.64s' %s-ban"
- ita "Tabella '%-.64s' sconosciuta in %s"
- jpn "Unknown table '%-.64s' in %s"
- kor "¾Ë¼ö ¾ø´Â Å×À̺í '%-.64s' (µ¥ÀÌŸº£À̽º %s)"
- nor "Ukjent tabell '%-.64s' i %s"
- norwegian-ny "Ukjend tabell '%-.64s' i %s"
- pol "Unknown table '%-.64s' in %s"
+ fre "Table inconnue '%-.64s' dans %-.32s"
+ ger "Unbekannte Tabelle '%-.64s' in '%-.32s'"
+ greek "Áãíùóôïò ðßíáêáò '%-.64s' óå %-.32s"
+ hun "Ismeretlen tabla: '%-.64s' %-.32s-ban"
+ ita "Tabella '%-.64s' sconosciuta in %-.32s"
+ jpn "Unknown table '%-.64s' in %-.32s"
+ kor "¾Ë¼ö ¾ø´Â Å×À̺í '%-.64s' (µ¥ÀÌŸº£À̽º %-.32s)"
+ nor "Ukjent tabell '%-.64s' i %-.32s"
+ norwegian-ny "Ukjend tabell '%-.64s' i %-.32s"
+ pol "Unknown table '%-.64s' in %-.32s"
por "Tabela '%-.64s' desconhecida em '%-.32s'"
rum "Tabla '%-.64s' invalida in %-.32s"
rus "îÅÉÚ×ÅÓÔÎÁÑ ÔÁÂÌÉÃÁ '%-.64s' × %-.32s"
serbian "Nepoznata tabela '%-.64s' u '%-.32s'"
- slo "Neznáma tabuµka '%-.64s' v %s"
- spa "Tabla desconocida '%-.64s' in %s"
- swe "Okänd tabell '%-.64s' i '%-.64s'"
+ slo "Neznáma tabuµka '%-.64s' v %-.32s"
+ spa "Tabla desconocida '%-.64s' in %-.32s"
+ swe "Okänd tabell '%-.64s' i '%-.32s'"
ukr "îÅצÄÏÍÁ ÔÁÂÌÉÃÑ '%-.64s' Õ %-.32s"
ER_FIELD_SPECIFIED_TWICE 42000
cze "Polo-B¾ka '%-.64s' je zadána dvakrát"
@@ -2803,27 +2803,27 @@ ER_TOO_MANY_FIELDS
swe "För många fält"
ukr "úÁÂÁÇÁÔÏ ÓÔÏ×Âæ×"
ER_TOO_BIG_ROWSIZE 42000
- cze "-BØádek je pøíli¹ velký. Maximální velikost øádku, nepoèítaje polo¾ky blob, je %d. Musíte zmìnit nìkteré polo¾ky na blob"
- dan "For store poster. Max post størrelse, uden BLOB's, er %d. Du må lave nogle felter til BLOB's"
- nla "Rij-grootte is groter dan toegestaan. Maximale rij grootte, blobs niet meegeteld, is %d. U dient sommige velden in blobs te veranderen."
+ cze "-BØádek je pøíli¹ velký. Maximální velikost øádku, nepoèítaje polo¾ky blob, je %ld. Musíte zmìnit nìkteré polo¾ky na blob"
+ dan "For store poster. Max post størrelse, uden BLOB's, er %ld. Du må lave nogle felter til BLOB's"
+ nla "Rij-grootte is groter dan toegestaan. Maximale rij grootte, blobs niet meegeteld, is %ld. U dient sommige velden in blobs te veranderen."
eng "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. You have to change some columns to TEXT or BLOBs"
- jps "row size ‚ª‘å‚«‚·‚¬‚Ü‚·. BLOB ‚ðŠÜ‚܂Ȃ¢ê‡‚Ì row size ‚ÌÅ‘å‚Í %d ‚Å‚·. ‚¢‚­‚‚©‚Ì field ‚ð BLOB ‚ɕς¦‚Ä‚­‚¾‚³‚¢.",
- est "Liiga pikk kirje. Kirje maksimumpikkus arvestamata BLOB-tüüpi välju on %d. Muuda mõned väljad BLOB-tüüpi väljadeks"
- fre "Ligne trop grande. Le taille maximale d'une ligne, sauf les BLOBs, est %d. Changez le type de quelques colonnes en BLOB"
+ jps "row size ‚ª‘å‚«‚·‚¬‚Ü‚·. BLOB ‚ðŠÜ‚܂Ȃ¢ê‡‚Ì row size ‚ÌÅ‘å‚Í %ld ‚Å‚·. ‚¢‚­‚‚©‚Ì field ‚ð BLOB ‚ɕς¦‚Ä‚­‚¾‚³‚¢.",
+ est "Liiga pikk kirje. Kirje maksimumpikkus arvestamata BLOB-tüüpi välju on %ld. Muuda mõned väljad BLOB-tüüpi väljadeks"
+ fre "Ligne trop grande. Le taille maximale d'une ligne, sauf les BLOBs, est %ld. Changez le type de quelques colonnes en BLOB"
ger "Zeilenlänge zu groß. Die maximale Zeilenlänge für den verwendeten Tabellentyp (ohne BLOB-Felder) beträgt %ld. Einige Felder müssen in BLOB oder TEXT umgewandelt werden"
- greek "Ðïëý ìåãÜëï ìÝãåèïò åããñáöÞò. Ôï ìÝãéóôï ìÝãåèïò åããñáöÞò, ÷ùñßò íá õðïëïãßæïíôáé ôá blobs, åßíáé %d. ÐñÝðåé íá ïñßóåôå êÜðïéá ðåäßá óáí blobs"
- hun "Tul nagy sormeret. A maximalis sormeret (nem szamolva a blob objektumokat) %d. Nehany mezot meg kell valtoztatnia"
- ita "Riga troppo grande. La massima grandezza di una riga, non contando i BLOB, e` %d. Devi cambiare alcuni campi in BLOB"
- jpn "row size ¤¬Â礭¤¹¤®¤Þ¤¹. BLOB ¤ò´Þ¤Þ¤Ê¤¤¾ì¹ç¤Î row size ¤ÎºÇÂç¤Ï %d ¤Ç¤¹. ¤¤¤¯¤Ä¤«¤Î field ¤ò BLOB ¤ËÊѤ¨¤Æ¤¯¤À¤µ¤¤."
- kor "³Ê¹« Å« row »çÀÌÁîÀÔ´Ï´Ù. BLOB¸¦ °è»êÇÏÁö ¾Ê°í ÃÖ´ë row »çÀÌÁî´Â %dÀÔ´Ï´Ù. ¾ó¸¶°£ÀÇ ÇʵåµéÀ» BLOB·Î ¹Ù²Ù¼Å¾ß °Ú±º¿ä.."
- por "Tamanho de linha grande demais. O máximo tamanho de linha, não contando BLOBs, é %d. Você tem que mudar alguns campos para BLOBs"
- rum "Marimea liniei (row) prea mare. Marimea maxima a liniei, excluzind BLOB-urile este de %d. Trebuie sa schimbati unele cimpuri in BLOB-uri"
- rus "óÌÉÛËÏÍ ÂÏÌØÛÏÊ ÒÁÚÍÅÒ ÚÁÐÉÓÉ. íÁËÓÉÍÁÌØÎÙÊ ÒÁÚÍÅÒ ÓÔÒÏËÉ, ÉÓËÌÀÞÁÑ ÐÏÌÑ BLOB, - %d. ÷ÏÚÍÏÖÎÏ, ×ÁÍ ÓÌÅÄÕÅÔ ÉÚÍÅÎÉÔØ ÔÉÐ ÎÅËÏÔÏÒÙÈ ÐÏÌÅÊ ÎÁ BLOB"
- serbian "Prevelik slog. Maksimalna velièina sloga, ne raèunajuæi BLOB polja, je %d. Trebali bi da promenite tip nekih polja u BLOB"
- slo "Riadok je príli¹ veµký. Maximálna veµkos» riadku, okrem 'BLOB', je %d. Musíte zmeni» niektoré polo¾ky na BLOB"
- spa "Tamaño de línea muy grande. Máximo tamaño de línea, no contando blob, es %d. Tu tienes que cambiar algunos campos para blob"
- swe "För stor total radlängd. Den högst tillåtna radlängden, förutom BLOBs, är %d. Ändra några av dina fält till BLOB"
- ukr "úÁÄÏ×ÇÁ ÓÔÒÏËÁ. îÁÊÂ¦ÌØÛÏÀ ÄÏ×ÖÉÎÏÀ ÓÔÒÏËÉ, ÎÅ ÒÁÈÕÀÞÉ BLOB, ¤ %d. ÷ÁÍ ÐÏÔÒ¦ÂÎÏ ÐÒÉ×ÅÓÔÉ ÄÅÑ˦ ÓÔÏ×Âæ ÄÏ ÔÉÐÕ BLOB"
+ greek "Ðïëý ìåãÜëï ìÝãåèïò åããñáöÞò. Ôï ìÝãéóôï ìÝãåèïò åããñáöÞò, ÷ùñßò íá õðïëïãßæïíôáé ôá blobs, åßíáé %ld. ÐñÝðåé íá ïñßóåôå êÜðïéá ðåäßá óáí blobs"
+ hun "Tul nagy sormeret. A maximalis sormeret (nem szamolva a blob objektumokat) %ld. Nehany mezot meg kell valtoztatnia"
+ ita "Riga troppo grande. La massima grandezza di una riga, non contando i BLOB, e` %ld. Devi cambiare alcuni campi in BLOB"
+ jpn "row size ¤¬Â礭¤¹¤®¤Þ¤¹. BLOB ¤ò´Þ¤Þ¤Ê¤¤¾ì¹ç¤Î row size ¤ÎºÇÂç¤Ï %ld ¤Ç¤¹. ¤¤¤¯¤Ä¤«¤Î field ¤ò BLOB ¤ËÊѤ¨¤Æ¤¯¤À¤µ¤¤."
+ kor "³Ê¹« Å« row »çÀÌÁîÀÔ´Ï´Ù. BLOB¸¦ °è»êÇÏÁö ¾Ê°í ÃÖ´ë row »çÀÌÁî´Â %ldÀÔ´Ï´Ù. ¾ó¸¶°£ÀÇ ÇʵåµéÀ» BLOB·Î ¹Ù²Ù¼Å¾ß °Ú±º¿ä.."
+ por "Tamanho de linha grande demais. O máximo tamanho de linha, não contando BLOBs, é %ld. Você tem que mudar alguns campos para BLOBs"
+ rum "Marimea liniei (row) prea mare. Marimea maxima a liniei, excluzind BLOB-urile este de %ld. Trebuie sa schimbati unele cimpuri in BLOB-uri"
+ rus "óÌÉÛËÏÍ ÂÏÌØÛÏÊ ÒÁÚÍÅÒ ÚÁÐÉÓÉ. íÁËÓÉÍÁÌØÎÙÊ ÒÁÚÍÅÒ ÓÔÒÏËÉ, ÉÓËÌÀÞÁÑ ÐÏÌÑ BLOB, - %ld. ÷ÏÚÍÏÖÎÏ, ×ÁÍ ÓÌÅÄÕÅÔ ÉÚÍÅÎÉÔØ ÔÉÐ ÎÅËÏÔÏÒÙÈ ÐÏÌÅÊ ÎÁ BLOB"
+ serbian "Prevelik slog. Maksimalna velièina sloga, ne raèunajuæi BLOB polja, je %ld. Trebali bi da promenite tip nekih polja u BLOB"
+ slo "Riadok je príli¹ veµký. Maximálna veµkos» riadku, okrem 'BLOB', je %ld. Musíte zmeni» niektoré polo¾ky na BLOB"
+ spa "Tamaño de línea muy grande. Máximo tamaño de línea, no contando blob, es %ld. Tu tienes que cambiar algunos campos para blob"
+ swe "För stor total radlängd. Den högst tillåtna radlängden, förutom BLOBs, är %ld. Ändra några av dina fält till BLOB"
+ ukr "úÁÄÏ×ÇÁ ÓÔÒÏËÁ. îÁÊÂ¦ÌØÛÏÀ ÄÏ×ÖÉÎÏÀ ÓÔÒÏËÉ, ÎÅ ÒÁÈÕÀÞÉ BLOB, ¤ %ld. ÷ÁÍ ÐÏÔÒ¦ÂÎÏ ÐÒÉ×ÅÓÔÉ ÄÅÑ˦ ÓÔÏ×Âæ ÄÏ ÔÉÐÕ BLOB"
ER_STACK_OVERRUN
cze "P-Bøeteèení zásobníku threadu: pou¾ito %ld z %ld. Pou¾ijte 'mysqld -O thread_stack=#' k zadání vìt¹ího zásobníku"
dan "Thread stack brugt: Brugt: %ld af en %ld stak. Brug 'mysqld -O thread_stack=#' for at allokere en større stak om nødvendigt"
@@ -2865,29 +2865,29 @@ ER_WRONG_OUTER_JOIN 42000
swe "Felaktigt referens i OUTER JOIN. Kontrollera ON-uttrycket"
ukr "ðÅÒÅÈÒÅÓÎÁ ÚÁÌÅÖΦÓÔØ Õ OUTER JOIN. ðÅÒÅצÒÔÅ ÕÍÏ×Õ ON"
ER_NULL_COLUMN_IN_INDEX 42000
- cze "Sloupec '%-.32s' je pou-B¾it s UNIQUE nebo INDEX, ale není definován jako NOT NULL"
- dan "Kolonne '%-.32s' bruges som UNIQUE eller INDEX men er ikke defineret som NOT NULL"
+ cze "Sloupec '%-.64s' je pou-B¾it s UNIQUE nebo INDEX, ale není definován jako NOT NULL"
+ dan "Kolonne '%-.64s' bruges som UNIQUE eller INDEX men er ikke defineret som NOT NULL"
nla "Kolom '%-.64s' wordt gebruikt met UNIQUE of INDEX maar is niet gedefinieerd als NOT NULL"
eng "Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
jps "Column '%-.64s' ‚ª UNIQUE ‚© INDEX ‚ÅŽg—p‚³‚ê‚Ü‚µ‚½. ‚±‚̃Jƒ‰ƒ€‚Í NOT NULL ‚Æ’è‹`‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ.",
est "Tulp '%-.64s' on kasutusel indeksina, kuid ei ole määratletud kui NOT NULL"
- fre "La colonne '%-.32s' fait partie d'un index UNIQUE ou INDEX mais n'est pas définie comme NOT NULL"
+ fre "La colonne '%-.64s' fait partie d'un index UNIQUE ou INDEX mais n'est pas définie comme NOT NULL"
ger "Spalte '%-.64s' wurde mit UNIQUE oder INDEX benutzt, ist aber nicht als NOT NULL definiert"
greek "Ôï ðåäßï '%-.64s' ÷ñçóéìïðïéåßôáé óáí UNIQUE Þ INDEX áëëÜ äåí Ý÷åé ïñéóèåß óáí NOT NULL"
hun "A(z) '%-.64s' oszlop INDEX vagy UNIQUE (egyedi), de a definicioja szerint nem NOT NULL"
ita "La colonna '%-.64s' e` usata con UNIQUE o INDEX ma non e` definita come NOT NULL"
jpn "Column '%-.64s' ¤¬ UNIQUE ¤« INDEX ¤Ç»ÈÍѤµ¤ì¤Þ¤·¤¿. ¤³¤Î¥«¥é¥à¤Ï NOT NULL ¤ÈÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó."
kor "'%-.64s' Ä®·³ÀÌ UNIQUE³ª INDEX¸¦ »ç¿ëÇÏ¿´Áö¸¸ NOT NULLÀÌ Á¤ÀǵÇÁö ¾Ê¾Ò±º¿ä..."
- nor "Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
- norwegian-ny "Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
- pol "Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
+ nor "Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
+ norwegian-ny "Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
+ pol "Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL"
por "Coluna '%-.64s' é usada com única (UNIQUE) ou índice (INDEX), mas não está definida como não-nula (NOT NULL)"
rum "Coloana '%-.64s' e folosita cu UNIQUE sau INDEX dar fara sa fie definita ca NOT NULL"
rus "óÔÏÌÂÅÃ '%-.64s' ÉÓÐÏÌØÚÕÅÔÓÑ × UNIQUE ÉÌÉ × INDEX, ÎÏ ÎÅ ÏÐÒÅÄÅÌÅÎ ËÁË NOT NULL"
serbian "Kolona '%-.64s' je upotrebljena kao 'UNIQUE' ili 'INDEX' ali nije definisana kao 'NOT NULL'"
slo "Pole '%-.64s' je pou¾ité s UNIQUE alebo INDEX, ale nie je zadefinované ako NOT NULL"
- spa "Columna '%-.32s' es usada con UNIQUE o INDEX pero no está definida como NOT NULL"
- swe "Kolumn '%-.32s' är använd med UNIQUE eller INDEX men är inte definerad med NOT NULL"
+ spa "Columna '%-.64s' es usada con UNIQUE o INDEX pero no está definida como NOT NULL"
+ swe "Kolumn '%-.64s' är använd med UNIQUE eller INDEX men är inte definerad med NOT NULL"
ukr "óÔÏ×ÂÅÃØ '%-.64s' ×ÉËÏÒÉÓÔÏ×Õ¤ÔØÓÑ Ú UNIQUE ÁÂÏ INDEX, ÁÌÅ ÎÅ ×ÉÚÎÁÞÅÎÉÊ ÑË NOT NULL"
ER_CANT_FIND_UDF
cze "Nemohu na-Bèíst funkci '%-.64s'"
@@ -2995,13 +2995,13 @@ ER_CANT_OPEN_LIBRARY
norwegian-ny "Can't open shared library '%-.64s' (errno: %d %-.128s)"
pol "Can't open shared library '%-.64s' (errno: %d %-.128s)"
por "Não pode abrir biblioteca compartilhada '%-.64s' (erro no. '%d' - '%-.128s')"
- rum "Nu pot deschide libraria shared '%-.64s' (Eroare: %d %-.64s)"
- rus "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÄÉÎÁÍÉÞÅÓËÕÀ ÂÉÂÌÉÏÔÅËÕ '%-.64s' (ÏÛÉÂËÁ: %d %-.64s)"
- serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.64s' (errno: %d %-.64s)"
- slo "Nemô¾em otvori» zdieµanú kni¾nicu '%-.64s' (chybový kód: %d %s)"
- spa "No puedo abrir libraria conjugada '%-.64s' (errno: %d %s)"
- swe "Kan inte öppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)"
- ukr "îÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ ÒÏÚĦÌÀ×ÁÎÕ Â¦Â̦ÏÔÅËÕ '%-.64s' (ÐÏÍÉÌËÁ: %d %-.64s)"
+ rum "Nu pot deschide libraria shared '%-.64s' (Eroare: %d %-.128s)"
+ rus "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÄÉÎÁÍÉÞÅÓËÕÀ ÂÉÂÌÉÏÔÅËÕ '%-.64s' (ÏÛÉÂËÁ: %d %-.128s)"
+ serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.64s' (errno: %d %-.128s)"
+ slo "Nemô¾em otvori» zdieµanú kni¾nicu '%-.64s' (chybový kód: %d %-.128s)"
+ spa "No puedo abrir libraria conjugada '%-.64s' (errno: %d %-.128s)"
+ swe "Kan inte öppna det dynamiska biblioteket '%-.64s' (Felkod: %d %-.128s)"
+ ukr "îÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ ÒÏÚĦÌÀ×ÁÎÕ Â¦Â̦ÏÔÅËÕ '%-.64s' (ÐÏÍÉÌËÁ: %d %-.128s)"
ER_CANT_FIND_DL_ENTRY
cze "Nemohu naj-Bít funkci '%-.128s' v knihovnì"
dan "Kan ikke finde funktionen '%-.128s' i bibliotek"
@@ -3048,14 +3048,14 @@ ER_FUNCTION_NOT_DEFINED
ukr "æÕÎËæÀ '%-.64s' ÎÅ ×ÉÚÎÁÞÅÎÏ"
ER_HOST_IS_BLOCKED
cze "Stroj '%-.64s' je zablokov-Bán kvùli mnoha chybám pøi pøipojování. Odblokujete pou¾itím 'mysqladmin flush-hosts'"
- dan "Værten er blokeret på grund af mange fejlforespørgsler. Lås op med 'mysqladmin flush-hosts'"
+ dan "Værten '%-.64s' er blokeret på grund af mange fejlforespørgsler. Lås op med 'mysqladmin flush-hosts'"
nla "Host '%-.64s' is geblokkeeerd vanwege te veel verbindings fouten. Deblokkeer met 'mysqladmin flush-hosts'"
eng "Host '%-.64s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
jps "Host '%-.64s' ‚Í many connection error ‚Ì‚½‚ßA‹‘”Û‚³‚ê‚Ü‚µ‚½. 'mysqladmin flush-hosts' ‚ʼn𜂵‚Ä‚­‚¾‚³‚¢",
est "Masin '%-.64s' on blokeeritud hulgaliste ühendusvigade tõttu. Blokeeringu saab tühistada 'mysqladmin flush-hosts' käsuga"
fre "L'hôte '%-.64s' est bloqué à cause d'un trop grand nombre d'erreur de connection. Débloquer le par 'mysqladmin flush-hosts'"
ger "Host '%-.64s' blockiert wegen zu vieler Verbindungsfehler. Aufheben der Blockierung mit 'mysqladmin flush-hosts'"
- greek "Ï õðïëïãéóôÞò Ý÷åé áðïêëåéóèåß ëüãù ðïëëáðëþí ëáèþí óýíäåóçò. ÐñïóðáèÞóôå íá äéïñþóåôå ìå 'mysqladmin flush-hosts'"
+ greek "Ï õðïëïãéóôÞò '%-.64s' Ý÷åé áðïêëåéóèåß ëüãù ðïëëáðëþí ëáèþí óýíäåóçò. ÐñïóðáèÞóôå íá äéïñþóåôå ìå 'mysqladmin flush-hosts'"
hun "A '%-.64s' host blokkolodott, tul sok kapcsolodasi hiba miatt. Hasznalja a 'mysqladmin flush-hosts' parancsot"
ita "Sistema '%-.64s' bloccato a causa di troppi errori di connessione. Per sbloccarlo: 'mysqladmin flush-hosts'"
jpn "Host '%-.64s' ¤Ï many connection error ¤Î¤¿¤á¡¢µñÈݤµ¤ì¤Þ¤·¤¿. 'mysqladmin flush-hosts' ¤Ç²ò½ü¤·¤Æ¤¯¤À¤µ¤¤"
@@ -3076,7 +3076,7 @@ ER_HOST_NOT_PRIVILEGED
est "Masinal '%-.64s' puudub ligipääs sellele MySQL serverile"
fre "Le hôte '%-.64s' n'est pas authorisé à se connecter à ce serveur MySQL"
ger "Host '%-.64s' hat keine Berechtigung, sich mit diesem MySQL-Server zu verbinden"
- greek "Ï õðïëïãéóôÞò äåí Ý÷åé äéêáßùìá óýíäåóçò ìå ôïí MySQL server"
+ greek "Ï õðïëïãéóôÞò '%-.64s' äåí Ý÷åé äéêáßùìá óýíäåóçò ìå ôïí MySQL server"
hun "A '%-.64s' host szamara nem engedelyezett a kapcsolodas ehhez a MySQL szerverhez"
ita "Al sistema '%-.64s' non e` consentita la connessione a questo server MySQL"
jpn "Host '%-.64s' ¤Ï MySQL server ¤ËÀܳ¤òµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó"
@@ -3288,25 +3288,25 @@ ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000
swe "Man får ha både GROUP-kolumner (MIN(),MAX(),COUNT()...) och fält i en fråga om man inte har en GROUP BY-del"
ukr "úͦÛÕ×ÁÎÎÑ GROUP ÓÔÏ×ÂÃ¦× (MIN(),MAX(),COUNT()...) Ú ÎÅ GROUP ÓÔÏ×ÂÃÑÍÉ ¤ ÚÁÂÏÒÏÎÅÎÉÍ, ÑËÝÏ ÎÅ ÍÁ¤ GROUP BY"
ER_NONEXISTING_GRANT 42000
- cze "Neexistuje odpov-Bídající grant pro u¾ivatele '%-.32s' na stroji '%-.64s'"
- dan "Denne tilladelse findes ikke for brugeren '%-.32s' på vært '%-.64s'"
- nla "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.32s' op host '%-.64s'"
- eng "There is no such grant defined for user '%-.32s' on host '%-.64s'"
- jps "ƒ†[ƒU[ '%-.32s' (ƒzƒXƒg '%-.64s' ‚̃†[ƒU[) ‚Í‹–‰Â‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ",
- est "Sellist õigust ei ole defineeritud kasutajale '%-.32s' masinast '%-.64s'"
- fre "Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s'"
- ger "Für Benutzer '%-.32s' auf Host '%-.64s' gibt es keine solche Berechtigung"
- hun "A '%-.32s' felhasznalonak nincs ilyen joga a '%-.64s' host-on"
- ita "GRANT non definita per l'utente '%-.32s' dalla macchina '%-.64s'"
- jpn "¥æ¡¼¥¶¡¼ '%-.32s' (¥Û¥¹¥È '%-.64s' ¤Î¥æ¡¼¥¶¡¼) ¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó"
- kor "»ç¿ëÀÚ '%-.32s' (È£½ºÆ® '%-.64s')¸¦ À§ÇÏ¿© Á¤ÀÇµÈ ±×·± ½ÂÀÎÀº ¾ø½À´Ï´Ù."
- por "Não existe tal permissão (grant) definida para o usuário '%-.32s' no 'host' '%-.64s'"
- rum "Nu exista un astfel de grant definit pentru utilzatorul '%-.32s' de pe host-ul '%-.64s'"
- rus "ôÁËÉÅ ÐÒÁ×Á ÎÅ ÏÐÒÅÄÅÌÅÎÙ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s' ÎÁ ÈÏÓÔÅ '%-.64s'"
- serbian "Ne postoji odobrenje za pristup korisniku '%-.32s' na host-u '%-.64s'"
- spa "No existe permiso definido para usuario '%-.32s' en el servidor '%-.64s'"
- swe "Det finns inget privilegium definierat för användare '%-.32s' på '%-.64s'"
- ukr "ðÏ×ÎÏ×ÁÖÅÎØ ÎÅ ×ÉÚÎÁÞÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ '%-.32s' Ú ÈÏÓÔÕ '%-.64s'"
+ cze "Neexistuje odpov-Bídající grant pro u¾ivatele '%-.64s' na stroji '%-.64s'"
+ dan "Denne tilladelse findes ikke for brugeren '%-.64s' på vært '%-.64s'"
+ nla "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.64s' op host '%-.64s'"
+ eng "There is no such grant defined for user '%-.64s' on host '%-.64s'"
+ jps "ƒ†[ƒU[ '%-.64s' (ƒzƒXƒg '%-.64s' ‚̃†[ƒU[) ‚Í‹–‰Â‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ",
+ est "Sellist õigust ei ole defineeritud kasutajale '%-.64s' masinast '%-.64s'"
+ fre "Un tel droit n'est pas défini pour l'utilisateur '%-.64s' sur l'hôte '%-.64s'"
+ ger "Für Benutzer '%-.64s' auf Host '%-.64s' gibt es keine solche Berechtigung"
+ hun "A '%-.64s' felhasznalonak nincs ilyen joga a '%-.64s' host-on"
+ ita "GRANT non definita per l'utente '%-.64s' dalla macchina '%-.64s'"
+ jpn "¥æ¡¼¥¶¡¼ '%-.64s' (¥Û¥¹¥È '%-.64s' ¤Î¥æ¡¼¥¶¡¼) ¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó"
+ kor "»ç¿ëÀÚ '%-.64s' (È£½ºÆ® '%-.64s')¸¦ À§ÇÏ¿© Á¤ÀÇµÈ ±×·± ½ÂÀÎÀº ¾ø½À´Ï´Ù."
+ por "Não existe tal permissão (grant) definida para o usuário '%-.64s' no 'host' '%-.64s'"
+ rum "Nu exista un astfel de grant definit pentru utilzatorul '%-.64s' de pe host-ul '%-.64s'"
+ rus "ôÁËÉÅ ÐÒÁ×Á ÎÅ ÏÐÒÅÄÅÌÅÎÙ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.64s' ÎÁ ÈÏÓÔÅ '%-.64s'"
+ serbian "Ne postoji odobrenje za pristup korisniku '%-.64s' na host-u '%-.64s'"
+ spa "No existe permiso definido para usuario '%-.64s' en el servidor '%-.64s'"
+ swe "Det finns inget privilegium definierat för användare '%-.64s' på '%-.64s'"
+ ukr "ðÏ×ÎÏ×ÁÖÅÎØ ÎÅ ×ÉÚÎÁÞÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ '%-.64s' Ú ÈÏÓÔÕ '%-.64s'"
ER_TABLEACCESS_DENIED_ERROR 42000
cze "%-.16s p-Bøíkaz nepøístupný pro u¾ivatele: '%-.32s'@'%-.64s' pro tabulku '%-.64s'"
dan "%-.16s-kommandoen er ikke tilladt for brugeren '%-.32s'@'%-.64s' for tabellen '%-.64s'"
@@ -3390,27 +3390,27 @@ ER_GRANT_WRONG_HOST_OR_USER 42000
swe "Felaktigt maskinnamn eller användarnamn använt med GRANT"
ukr "áÒÇÕÍÅÎÔ host ÁÂÏ user ÄÌÑ GRANT ÚÁÄÏ×ÇÉÊ"
ER_NO_SUCH_TABLE 42S02
- cze "Tabulka '%-.64s.%s' neexistuje"
+ cze "Tabulka '%-.64s.%-.64s' neexistuje"
dan "Tabellen '%-.64s.%-.64s' eksisterer ikke"
- nla "Tabel '%-.64s.%s' bestaat niet"
+ nla "Tabel '%-.64s.%-.64s' bestaat niet"
eng "Table '%-.64s.%-.64s' doesn't exist"
est "Tabelit '%-.64s.%-.64s' ei eksisteeri"
- fre "La table '%-.64s.%s' n'existe pas"
+ fre "La table '%-.64s.%-.64s' n'existe pas"
ger "Tabelle '%-.64s.%-.64s' existiert nicht"
- hun "A '%-.64s.%s' tabla nem letezik"
- ita "La tabella '%-.64s.%s' non esiste"
- jpn "Table '%-.64s.%s' doesn't exist"
- kor "Å×À̺í '%-.64s.%s' ´Â Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù."
- nor "Table '%-.64s.%s' doesn't exist"
- norwegian-ny "Table '%-.64s.%s' doesn't exist"
- pol "Table '%-.64s.%s' doesn't exist"
+ hun "A '%-.64s.%-.64s' tabla nem letezik"
+ ita "La tabella '%-.64s.%-.64s' non esiste"
+ jpn "Table '%-.64s.%-.64s' doesn't exist"
+ kor "Å×À̺í '%-.64s.%-.64s' ´Â Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù."
+ nor "Table '%-.64s.%-.64s' doesn't exist"
+ norwegian-ny "Table '%-.64s.%-.64s' doesn't exist"
+ pol "Table '%-.64s.%-.64s' doesn't exist"
por "Tabela '%-.64s.%-.64s' não existe"
rum "Tabela '%-.64s.%-.64s' nu exista"
rus "ôÁÂÌÉÃÁ '%-.64s.%-.64s' ÎÅ ÓÕÝÅÓÔ×ÕÅÔ"
serbian "Tabela '%-.64s.%-.64s' ne postoji"
- slo "Table '%-.64s.%s' doesn't exist"
- spa "Tabla '%-.64s.%s' no existe"
- swe "Det finns ingen tabell som heter '%-.64s.%s'"
+ slo "Table '%-.64s.%-.64s' doesn't exist"
+ spa "Tabla '%-.64s.%-.64s' no existe"
+ swe "Det finns ingen tabell som heter '%-.64s.%-.64s'"
ukr "ôÁÂÌÉÃÑ '%-.64s.%-.64s' ÎÅ ¦ÓÎÕ¤"
ER_NONEXISTING_TABLE_GRANT 42000
cze "Neexistuje odpov-Bídající grant pro u¾ivatele '%-.32s' na stroji '%-.64s' pro tabulku '%-.64s'"
@@ -3509,27 +3509,27 @@ ER_TOO_MANY_DELAYED_THREADS
swe "Det finns redan 'max_delayed_threads' trådar i använding"
ukr "úÁÂÁÇÁÔÏ ÚÁÔÒÉÍÁÎÉÈ Ç¦ÌÏË ×ÉËÏÒÉÓÔÏ×Õ¤ÔØÓÑ"
ER_ABORTING_CONNECTION 08S01
- cze "Zru-B¹eno spojení %ld do databáze: '%-.64s' u¾ivatel: '%-.64s' (%s)"
- dan "Afbrudt forbindelse %ld til database: '%-.64s' bruger: '%-.64s' (%-.64s)"
- nla "Afgebroken verbinding %ld naar db: '%-.64s' gebruiker: '%-.64s' (%s)"
+ cze "Zru-B¹eno spojení %ld do databáze: '%-.64s' u¾ivatel: '%-.32s' (%-.64s)"
+ dan "Afbrudt forbindelse %ld til database: '%-.64s' bruger: '%-.32s' (%-.64s)"
+ nla "Afgebroken verbinding %ld naar db: '%-.64s' gebruiker: '%-.32s' (%-.64s)"
eng "Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)"
est "Ühendus katkestatud %ld andmebaasile: '%-.64s' kasutajale: '%-.32s' (%-.64s)"
- fre "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.64s' (%s)"
- ger "Abbruch der Verbindung %ld zur Datenbank '%-.64s'. Benutzer: '%-.64s' (%-.64s)"
- hun "Megszakitott kapcsolat %ld db: '%-.64s' adatbazishoz, felhasznalo: '%-.64s' (%s)"
- ita "Interrotta la connessione %ld al db: '%-.64s' utente: '%-.64s' (%s)"
- jpn "Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)"
- kor "µ¥ÀÌŸº£À̽º Á¢¼ÓÀ» À§ÇÑ ¿¬°á %ld°¡ Áß´ÜµÊ : '%-.64s' »ç¿ëÀÚ: '%-.64s' (%s)"
- nor "Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)"
- norwegian-ny "Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)"
- pol "Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)"
+ fre "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' (%-.64s)"
+ ger "Abbruch der Verbindung %ld zur Datenbank '%-.64s'. Benutzer: '%-.32s' (%-.64s)"
+ hun "Megszakitott kapcsolat %ld db: '%-.64s' adatbazishoz, felhasznalo: '%-.32s' (%-.64s)"
+ ita "Interrotta la connessione %ld al db: '%-.64s' utente: '%-.32s' (%-.64s)"
+ jpn "Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)"
+ kor "µ¥ÀÌŸº£À̽º Á¢¼ÓÀ» À§ÇÑ ¿¬°á %ld°¡ Áß´ÜµÊ : '%-.64s' »ç¿ëÀÚ: '%-.32s' (%-.64s)"
+ nor "Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)"
+ norwegian-ny "Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)"
+ pol "Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)"
por "Conexão %ld abortou para o banco de dados '%-.64s' - usuário '%-.32s' (%-.64s)"
rum "Conectie terminata %ld la baza de date: '%-.64s' utilizator: '%-.32s' (%-.64s)"
rus "ðÒÅÒ×ÁÎÏ ÓÏÅÄÉÎÅÎÉÅ %ld Ë ÂÁÚÅ ÄÁÎÎÙÈ '%-.64s' ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s' (%-.64s)"
serbian "Prekinuta konekcija broj %ld ka bazi: '%-.64s' korisnik je bio: '%-.32s' (%-.64s)"
- slo "Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)"
- spa "Conexión abortada %ld para db: '%-.64s' usuario: '%-.64s' (%s)"
- swe "Avbröt länken för tråd %ld till db '%-.64s', användare '%-.64s' (%s)"
+ slo "Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)"
+ spa "Conexión abortada %ld para db: '%-.64s' usuario: '%-.32s' (%-.64s)"
+ swe "Avbröt länken för tråd %ld till db '%-.64s', användare '%-.32s' (%-.64s)"
ukr "ðÅÒÅÒ×ÁÎÏ Ú'¤ÄÎÁÎÎÑ %ld ÄÏ ÂÁÚÉ ÄÁÎÎÉÈ: '%-.64s' ËÏÒÉÓÔÕ×ÁÞÁ: '%-.32s' (%-.64s)"
ER_NET_PACKET_TOO_LARGE 08S01
cze "Zji-B¹tìn pøíchozí packet del¹í ne¾ 'max_allowed_packet'"
@@ -4008,7 +4008,7 @@ ER_CHECK_NOT_IMPLEMENTED 42000
por "O manipulador de tabela não suporta %s"
rum "The handler for the table doesn't support %s"
rus "ïÂÒÁÂÏÔÞÉË ÔÁÂÌÉÃÙ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ ÜÔÏÇÏ: %s"
- serbian "Handler za ovu tabelu ne dozvoljava 'check' odnosno 'repair' komande"
+ serbian "Handler za ovu tabelu ne dozvoljava %s komande"
slo "The handler for the table doesn't support %s"
spa "El manipulador de la tabla no permite soporte para %s"
swe "Tabellhanteraren för denna tabell kan inte göra %s"
@@ -5045,7 +5045,7 @@ ER_OPTION_PREVENTS_STATEMENT
ger "Der MySQL-Server läuft mit der Option %s und kann diese Anweisung deswegen nicht ausführen"
por "O servidor MySQL está rodando com a opção %s razão pela qual não pode executar esse commando"
spa "El servidor MySQL está rodando con la opción %s tal que no puede ejecutar este comando"
- swe "MySQL är startad med --skip-grant-tables. Pga av detta kan du inte använda detta kommando"
+ swe "MySQL är startad med %s. Pga av detta kan du inte använda detta kommando"
ER_DUPLICATED_VALUE_IN_TYPE
eng "Column '%-.100s' has duplicated value '%-.64s' in %s"
ger "Feld '%-.100s' hat doppelten Wert '%-.64s' in %s"
@@ -5219,9 +5219,9 @@ ER_FPARSER_BAD_HEADER
ukr "îÅצÒÎÉÊ ÚÁÇÏÌÏ×ÏË ÔÉÐÕ Õ ÆÁÊ̦ '%-.64s'"
ER_FPARSER_EOF_IN_COMMENT
eng "Unexpected end of file while parsing comment '%-.200s'"
- ger "Unerwartetes Dateiende beim Parsen des Kommentars '%-.64s'"
- rus "îÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ × ËÏÍÅÎÔÁÒÉÉ '%-.64s'"
- ukr "îÅÓÐÏĦ×ÁÎÎÉÊ Ë¦ÎÅÃØ ÆÁÊÌÕ Õ ËÏÍÅÎÔÁÒ¦ '%-.64s'"
+ ger "Unerwartetes Dateiende beim Parsen des Kommentars '%-.200s'"
+ rus "îÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ × ËÏÍÅÎÔÁÒÉÉ '%-.200s'"
+ ukr "îÅÓÐÏĦ×ÁÎÎÉÊ Ë¦ÎÅÃØ ÆÁÊÌÕ Õ ËÏÍÅÎÔÁÒ¦ '%-.200s'"
ER_FPARSER_ERROR_IN_PARAMETER
eng "Error while parsing parameter '%-.64s' (line: '%-.64s')"
ger "Fehler beim Parsen des Parameters '%-.64s' (Zeile: '%-.64s')"
@@ -5306,7 +5306,7 @@ ER_TRG_ON_VIEW_OR_TEMP_TABLE
ger "'%-.64s' des Triggers ist View oder temporäre Tabelle"
ER_TRG_CANT_CHANGE_ROW
eng "Updating of %s row is not allowed in %strigger"
- ger "Aktualisieren einer %s-Zeile ist in einem %-Trigger nicht erlaubt"
+ ger "Aktualisieren einer %s-Zeile ist in einem %s-Trigger nicht erlaubt"
ER_TRG_NO_SUCH_ROW_IN_TRG
eng "There is no %s row in %s trigger"
ger "Es gibt keine %s-Zeile im %s-Trigger"
@@ -5388,7 +5388,7 @@ ER_LOGGING_PROHIBIT_CHANGING_OF
ger "Binärlogs und Replikation verhindern Wechsel des globalen Servers %s"
ER_NO_FILE_MAPPING
eng "Can't map file: %-.200s, errno: %d"
- ger "Kann Datei nicht abbilden: %-.64s, Fehler: %d"
+ ger "Kann Datei nicht abbilden: %-.200s, Fehler: %d"
ER_WRONG_MAGIC
eng "Wrong magic in %-.64s"
ger "Falsche magische Zahlen in %-.64s"
@@ -5523,7 +5523,7 @@ ER_CONNECT_TO_FOREIGN_DATA_SOURCE
eng "Unable to connect to foreign data source: %.64s"
ger "Kann nicht mit Fremddatenquelle verbinden: %.64s"
ER_QUERY_ON_FOREIGN_DATA_SOURCE
- eng "There was a problem processing the query on the foreign data source. Data source error: %-.64"
+ eng "There was a problem processing the query on the foreign data source. Data source error: %-.64s"
ger "Bei der Verarbeitung der Abfrage ist in der Fremddatenquelle ein Problem aufgetreten. Datenquellenfehlermeldung: %-.64s"
ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST
eng "The foreign data source you are trying to reference does not exist. Data source error: %-.64s"
diff --git a/sql/slave.cc b/sql/slave.cc
index 5ff05046895..9d466ce5dad 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -52,7 +52,9 @@ ulonglong relay_log_space_limit = 0;
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
int events_till_abort = -1;
+#ifndef DBUG_OFF
static int events_till_disconnect = -1;
+#endif
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
@@ -1695,7 +1697,7 @@ static int init_relay_log_info(RELAY_LOG_INFO* rli,
char fname[FN_REFLEN+128];
int info_fd;
const char* msg = 0;
- int error = 0;
+ int error;
DBUG_ENTER("init_relay_log_info");
if (rli->inited) // Set if this function called
@@ -1800,11 +1802,11 @@ file '%s', errno %d)", fname, my_errno);
}
else // file exists
{
+ error= 0;
if (info_fd >= 0)
reinit_io_cache(&rli->info_file, READ_CACHE, 0L,0,0);
else
{
- int error=0;
if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
{
sql_print_error("\
@@ -2514,12 +2516,12 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
if ((mi->slave_running == MYSQL_SLAVE_RUN_CONNECT) &&
mi->rli.slave_running)
{
- long tmp= (long)((time_t)time((time_t*) 0)
- - mi->rli.last_master_timestamp)
- - mi->clock_diff_with_master;
+ long time_diff= ((long)((time_t)time((time_t*) 0)
+ - mi->rli.last_master_timestamp)
+ - mi->clock_diff_with_master);
/*
- Apparently on some systems tmp can be <0. Here are possible reasons
- related to MySQL:
+ Apparently on some systems time_diff can be <0. Here are possible
+ reasons related to MySQL:
- the master is itself a slave of another master whose time is ahead.
- somebody used an explicit SET TIMESTAMP on the master.
Possible reason related to granularity-to-second of time functions
@@ -2537,8 +2539,8 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
last_master_timestamp == 0 (an "impossible" timestamp 1970) is a
special marker to say "consider we have caught up".
*/
- protocol->store((longlong)(mi->rli.last_master_timestamp ? max(0, tmp)
- : 0));
+ protocol->store((longlong)(mi->rli.last_master_timestamp ?
+ max(0, time_diff) : 0));
}
else
protocol->store_null();
@@ -3586,15 +3588,17 @@ after reconnect");
while (!io_slave_killed(thd,mi))
{
- bool suppress_warnings= 0;
+ ulong event_len;
+
+ suppress_warnings= 0;
/*
We say "waiting" because read_event() will wait if there's nothing to
read. But if there's something to read, it will not wait. The
important thing is to not confuse users by saying "reading" whereas
we're in fact receiving nothing.
*/
- thd->proc_info = "Waiting for master to send event";
- ulong event_len = read_event(mysql, mi, &suppress_warnings);
+ thd->proc_info= "Waiting for master to send event";
+ event_len= read_event(mysql, mi, &suppress_warnings);
if (io_slave_killed(thd,mi))
{
if (global_system_variables.log_warnings)
@@ -3757,8 +3761,13 @@ err:
mi->abort_slave= 0;
mi->slave_running= 0;
mi->io_thd= 0;
- pthread_mutex_unlock(&mi->run_lock);
+ /*
+ Note: the order of the two following calls (first broadcast, then unlock)
+ is important. Otherwise a killer_thread can execute between the calls and
+ delete the mi structure leading to a crash! (see BUG#25306 for details)
+ */
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
+ pthread_mutex_unlock(&mi->run_lock);
#ifndef DBUG_OFF
if (abort_slave_event_count && !events_till_abort)
goto slave_begin;
@@ -3976,8 +3985,13 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
THD_CHECK_SENTRY(thd);
delete thd;
pthread_mutex_unlock(&LOCK_thread_count);
- pthread_cond_broadcast(&rli->stop_cond);
+ /*
+ Note: the order of the broadcast and unlock calls below (first broadcast, then unlock)
+ is important. Otherwise a killer_thread can execute between the calls and
+ delete the mi structure leading to a crash! (see BUG#25306 for details)
+ */
+ pthread_cond_broadcast(&rli->stop_cond);
#ifndef DBUG_OFF
/*
Bug #19938 Valgrind error (race) in handle_slave_sql()
@@ -3985,9 +3999,8 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
*/
const int eta= rli->events_till_abort;
#endif
-
- // tell the world we are done
- pthread_mutex_unlock(&rli->run_lock);
+ pthread_mutex_unlock(&rli->run_lock); // tell the world we are done
+
#ifndef DBUG_OFF // TODO: reconsider the code below
if (abort_slave_event_count && !eta)
goto slave_begin;
@@ -4389,6 +4402,8 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
pthread_mutex_t *log_lock= rli->relay_log.get_log_lock();
DBUG_ENTER("queue_event");
+ LINT_INIT(inc_pos);
+
if (mi->rli.relay_log.description_event_for_queue->binlog_version<4 &&
buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
DBUG_RETURN(queue_old_event(mi,buf,event_len));
@@ -4529,7 +4544,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
err:
pthread_mutex_unlock(&mi->data_lock);
- DBUG_PRINT("info", ("error=%d", error));
+ DBUG_PRINT("info", ("error: %d", error));
DBUG_RETURN(error);
}
@@ -5170,6 +5185,70 @@ end:
}
+/**
+ Detects, based on master's version (as found in the relay log), if master
+ has a certain bug.
+ @param rli RELAY_LOG_INFO which tells the master's version
+ @param bug_id Number of the bug as found in bugs.mysql.com
+ @return TRUE if master has the bug, FALSE if it does not.
+*/
+bool rpl_master_has_bug(RELAY_LOG_INFO *rli, uint bug_id)
+{
+ struct st_version_range_for_one_bug {
+ uint bug_id;
+ const uchar introduced_in[3]; // first version with bug
+ const uchar fixed_in[3]; // first version with fix
+ };
+ static struct st_version_range_for_one_bug versions_for_all_bugs[]=
+ {
+ {24432, { 5, 0, 24 }, { 5, 0, 38 } },
+ {24432, { 5, 1, 12 }, { 5, 1, 17 } }
+ };
+ const uchar *master_ver=
+ rli->relay_log.description_event_for_exec->server_version_split;
+
+ DBUG_ASSERT(sizeof(rli->relay_log.description_event_for_exec->server_version_split) == 3);
+
+ for (uint i= 0;
+ i < sizeof(versions_for_all_bugs)/sizeof(*versions_for_all_bugs);i++)
+ {
+ const uchar *introduced_in= versions_for_all_bugs[i].introduced_in,
+ *fixed_in= versions_for_all_bugs[i].fixed_in;
+ if ((versions_for_all_bugs[i].bug_id == bug_id) &&
+ (memcmp(introduced_in, master_ver, 3) <= 0) &&
+ (memcmp(fixed_in, master_ver, 3) > 0))
+ {
+ // a verbose message for the error log
+ slave_print_error(rli, ER_UNKNOWN_ERROR,
+ "According to the master's version ('%s'),"
+ " it is probable that master suffers from this bug:"
+ " http://bugs.mysql.com/bug.php?id=%u"
+ " and thus replicating the current binary log event"
+ " may make the slave's data become different from the"
+ " master's data."
+ " To take no risk, slave refuses to replicate"
+ " this event and stops."
+ " We recommend that all updates be stopped on the"
+ " master and slave, that the data of both be"
+ " manually synchronized,"
+ " that master's binary logs be deleted,"
+ " that master be upgraded to a version at least"
+ " equal to '%d.%d.%d'. Then replication can be"
+ " restarted.",
+ rli->relay_log.description_event_for_exec->server_version,
+ bug_id,
+ fixed_in[0], fixed_in[1], fixed_in[2]);
+ // a short message for SHOW SLAVE STATUS (message length constraints)
+ my_printf_error(ER_UNKNOWN_ERROR, "master may suffer from"
+ " http://bugs.mysql.com/bug.php?id=%u"
+ " so slave stops; check error log on slave"
+ " for more info", MYF(0), bug_id);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
template class I_List_iterator<i_string>;
template class I_List_iterator<i_string_pair>;
diff --git a/sql/slave.h b/sql/slave.h
index bbf450bab75..e7d4456ccd9 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -533,6 +533,7 @@ void table_rule_ent_hash_to_str(String* s, HASH* h);
void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a);
bool show_master_info(THD* thd, MASTER_INFO* mi);
bool show_binlog_info(THD* thd);
+bool rpl_master_has_bug(RELAY_LOG_INFO *rli, uint bug_id);
/* See if the query uses any tables that should not be replicated */
bool tables_ok(THD* thd, TABLE_LIST* tables);
diff --git a/sql/sp.cc b/sql/sp.cc
index a33f6bfda29..2bb13b02e14 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -491,8 +491,6 @@ db_create_routine(THD *thd, int type, sp_head *sp)
int ret;
TABLE *table;
char definer[USER_HOST_BUFF_SIZE];
- char old_db_buf[NAME_LEN+1];
- LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
DBUG_ENTER("db_create_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length,
sp->m_name.str));
@@ -1842,9 +1840,7 @@ create_string(THD *thd, String *buf,
SYNOPSIS
sp_use_new_db()
thd thread handle
-
new_db new database name (a string and its length)
-
old_db [IN] str points to a buffer where to store the old
database, length contains the size of the buffer
[OUT] if old db was not NULL, its name is copied
@@ -1852,7 +1848,6 @@ create_string(THD *thd, String *buf,
accordingly. Otherwise str[0] is set to '\0' and length
is set to 0. The out parameter should be used only if
the database name has been changed (see dbchangedp).
-
dbchangedp [OUT] is set to TRUE if the current database is changed,
FALSE otherwise. A database is not changed if the old
name is the same as the new one, both names are empty,
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index de0edabda3e..4cb56e003ee 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -36,6 +36,7 @@ Item_result
sp_map_result_type(enum enum_field_types type)
{
switch (type) {
+ case MYSQL_TYPE_BIT:
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
@@ -58,6 +59,7 @@ Item::Type
sp_map_item_type(enum enum_field_types type)
{
switch (type) {
+ case MYSQL_TYPE_BIT:
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
@@ -94,8 +96,6 @@ sp_map_item_type(enum enum_field_types type)
static String *
sp_get_item_value(THD *thd, Item *item, String *str)
{
- Item_result result_type= item->result_type();
-
switch (item->result_type()) {
case REAL_RESULT:
case INT_RESULT:
@@ -1087,6 +1087,7 @@ sp_head::execute(THD *thd)
ctx->enter_handler(hip);
thd->clear_error();
thd->killed= THD::NOT_KILLED;
+ thd->mysys_var->abort= 0;
continue;
}
}
@@ -1464,8 +1465,24 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
binlog_save_options= thd->options;
if (need_binlog_call)
{
+ query_id_t q;
reset_dynamic(&thd->user_var_events);
- mysql_bin_log.start_union_events(thd);
+ /*
+ In case of artificially constructed events for function calls
+ we have separate union for each such event and hence can't use
+ query_id of real calling statement as the start of all these
+ unions (this will break logic of replication of user-defined
+ variables). So we use artifical value which is guaranteed to
+ be greater than all query_id's of all statements belonging
+ to previous events/unions.
+ Possible alternative to this is logging of all function invocations
+ as one select and not resetting THD::user_var_events before
+ each invocation.
+ */
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+ q= global_query_id;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ mysql_bin_log.start_union_events(thd, q + 1);
}
/*
@@ -1733,7 +1750,7 @@ sp_head::reset_lex(THD *thd)
DBUG_ENTER("sp_head::reset_lex");
LEX *sublex;
LEX *oldlex= thd->lex;
- my_lex_states state= oldlex->next_state; // Keep original next_state
+ my_lex_states org_next_state= oldlex->next_state;
(void)m_lex.push_front(oldlex);
thd->lex= sublex= new st_lex;
@@ -1742,10 +1759,10 @@ sp_head::reset_lex(THD *thd)
lex_start(thd, oldlex->buf, (ulong) (oldlex->end_of_query - oldlex->ptr));
/*
- * next_state is normally the same (0), but it happens that we swap lex in
- * "mid-sentence", so we must restore it.
+ next_state is normally the same (0), but it happens that we swap lex in
+ "mid-sentence", so we must restore it.
*/
- sublex->next_state= state;
+ sublex->next_state= org_next_state;
/* We must reset ptr and end_of_query again */
sublex->ptr= oldlex->ptr;
sublex->end_of_query= oldlex->end_of_query;
@@ -2374,16 +2391,11 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
m_lex->mark_as_requiring_prelocking(lex_query_tables_own_last);
}
}
-
+
reinit_stmt_before_use(thd, m_lex);
- /*
- If requested check whenever we have access to tables in LEX's table list
- and open and lock them before executing instructtions core function.
- */
- if (open_tables &&
- (check_table_access(thd, SELECT_ACL, m_lex->query_tables, 0) ||
- open_and_lock_tables(thd, m_lex->query_tables)))
- res= -1;
+
+ if (open_tables)
+ res= instr->exec_open_and_lock_tables(thd, m_lex->query_tables, nextp);
if (!res)
res= instr->exec_core(thd, nextp);
@@ -2432,6 +2444,33 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
sp_instr class functions
*/
+int sp_instr::exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables,
+ uint *nextp)
+{
+ int result;
+
+ /*
+ Check whenever we have access to tables for this statement
+ and open and lock them before executing instructions core function.
+ */
+ if (check_table_access(thd, SELECT_ACL, tables, 0)
+ || open_and_lock_tables(thd, tables))
+ {
+ get_cont_dest(nextp);
+ result= -1;
+ }
+ else
+ result= 0;
+
+ return result;
+}
+
+void sp_instr::get_cont_dest(uint *nextp)
+{
+ *nextp= m_ip+1;
+}
+
+
int sp_instr::exec_core(THD *thd, uint *nextp)
{
DBUG_ASSERT(0);
@@ -2612,6 +2651,15 @@ sp_instr_set_trigger_field::print(String *str)
value->print(str);
}
+/*
+ sp_instr_opt_meta
+*/
+
+void sp_instr_opt_meta::get_cont_dest(uint *nextp)
+{
+ *nextp= m_cont_dest;
+}
+
/*
sp_instr_jump class functions
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 0139f879ce4..10eada43721 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -458,6 +458,28 @@ public:
virtual int execute(THD *thd, uint *nextp) = 0;
+ /**
+ Execute <code>open_and_lock_tables()</code> for this statement.
+ Open and lock the tables used by this statement, as a pre-requisite
+ to execute the core logic of this instruction with
+ <code>exec_core()</code>.
+ If this statement fails, the next instruction to execute is also returned.
+ This is useful when a user defined SQL continue handler needs to be
+ executed.
+ @param thd the current thread
+ @param tables the list of tables to open and lock
+ @param nextp the continuation instruction, returned to the caller if this
+ method fails.
+ @return zero on success, non zero on failure.
+ */
+ int exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables, uint *nextp);
+
+ /**
+ Get the continuation destination of this instruction.
+ @param nextp the continuation destination (output)
+ */
+ virtual void get_cont_dest(uint *nextp);
+
/*
Execute core function of instruction after all preparations (e.g.
setting of proper LEX, saving part of the thread context have been
@@ -634,9 +656,9 @@ class sp_instr_set : public sp_instr
public:
sp_instr_set(uint ip, sp_pcontext *ctx,
- uint offset, Item *val, enum enum_field_types type,
+ uint offset, Item *val, enum enum_field_types type_arg,
LEX *lex, bool lex_resp)
- : sp_instr(ip, ctx), m_offset(offset), m_value(val), m_type(type),
+ : sp_instr(ip, ctx), m_offset(offset), m_value(val), m_type(type_arg),
m_lex_keeper(lex, lex_resp)
{}
@@ -722,6 +744,8 @@ public:
virtual void set_destination(uint old_dest, uint new_dest)
= 0;
+ virtual void get_cont_dest(uint *nextp);
+
protected:
sp_instr *m_optdest; // Used during optimization
@@ -834,8 +858,9 @@ class sp_instr_freturn : public sp_instr
public:
sp_instr_freturn(uint ip, sp_pcontext *ctx,
- Item *val, enum enum_field_types type, LEX *lex)
- : sp_instr(ip, ctx), m_value(val), m_type(type), m_lex_keeper(lex, TRUE)
+ Item *val, enum enum_field_types type_arg, LEX *lex)
+ : sp_instr(ip, ctx), m_value(val), m_type(type_arg),
+ m_lex_keeper(lex, TRUE)
{}
virtual ~sp_instr_freturn()
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 9012ced1041..939e7d2a3b4 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -23,13 +23,13 @@
String Geometry::bad_geometry_data("Bad object", &my_charset_bin);
-Geometry::Class_info *Geometry::ci_collection[Geometry::wkb_end+1]=
+Geometry::Class_info *Geometry::ci_collection[Geometry::wkb_last+1]=
{
NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
static Geometry::Class_info **ci_collection_end=
- Geometry::ci_collection+Geometry::wkb_end + 1;
+ Geometry::ci_collection+Geometry::wkb_last + 1;
Geometry::Class_info::Class_info(const char *name, int type_id,
void(*create_func)(void *)):
@@ -213,23 +213,24 @@ static uint32 wkb_get_uint(const char *ptr, Geometry::wkbByteOrder bo)
}
-int Geometry::create_from_wkb(Geometry_buffer *buffer,
- const char *wkb, uint32 len, String *res)
+Geometry *Geometry::create_from_wkb(Geometry_buffer *buffer,
+ const char *wkb, uint32 len, String *res)
{
uint32 geom_type;
Geometry *geom;
if (len < WKB_HEADER_SIZE)
- return 1;
+ return NULL;
geom_type= wkb_get_uint(wkb+1, (wkbByteOrder)wkb[0]);
if (!(geom= create_by_typeid(buffer, (int) geom_type)) ||
res->reserve(WKB_HEADER_SIZE, 512))
- return 1;
+ return NULL;
res->q_append((char) wkb_ndr);
res->q_append(geom_type);
- return geom->init_from_wkb(wkb+WKB_HEADER_SIZE, len - WKB_HEADER_SIZE,
- (wkbByteOrder) wkb[0], res);
+
+ return geom->init_from_wkb(wkb + WKB_HEADER_SIZE, len - WKB_HEADER_SIZE,
+ (wkbByteOrder) wkb[0], res) ? geom : NULL;
}
@@ -549,7 +550,7 @@ bool Gis_line_string::get_mbr(MBR *mbr, const char **end) const
}
-int Gis_line_string::length(double *len) const
+int Gis_line_string::geom_length(double *len) const
{
uint32 n_points;
double prev_x, prev_y;
@@ -945,15 +946,14 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
while (--n_points) // One point is already read
{
- double x, y;
- get_point(&x, &y, data);
+ double tmp_x, tmp_y;
+ get_point(&tmp_x, &tmp_y, data);
data+= (SIZEOF_STORED_DOUBLE*2);
- /* QQ: Is the following prev_x+x right ? */
- cur_area+= (prev_x + x) * (prev_y - y);
- cur_cx+= x;
- cur_cy+= y;
- prev_x= x;
- prev_y= y;
+ cur_area+= (prev_x + tmp_x) * (prev_y - tmp_y);
+ cur_cx+= tmp_x;
+ cur_cy+= tmp_y;
+ prev_x= tmp_x;
+ prev_y= tmp_y;
}
cur_area= fabs(cur_area) / 2;
cur_cx= cur_cx / (org_n_points - 1);
@@ -1297,7 +1297,7 @@ int Gis_multi_line_string::geometry_n(uint32 num, String *result) const
}
-int Gis_multi_line_string::length(double *len) const
+int Gis_multi_line_string::geom_length(double *len) const
{
uint32 n_line_strings;
const char *data= m_data;
@@ -1314,7 +1314,7 @@ int Gis_multi_line_string::length(double *len) const
Gis_line_string ls;
data+= WKB_HEADER_SIZE;
ls.set_data_ptr(data, (uint32) (m_data_end - data));
- if (ls.length(&ls_len))
+ if (ls.geom_length(&ls_len))
return 1;
*len+= ls_len;
/*
diff --git a/sql/spatial.h b/sql/spatial.h
index 3e398ac6200..86232fcd524 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -188,7 +188,7 @@ public:
wkb_multilinestring= 5,
wkb_multipolygon= 6,
wkb_geometrycollection= 7,
- wkb_end=7
+ wkb_last=7
};
enum wkbByteOrder
{
@@ -217,7 +217,7 @@ public:
virtual bool dimension(uint32 *dim, const char **end) const=0;
virtual int get_x(double *x) const { return -1; }
virtual int get_y(double *y) const { return -1; }
- virtual int length(double *len) const { return -1; }
+ virtual int geom_length(double *len) const { return -1; }
virtual int area(double *ar, const char **end) const { return -1;}
virtual int is_closed(int *closed) const { return -1; }
virtual int num_interior_ring(uint32 *n_int_rings) const { return -1; }
@@ -246,8 +246,8 @@ public:
static Geometry *create_from_wkt(Geometry_buffer *buffer,
Gis_read_stream *trs, String *wkt,
bool init_stream=1);
- static int create_from_wkb(Geometry_buffer *buffer,
- const char *wkb, uint32 len, String *res);
+ static Geometry *create_from_wkb(Geometry_buffer *buffer, const char *wkb,
+ uint32 len, String *res);
int as_wkt(String *wkt, const char **end)
{
uint32 len= get_class_info()->m_name.length;
@@ -273,12 +273,12 @@ public:
}
bool envelope(String *result) const;
- static Class_info *ci_collection[wkb_end+1];
+ static Class_info *ci_collection[wkb_last+1];
protected:
static Class_info *find_class(int type_id)
{
- return ((type_id < wkb_point) || (type_id > wkb_end)) ?
+ return ((type_id < wkb_point) || (type_id > wkb_last)) ?
NULL : ci_collection[type_id];
}
static Class_info *find_class(const char *name, uint32 len);
@@ -359,7 +359,7 @@ public:
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
- int length(double *len) const;
+ int geom_length(double *len) const;
int is_closed(int *closed) const;
int num_points(uint32 *n_points) const;
int start_point(String *point) const;
@@ -441,7 +441,7 @@ public:
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
int geometry_n(uint32 num, String *result) const;
- int length(double *len) const;
+ int geom_length(double *len) const;
int is_closed(int *closed) const;
bool dimension(uint32 *dim, const char **end) const
{
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 39a38f3c44e..ee15f95f305 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -5021,6 +5021,8 @@ static int handle_grant_struct(uint struct_no, bool drop,
user= grant_name->user;
host= grant_name->host.hostname;
break;
+ default:
+ assert(0);
}
if (! user)
user= "";
@@ -5880,6 +5882,8 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
char *curr_host= thd->security_ctx->priv_host_name();
DBUG_ENTER("fill_schema_user_privileges");
+ if (!initialized)
+ DBUG_RETURN(0);
pthread_mutex_lock(&acl_cache->lock);
for (counter=0 ; counter < acl_users.elements ; counter++)
@@ -5939,6 +5943,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
char *curr_host= thd->security_ctx->priv_host_name();
DBUG_ENTER("fill_schema_schema_privileges");
+ if (!initialized)
+ DBUG_RETURN(0);
pthread_mutex_lock(&acl_cache->lock);
for (counter=0 ; counter < acl_dbs.elements ; counter++)
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 239c787eca5..77bb1d9642b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -28,6 +28,59 @@
#include <io.h>
#endif
+/**
+ This internal handler is used to trap internally
+ errors that can occur when executing open table
+ during the prelocking phase.
+*/
+class Prelock_error_handler : public Internal_error_handler
+{
+public:
+ Prelock_error_handler()
+ : m_handled_errors(0), m_unhandled_errors(0)
+ {}
+
+ virtual ~Prelock_error_handler() {}
+
+ virtual bool handle_error(uint sql_errno,
+ MYSQL_ERROR::enum_warning_level level,
+ THD *thd);
+
+ bool safely_trapped_errors();
+
+private:
+ int m_handled_errors;
+ int m_unhandled_errors;
+};
+
+
+bool
+Prelock_error_handler::handle_error(uint sql_errno,
+ MYSQL_ERROR::enum_warning_level /* level */,
+ THD * /* thd */)
+{
+ if (sql_errno == ER_NO_SUCH_TABLE)
+ {
+ m_handled_errors++;
+ return TRUE; // 'TRUE', as per coding style
+ }
+
+ m_unhandled_errors++;
+ return FALSE; // 'FALSE', as per coding style
+}
+
+
+bool Prelock_error_handler::safely_trapped_errors()
+{
+ /*
+ If m_unhandled_errors != 0, something else, unanticipated, happened,
+ so the error is not trapped but returned to the caller.
+ Multiple ER_NO_SUCH_TABLE can be raised in case of views.
+ */
+ return ((m_handled_errors > 0) && (m_unhandled_errors == 0));
+}
+
+
TABLE *unused_tables; /* Used by mysql_test */
HASH open_cache; /* Used by mysql_test */
@@ -796,6 +849,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
thd thread handle
table table which should be checked
table_list list of tables
+ check_alias whether to check tables' aliases
NOTE: to exclude derived tables from check we use following mechanism:
a) during derived table processing set THD::derived_tables_processing
@@ -823,10 +877,11 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
0 if table is unique
*/
-TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list)
+TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
+ bool check_alias)
{
TABLE_LIST *res;
- const char *d_name, *t_name;
+ const char *d_name, *t_name, *t_alias;
DBUG_ENTER("unique_table");
DBUG_PRINT("enter", ("table alias: %s", table->alias));
@@ -854,6 +909,7 @@ TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list)
}
d_name= table->db;
t_name= table->table_name;
+ t_alias= table->alias;
DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
for (;;)
@@ -861,6 +917,9 @@ TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list)
if (((! (res= find_table_in_global_list(table_list, d_name, t_name))) &&
(! (res= mysql_lock_have_duplicate(thd, table, table_list)))) ||
((!res->table || res->table != table->table) &&
+ (!check_alias || !(lower_case_table_names ?
+ my_strcasecmp(files_charset_info, t_alias, res->alias) :
+ strcmp(t_alias, res->alias))) &&
res->select_lex && !res->select_lex->exclude_from_table_unique_test &&
!res->prelocking_placeholder))
break;
@@ -1210,6 +1269,13 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
int4store(key + key_length, thd->server_id);
int4store(key + key_length + 4, thd->variables.pseudo_thread_id);
+ /*
+ Unless requested otherwise, try to resolve this table in the list
+ of temporary tables of this thread. In MySQL temporary tables
+ are always thread-local and "shadow" possible base tables with the
+ same name. This block implements the behaviour.
+ TODO: move this block into a separate function.
+ */
if (!table_list->skip_temporary)
{
for (table= thd->temporary_tables; table ; table=table->next)
@@ -1218,6 +1284,12 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
!memcmp(table->s->table_cache_key, key,
key_length + TMP_TABLE_KEY_EXTRA))
{
+ /*
+ We're trying to use the same temporary table twice in a query.
+ Right now we don't support this because a temporary table
+ is always represented by only one TABLE object in THD, and
+ it can not be cloned. Emit an error for an unsupported behaviour.
+ */
if (table->query_id == thd->query_id ||
thd->prelocked_mode && table->query_id)
{
@@ -1233,6 +1305,13 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
}
+ /*
+ The table is not temporary - if we're in pre-locked or LOCK TABLES
+ mode, let's try to find the requested table in the list of pre-opened
+ and locked tables. If the table is not there, return an error - we can't
+ open not pre-opened tables in pre-locked/LOCK TABLES mode.
+ TODO: move this block into a separate function.
+ */
if (!(flags & MYSQL_OPEN_IGNORE_LOCKED_TABLES) &&
(thd->locked_tables || thd->prelocked_mode))
{ // Using table locks
@@ -1304,7 +1383,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
goto reset;
}
/*
- is it view?
+ Is this table a view and not a base table?
(it is work around to allow to open view with locked tables,
real fix will be made after definition cache will be made)
*/
@@ -1334,12 +1413,39 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
VOID(pthread_mutex_unlock(&LOCK_open));
}
}
- my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias);
+ if ((thd->locked_tables) && (thd->locked_tables->lock_count > 0))
+ my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias);
+ else
+ my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias);
DBUG_RETURN(0);
}
+ /*
+ Non pre-locked/LOCK TABLES mode, and the table is not temporary:
+ this is the normal use case.
+ Now we should:
+ - try to find the table in the table cache.
+ - if one of the discovered TABLE instances is name-locked
+ (table->s->version == 0) or some thread has started FLUSH TABLES
+ (refresh_version > table->s->version), back off -- we have to wait
+ until no one holds a name lock on the table.
+ - if there is no such TABLE in the name cache, read the table definition
+ and insert it into the cache.
+ We perform all of the above under LOCK_open which currently protects
+ the open cache (also known as table cache) and table definitions stored
+ on disk.
+ */
+
VOID(pthread_mutex_lock(&LOCK_open));
+ /*
+ If it's the first table from a list of tables used in a query,
+ remember refresh_version (the version of open_cache state).
+ If the version changes while we're opening the remaining tables,
+ we will have to back off, close all the tables opened-so-far,
+ and try to reopen them.
+ Note: refresh_version is currently changed only during FLUSH TABLES.
+ */
if (!thd->open_tables)
thd->version=refresh_version;
else if ((thd->version != refresh_version) &&
@@ -1356,12 +1462,39 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (thd->handler_tables)
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
+ /*
+ Actually try to find the table in the open_cache.
+ The cache may contain several "TABLE" instances for the same
+ physical table. The instances that are currently "in use" by
+ some thread have their "in_use" member != NULL.
+ There is no good reason for having more than one entry in the
+ hash for the same physical table, except that we use this as
+ an implicit "pending locks queue" - see
+ wait_for_locked_table_names for details.
+ */
for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
&state);
table && table->in_use ;
table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
&state))
{
+ /*
+ Normally, table->s->version contains the value of
+ refresh_version from the moment when this table was
+ (re-)opened and added to the cache.
+ If since then we did (or just started) FLUSH TABLES
+ statement, refresh_version has been increased.
+ For "name-locked" TABLE instances, table->s->version is set
+ to 0 (see lock_table_name for details).
+ In case there is a pending FLUSH TABLES or a name lock, we
+ need to back off and re-start opening tables.
+ If we do not back off now, we may dead lock in case of lock
+ order mismatch with some other thread:
+ c1: name lock t1; -- sort of exclusive lock
+ c2: open t2; -- sort of shared lock
+ c1: name lock t2; -- blocks
+ c2: open t1; -- blocks
+ */
if (table->s->version != refresh_version)
{
DBUG_PRINT("note",
@@ -1375,16 +1508,35 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
/*
- There is a refresh in progress for this table
- Wait until the table is freed or the thread is killed.
+ Back off, part 1: mark the table as "unused" for the
+ purpose of name-locking by setting table->db_stat to 0. Do
+ that only for the tables in this thread that have an old
+ table->s->version (this is an optimization (?)).
+ table->db_stat == 0 signals wait_for_locked_table_names
+ that the tables in question are not used any more. See
+ table_is_used call for details.
*/
close_old_data_files(thd,thd->open_tables,0,0);
+ /*
+ Back-off part 2: try to avoid "busy waiting" on the table:
+ if the table is in use by some other thread, we suspend
+ and wait till the operation is complete: when any
+ operation that juggles with table->s->version completes,
+ it broadcasts COND_refresh condition variable.
+ */
if (table->in_use != thd)
+ {
wait_for_refresh(thd);
+ /* wait_for_refresh will unlock LOCK_open for us */
+ }
else
{
VOID(pthread_mutex_unlock(&LOCK_open));
}
+ /*
+ There is a refresh in progress for this table.
+ Signal the caller that it has to try again.
+ */
if (refresh)
*refresh=1;
DBUG_RETURN(0);
@@ -1392,6 +1544,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
if (table)
{
+ /* Unlink the table from "unused_tables" list. */
if (table == unused_tables)
{ // First unused
unused_tables=unused_tables->next; // Remove from link
@@ -1404,6 +1557,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
else
{
+ /* Insert a new TABLE instance into the open cache */
TABLE_SHARE *share;
int error;
/* Free cache if too big */
@@ -2092,6 +2246,8 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
MEM_ROOT new_frm_mem;
/* Also used for indicating that prelocking is need */
TABLE_LIST **query_tables_last_own;
+ bool safe_to_ignore_table;
+
DBUG_ENTER("open_tables");
/*
temporary mem_root for new .frm parsing.
@@ -2145,8 +2301,13 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
}
}
+ /*
+ For every table in the list of tables to open, try to find or open
+ a table.
+ */
for (tables= *start; tables ;tables= tables->next_global)
{
+ safe_to_ignore_table= FALSE; // 'FALSE', as per coding style
/*
Ignore placeholders for derived tables. After derived tables
processing, link to created temporary table will be put here.
@@ -2159,6 +2320,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
goto process_view_routines;
continue;
}
+ /*
+ If this TABLE_LIST object is a placeholder for an information_schema
+ table, create a temporary table to represent the information_schema
+ table in the query. Do not fill it yet - will be filled during
+ execution.
+ */
if (tables->schema_table)
{
if (!mysql_schema_table(thd, thd->lex, tables))
@@ -2166,9 +2333,32 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
DBUG_RETURN(-1);
}
(*counter)++;
-
- if (!tables->table &&
- !(tables->table= open_table(thd, tables, &new_frm_mem, &refresh, flags)))
+
+ /*
+ Not a placeholder: must be a base table or a view, and the table is
+ not opened yet. Try to open the table.
+ */
+ if (!tables->table)
+ {
+ if (tables->prelocking_placeholder)
+ {
+ /*
+ For the tables added by the pre-locking code, attempt to open
+ the table but fail silently if the table does not exist.
+ The real failure will occur when/if a statement attempts to use
+ that table.
+ */
+ Prelock_error_handler prelock_handler;
+ thd->push_internal_handler(& prelock_handler);
+ tables->table= open_table(thd, tables, &new_frm_mem, &refresh, flags);
+ thd->pop_internal_handler();
+ safe_to_ignore_table= prelock_handler.safely_trapped_errors();
+ }
+ else
+ tables->table= open_table(thd, tables, &new_frm_mem, &refresh, flags);
+ }
+
+ if (!tables->table)
{
free_root(&new_frm_mem, MYF(MY_KEEP_PREALLOC));
@@ -2219,6 +2409,14 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
close_tables_for_reopen(thd, start);
goto restart;
}
+
+ if (safe_to_ignore_table)
+ {
+ DBUG_PRINT("info", ("open_table: ignoring table '%s'.'%s'",
+ tables->db, tables->alias));
+ continue;
+ }
+
result= -1; // Fatal error
break;
}
@@ -2273,7 +2471,7 @@ process_view_routines:
{
/*
Serious error during reading stored routines from mysql.proc table.
- Something's wrong with the table or its contents, and an error has
+ Something is wrong with the table or its contents, and an error has
been emitted; we must abort.
*/
result= -1;
@@ -2522,7 +2720,7 @@ bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags)
static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table)
{
for (; table; table= table->next_global)
- if (!table->placeholder() && !table->schema_table)
+ if (!table->placeholder())
table->table->query_id= 0;
}
@@ -2594,7 +2792,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
DBUG_RETURN(-1);
for (table= tables; table; table= table->next_global)
{
- if (!table->placeholder() && !table->schema_table)
+ if (!table->placeholder())
*(ptr++)= table->table;
}
@@ -2636,7 +2834,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
for (table= tables; table != first_not_own; table= table->next_global)
{
- if (!table->placeholder() && !table->schema_table)
+ if (!table->placeholder())
{
table->table->query_id= thd->query_id;
if (check_lock_and_start_stmt(thd, table->table, table->lock_type))
@@ -2663,7 +2861,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
TABLE_LIST *first_not_own= thd->lex->first_not_own_table();
for (table= tables; table != first_not_own; table= table->next_global)
{
- if (!table->placeholder() && !table->schema_table &&
+ if (!table->placeholder() &&
check_lock_and_start_stmt(thd, table->table, table->lock_type))
{
ha_rollback_stmt(thd);
@@ -2975,6 +3173,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
if (nj_col->view_field)
{
Item *item;
+ LINT_INIT(arena);
if (register_tree_change)
arena= thd->activate_stmt_arena_if_needed(&backup);
/*
@@ -3461,10 +3660,13 @@ find_field_in_tables(THD *thd, Item_ident *item,
return not_found_item, report other errors,
return 0
IGNORE_ERRORS Do not report errors, return 0 if error
- unaliased Set to true if item is field which was found
- by original field name and not by its alias
- in item list. Set to false otherwise.
-
+ resolution Set to the resolution type if the item is found
+ (it says whether the item is resolved
+ against an alias name,
+ or as a field name without alias,
+ or as a field hidden by alias,
+ or ignoring alias)
+
RETURN VALUES
0 Item is not found or item is not unique,
error message is reported
@@ -3480,7 +3682,8 @@ Item **not_found_item= (Item**) 0x1;
Item **
find_item_in_list(Item *find, List<Item> &items, uint *counter,
- find_item_error_report_type report_error, bool *unaliased)
+ find_item_error_report_type report_error,
+ enum_resolution_type *resolution)
{
List_iterator<Item> li(items);
Item **found=0, **found_unaliased= 0, *item;
@@ -3494,10 +3697,9 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
*/
bool is_ref_by_name= 0;
uint unaliased_counter;
-
LINT_INIT(unaliased_counter); // Dependent on found_unaliased
- *unaliased= FALSE;
+ *resolution= NOT_RESOLVED;
is_ref_by_name= (find->type() == Item::FIELD_ITEM ||
find->type() == Item::REF_ITEM);
@@ -3564,63 +3766,77 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
}
found_unaliased= li.ref();
unaliased_counter= i;
+ *resolution= RESOLVED_IGNORING_ALIAS;
if (db_name)
break; // Perfect match
}
}
- else if (!my_strcasecmp(system_charset_info, item_field->name,
- field_name))
- {
- /*
- If table name was not given we should scan through aliases
- (or non-aliased fields) first. We are also checking unaliased
- name of the field in then next else-if, to be able to find
- instantly field (hidden by alias) if no suitable alias (or
- non-aliased field) was found.
- */
- if (found)
- {
- if ((*found)->eq(item, 0))
- continue; // Same field twice
- if (report_error != IGNORE_ERRORS)
- my_error(ER_NON_UNIQ_ERROR, MYF(0),
- find->full_name(), current_thd->where);
- return (Item**) 0;
- }
- found= li.ref();
- *counter= i;
- }
- else if (!my_strcasecmp(system_charset_info, item_field->field_name,
- field_name))
+ else
{
- /*
- We will use un-aliased field or react on such ambiguities only if
- we won't be able to find aliased field.
- Again if we have ambiguity with field outside of select list
- we should prefer fields from select list.
- */
- if (found_unaliased)
+ int fname_cmp= my_strcasecmp(system_charset_info,
+ item_field->field_name,
+ field_name);
+ if (!my_strcasecmp(system_charset_info,
+ item_field->name,field_name))
{
- if ((*found_unaliased)->eq(item, 0))
- continue; // Same field twice
- found_unaliased_non_uniq= 1;
+ /*
+ If table name was not given we should scan through aliases
+ and non-aliased fields first. We are also checking unaliased
+ name of the field in then next else-if, to be able to find
+ instantly field (hidden by alias) if no suitable alias or
+ non-aliased field was found.
+ */
+ if (found)
+ {
+ if ((*found)->eq(item, 0))
+ continue; // Same field twice
+ if (report_error != IGNORE_ERRORS)
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ find->full_name(), current_thd->where);
+ return (Item**) 0;
+ }
+ found= li.ref();
+ *counter= i;
+ *resolution= fname_cmp ? RESOLVED_AGAINST_ALIAS:
+ RESOLVED_WITH_NO_ALIAS;
}
- else
+ else if (!fname_cmp)
{
+ /*
+ We will use non-aliased field or react on such ambiguities only if
+ we won't be able to find aliased field.
+ Again if we have ambiguity with field outside of select list
+ we should prefer fields from select list.
+ */
+ if (found_unaliased)
+ {
+ if ((*found_unaliased)->eq(item, 0))
+ continue; // Same field twice
+ found_unaliased_non_uniq= 1;
+ }
found_unaliased= li.ref();
unaliased_counter= i;
}
}
}
- else if (!table_name && (find->eq(item,0) ||
- is_ref_by_name && find->name && item->name &&
- !my_strcasecmp(system_charset_info,
- item->name,find->name)))
- {
- found= li.ref();
- *counter= i;
- break;
- }
+ else if (!table_name)
+ {
+ if (is_ref_by_name && find->name && item->name &&
+ !my_strcasecmp(system_charset_info,item->name,find->name))
+ {
+ found= li.ref();
+ *counter= i;
+ *resolution= RESOLVED_AGAINST_ALIAS;
+ break;
+ }
+ else if (find->eq(item,0))
+ {
+ found= li.ref();
+ *counter= i;
+ *resolution= RESOLVED_IGNORING_ALIAS;
+ break;
+ }
+ }
}
if (!found)
{
@@ -3635,7 +3851,7 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
{
found= found_unaliased;
*counter= unaliased_counter;
- *unaliased= TRUE;
+ *resolution= RESOLVED_BEHIND_ALIAS;
}
}
if (found)
@@ -4413,12 +4629,15 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
bool save_set_query_id= thd->set_query_id;
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
List_iterator<Item> it(fields);
+ bool save_is_item_list_lookup;
DBUG_ENTER("setup_fields");
thd->set_query_id=set_query_id;
if (allow_sum_func)
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
thd->where= THD::DEFAULT_WHERE;
+ save_is_item_list_lookup= thd->lex->current_select->is_item_list_lookup;
+ thd->lex->current_select->is_item_list_lookup= 0;
/*
To prevent fail on forward lookup we fill it with zerows,
@@ -4441,6 +4660,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
if (!item->fixed && item->fix_fields(thd, it.ref()) ||
(item= *(it.ref()))->check_cols(1))
{
+ thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
thd->lex->allow_sum_func= save_allow_sum_func;
thd->set_query_id= save_set_query_id;
DBUG_RETURN(TRUE); /* purecov: inspected */
@@ -4453,6 +4673,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
thd->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;
}
+ thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
thd->lex->allow_sum_func= save_allow_sum_func;
@@ -4949,6 +5170,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
*/
bool it_is_update= (select_lex == &thd->lex->select_lex) &&
thd->lex->which_check_option_applicable();
+ bool save_is_item_list_lookup= select_lex->is_item_list_lookup;
+ select_lex->is_item_list_lookup= 0;
DBUG_ENTER("setup_conds");
if (select_lex->conds_processed_with_permanent_arena ||
@@ -5023,9 +5246,11 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
select_lex->where= *conds;
select_lex->conds_processed_with_permanent_arena= 1;
}
+ thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
DBUG_RETURN(test(thd->net.report_error));
err_no_arena:
+ select_lex->is_item_list_lookup= save_is_item_list_lookup;
DBUG_RETURN(1);
}
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 8e6846fdcd2..d06ac7824fd 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1765,8 +1765,18 @@ void Query_cache::free_cache()
{
DBUG_ENTER("Query_cache::free_cache");
if (query_cache_size > 0)
- {
flush_cache();
+ /*
+ There may be two free_cache() calls in progress, because we
+ release 'structure_guard_mutex' in flush_cache(). When the second
+ flush_cache() wakes up from the wait on 'COND_flush_finished', the
+ first call to free_cache() has done its job. So we have to test
+ 'query_cache_size > 0' the second time to see if the cache wasn't
+ reset by other thread, or if it was reset and was re-enabled then.
+ If the cache was reset, then we have nothing to do here.
+ */
+ if (query_cache_size > 0)
+ {
#ifndef DBUG_OFF
if (bins[0].free_blocks == 0)
{
@@ -1808,6 +1818,12 @@ void Query_cache::free_cache()
flush_in_progress flag and releases the lock, so other threads may
proceed skipping the cache as if it is disabled. Concurrent
flushes are performed in turn.
+
+ After flush_cache() call, the cache is flushed, all the freed
+ memory is accumulated in bin[0], and the 'structure_guard_mutex'
+ is locked. However, since we could release the mutex during
+ execution, the rest of the cache state could have been changed,
+ and should not be relied on.
*/
void Query_cache::flush_cache()
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 0fbc06ce919..bc00f7ea629 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -127,7 +127,7 @@ struct Query_cache_query
inline void tables_type(uint8 type) { tbls_type= type; }
inline ulong length() { return len; }
inline ulong add(ulong packet_len) { return(len+= packet_len); }
- inline void length(ulong length) { len= length; }
+ inline void length(ulong length_arg) { len= length_arg; }
inline gptr query()
{
return (gptr)(((byte*)this)+
@@ -155,7 +155,7 @@ struct Query_cache_table
inline char *db() { return (char *) data(); }
inline char *table() { return tbl; }
- inline void table(char *table) { tbl= table; }
+ inline void table(char *table_arg) { tbl= table_arg; }
inline uint32 key_length() { return key_len; }
inline void key_length(uint32 len) { key_len= len; }
inline uint8 type() { return table_type; }
@@ -163,7 +163,7 @@ struct Query_cache_table
inline qc_engine_callback callback() { return callback_func; }
inline void callback(qc_engine_callback fn){ callback_func= fn; }
inline ulonglong engine_data() { return engine_data_buff; }
- inline void engine_data(ulonglong data) { engine_data_buff= data; }
+ inline void engine_data(ulonglong data_arg){ engine_data_buff= data_arg; }
inline gptr data()
{
return (gptr)(((byte*)this)+
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 3b612dadcd0..8c276d40cdf 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -166,14 +166,10 @@ Open_tables_state::Open_tables_state(ulong version_arg)
}
-/*
- Pass nominal parameters to Statement constructor only to ensure that
- the destructor works OK in case of error. The main_mem_root will be
- re-initialized in init().
-*/
THD::THD()
- :Statement(CONVENTIONAL_EXECUTION, 0, ALLOC_ROOT_MIN_BLOCK_SIZE, 0),
+ :Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
+ /* statement id */ 0),
Open_tables_state(refresh_version),
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
@@ -182,6 +178,14 @@ THD::THD()
clear_next_insert_id(0), in_lock_tables(0), bootstrap(0),
derived_tables_processing(FALSE), spcont(NULL)
{
+ ulong tmp;
+
+ /*
+ Pass nominal parameters to init_alloc_root only to ensure that
+ the destructor works OK in case of an error. The main_mem_root
+ will be re-initialized in init_for_queries().
+ */
+ init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
stmt_arena= this;
thread_stack= 0;
db= 0;
@@ -224,7 +228,9 @@ THD::THD()
#endif
client_capabilities= 0; // minimalistic client
net.last_error[0]=0; // If error on boot
+#ifdef HAVE_QUERY_CACHE
query_cache_init_query(&net); // If error on boot
+#endif
ull=0;
system_thread= cleanup_done= abort_on_warning= no_warnings_for_error= 0;
peer_port= 0; // For SHOW PROCESSLIST
@@ -268,11 +274,43 @@ THD::THD()
protocol_prep.init(this);
tablespace_op=FALSE;
- ulong tmp=sql_rnd_with_mutex();
- randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id);
+ tmp= sql_rnd_with_mutex();
+ randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id);
substitute_null_with_insert_id = FALSE;
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
thr_lock_owner_init(&main_lock_id, &lock_info);
+
+ m_internal_handler= NULL;
+}
+
+
+void THD::push_internal_handler(Internal_error_handler *handler)
+{
+ /*
+ TODO: The current implementation is limited to 1 handler at a time only.
+ THD and sp_rcontext need to be modified to use a common handler stack.
+ */
+ DBUG_ASSERT(m_internal_handler == NULL);
+ m_internal_handler= handler;
+}
+
+
+bool THD::handle_error(uint sql_errno,
+ MYSQL_ERROR::enum_warning_level level)
+{
+ if (m_internal_handler)
+ {
+ return m_internal_handler->handle_error(sql_errno, level, this);
+ }
+
+ return FALSE; // 'FALSE', as per coding style
+}
+
+
+void THD::pop_internal_handler()
+{
+ DBUG_ASSERT(m_internal_handler != NULL);
+ m_internal_handler= NULL;
}
@@ -317,6 +355,7 @@ void THD::init(void)
void THD::init_for_queries()
{
+ set_time();
ha_enable_transaction(this,TRUE);
reset_root_defaults(mem_root, variables.query_alloc_block_size,
@@ -440,6 +479,7 @@ THD::~THD()
#ifndef DBUG_OFF
dbug_sentry= THD_SENTRY_GONE;
#endif
+ free_root(&main_mem_root, MYF(0));
DBUG_VOID_RETURN;
}
@@ -899,6 +939,7 @@ sql_exchange::sql_exchange(char *name,bool flag)
enclosed= line_start= &my_empty_string;
line_term= &default_line_term;
escaped= &default_escaped;
+ cs= NULL;
}
bool select_send::send_fields(List<Item> &list, uint flags)
@@ -1081,7 +1122,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
IO_CACHE *cache)
{
File file;
- uint option= MY_UNPACK_FILENAME;
+ uint option= MY_UNPACK_FILENAME | MY_RELATIVE_PATH;
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
option|= MY_REPLACE_DIR; // Force use of db directory
@@ -1094,7 +1135,15 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
}
else
(void) fn_format(path, exchange->file_name, mysql_real_data_home, "", option);
-
+
+ if (opt_secure_file_priv &&
+ strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
+ {
+ /* Write only allowed to dir or subdir specified by secure_file_priv */
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
+ return -1;
+ }
+
if (!access(path, F_OK))
{
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
@@ -1435,7 +1484,7 @@ bool select_max_min_finder_subselect::send_data(List<Item> &items)
bool select_max_min_finder_subselect::cmp_real()
{
- Item *maxmin= ((Item_singlerow_subselect *)item)->el(0);
+ Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0);
double val1= cache->val_real(), val2= maxmin->val_real();
if (fmax)
return (cache->null_value && !maxmin->null_value) ||
@@ -1448,7 +1497,7 @@ bool select_max_min_finder_subselect::cmp_real()
bool select_max_min_finder_subselect::cmp_int()
{
- Item *maxmin= ((Item_singlerow_subselect *)item)->el(0);
+ Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0);
longlong val1= cache->val_int(), val2= maxmin->val_int();
if (fmax)
return (cache->null_value && !maxmin->null_value) ||
@@ -1461,7 +1510,7 @@ bool select_max_min_finder_subselect::cmp_int()
bool select_max_min_finder_subselect::cmp_decimal()
{
- Item *maxmin= ((Item_singlerow_subselect *)item)->el(0);
+ Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0);
my_decimal cval, *cvalue= cache->val_decimal(&cval);
my_decimal mval, *mvalue= maxmin->val_decimal(&mval);
if (fmax)
@@ -1476,7 +1525,7 @@ bool select_max_min_finder_subselect::cmp_decimal()
bool select_max_min_finder_subselect::cmp_str()
{
String *val1, *val2, buf1, buf2;
- Item *maxmin= ((Item_singlerow_subselect *)item)->el(0);
+ Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0);
/*
as far as both operand is Item_cache buf1 & buf2 will not be used,
but added for safety
@@ -1577,18 +1626,17 @@ void Query_arena::cleanup_stmt()
Statement functions
*/
-Statement::Statement(enum enum_state state_arg, ulong id_arg,
- ulong alloc_block_size, ulong prealloc_size)
- :Query_arena(&main_mem_root, state_arg),
+Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
+ enum enum_state state_arg, ulong id_arg)
+ :Query_arena(mem_root_arg, state_arg),
id(id_arg),
set_query_id(1),
- lex(&main_lex),
+ lex(lex_arg),
query(0),
query_length(0),
cursor(0)
{
name.str= NULL;
- init_sql_alloc(&main_mem_root, alloc_block_size, prealloc_size);
}
@@ -1630,7 +1678,7 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
void THD::end_statement()
{
- /* Cleanup SQL processing state to resuse this statement in next query. */
+ /* Cleanup SQL processing state to reuse this statement in next query. */
lex_end(lex);
delete lex->result;
lex->result= 0;
@@ -1671,12 +1719,6 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup)
Statement::~Statement()
{
- /*
- We must free `main_mem_root', not `mem_root' (pointer), to work
- correctly if this statement is used as a backup statement,
- for which `mem_root' may point to some other statement.
- */
- free_root(&main_mem_root, MYF(0));
}
C_MODE_START
@@ -2048,6 +2090,10 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup,
if (!lex->requires_prelocking() || is_update_query(lex->sql_command))
options&= ~OPTION_BIN_LOG;
+
+ if ((backup->options & OPTION_BIN_LOG) && is_update_query(lex->sql_command))
+ mysql_bin_log.start_union_events(this, this->query_id);
+
/* Disable result sets */
client_capabilities &= ~CLIENT_MULTI_RESULTS;
in_sub_stmt|= new_state;
@@ -2094,6 +2140,9 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
sent_row_count= backup->sent_row_count;
client_capabilities= backup->client_capabilities;
+ if ((options & OPTION_BIN_LOG) && is_update_query(lex->sql_command))
+ mysql_bin_log.stop_union_events(this);
+
/*
The following is added to the old values as we are interested in the
total complexity of the query
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 05034ebd573..99803802001 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -63,7 +63,7 @@ class TC_LOG
virtual int open(const char *opt_name)=0;
virtual void close()=0;
- virtual int log(THD *thd, my_xid xid)=0;
+ virtual int log_xid(THD *thd, my_xid xid)=0;
virtual void unlog(ulong cookie, my_xid xid)=0;
};
@@ -73,7 +73,7 @@ public:
TC_LOG_DUMMY() {} /* Remove gcc warning */
int open(const char *opt_name) { return 0; }
void close() { }
- int log(THD *thd, my_xid xid) { return 1; }
+ int log_xid(THD *thd, my_xid xid) { return 1; }
void unlog(ulong cookie, my_xid xid) { }
};
@@ -118,7 +118,7 @@ class TC_LOG_MMAP: public TC_LOG
TC_LOG_MMAP(): inited(0) {}
int open(const char *opt_name);
void close();
- int log(THD *thd, my_xid xid);
+ int log_xid(THD *thd, my_xid xid);
void unlog(ulong cookie, my_xid xid);
int recover();
@@ -252,7 +252,7 @@ public:
int open(const char *opt_name);
void close();
- int log(THD *thd, my_xid xid);
+ int log_xid(THD *thd, my_xid xid);
void unlog(ulong cookie, my_xid xid);
int recover(IO_CACHE *log, Format_description_log_event *fdle);
void reset_bytes_written()
@@ -311,7 +311,7 @@ public:
bool write(Log_event* event_info); // binary log write
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event);
- void start_union_events(THD *thd);
+ void start_union_events(THD *thd, query_id_t query_id_param);
void stop_union_events(THD *thd);
bool is_query_in_union(THD *thd, query_id_t query_id_param);
@@ -356,13 +356,25 @@ public:
inline uint32 get_open_count() { return open_count; }
};
-
+/*
+ The COPY_INFO structure is used by INSERT/REPLACE code.
+ The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY
+ UPDATE code:
+ If a row is inserted then the copied variable is incremented.
+ If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the
+ new data differs from the old one then the copied and the updated
+ variables are incremented.
+ The touched variable is incremented if a row was touched by the update part
+ of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row
+ was actually changed or not.
+*/
typedef struct st_copy_info {
- ha_rows records;
- ha_rows deleted;
- ha_rows updated;
- ha_rows copied;
+ ha_rows records; /* Number of processed records */
+ ha_rows deleted; /* Number of deleted records */
+ ha_rows updated; /* Number of updated records */
+ ha_rows copied; /* Number of copied records */
ha_rows error_count;
+ ha_rows touched; /* Number of touched records */
enum enum_duplicates handle_duplicates;
int escape_char, last_errno;
bool ignore;
@@ -753,8 +765,10 @@ public:
class Server_side_cursor;
-/*
- State of a single command executed against this connection.
+/**
+ @class Statement
+ @brief State of a single command executed against this connection.
+
One connection can contain a lot of simultaneously running statements,
some of which could be:
- prepared, that is, contain placeholders,
@@ -772,10 +786,6 @@ class Statement: public ilink, public Query_arena
Statement(const Statement &rhs); /* not implemented: */
Statement &operator=(const Statement &rhs); /* non-copyable */
public:
- /* FIXME: these must be protected */
- MEM_ROOT main_mem_root;
- LEX main_lex;
-
/*
Uniquely identifies each statement object in thread scope; change during
statement lifetime. FIXME: must be const
@@ -819,10 +829,10 @@ public:
public:
/* This constructor is called for backup statements */
- Statement() { clear_alloc_root(&main_mem_root); }
+ Statement() {}
- Statement(enum enum_state state_arg, ulong id_arg,
- ulong alloc_block_size, ulong prealloc_size);
+ Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
+ enum enum_state state_arg, ulong id_arg);
virtual ~Statement();
/* Assign execution context (note: not all members) of given stmt to self */
@@ -834,7 +844,7 @@ public:
};
-/*
+/**
Container for all statements created/used in a connection.
Statements in Statement_map have unique Statement::id (guaranteed by id
assignment in Statement::Statement)
@@ -914,6 +924,10 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state);
bool xid_cache_insert(XID_STATE *xid_state);
void xid_cache_delete(XID_STATE *xid_state);
+/**
+ @class Security_context
+ @brief A set of THD members describing the current authenticated user.
+*/
class Security_context {
public:
@@ -943,7 +957,7 @@ public:
};
-/*
+/**
A registry for item tree transformations performed during
query optimization. We register only those changes which require
a rollback to re-execute a prepared statement or stored procedure
@@ -954,7 +968,7 @@ struct Item_change_record;
typedef I_List<Item_change_record> Item_change_list;
-/*
+/**
Type of prelocked mode.
See comment for THD::prelocked_mode for complete description.
*/
@@ -963,7 +977,7 @@ enum prelocked_mode_type {NON_PRELOCKED= 0, PRELOCKED= 1,
PRELOCKED_UNDER_LOCK_TABLES= 2};
-/*
+/**
Class that holds information about tables which were opened and locked
by the thread. It is also used to save/restore this information in
push_open_tables_state()/pop_open_tables_state().
@@ -1048,14 +1062,17 @@ public:
}
};
-
-/* class to save context when executing a function or trigger */
+/**
+ @class Sub_statement_state
+ @brief Used to save context when executing a function or trigger
+*/
/* Defines used for Sub_statement_state::in_sub_stmt */
#define SUB_STMT_TRIGGER 1
#define SUB_STMT_FUNCTION 2
+
class Sub_statement_state
{
public:
@@ -1071,8 +1088,51 @@ public:
SAVEPOINT *savepoints;
};
+/**
+ This class represents the interface for internal error handlers.
+ Internal error handlers are exception handlers used by the server
+ implementation.
+*/
+class Internal_error_handler
+{
+protected:
+ Internal_error_handler() {}
+ virtual ~Internal_error_handler() {}
-/*
+public:
+ /**
+ Handle an error condition.
+ This method can be implemented by a subclass to achieve any of the
+ following:
+ - mask an error internally, prevent exposing it to the user,
+ - mask an error and throw another one instead.
+ When this method returns true, the error condition is considered
+ 'handled', and will not be propagated to upper layers.
+ It is the responsability of the code installing an internal handler
+ to then check for trapped conditions, and implement logic to recover
+ from the anticipated conditions trapped during runtime.
+
+ This mechanism is similar to C++ try/throw/catch:
+ - 'try' correspond to <code>THD::push_internal_handler()</code>,
+ - 'throw' correspond to <code>my_error()</code>,
+ which invokes <code>my_message_sql()</code>,
+ - 'catch' correspond to checking how/if an internal handler was invoked,
+ before removing it from the exception stack with
+ <code>THD::pop_internal_handler()</code>.
+
+ @param sql_errno the error number
+ @param level the error level
+ @param thd the calling thread
+ @return true if the error is handled
+ */
+ virtual bool handle_error(uint sql_errno,
+ MYSQL_ERROR::enum_warning_level level,
+ THD *thd) = 0;
+};
+
+
+/**
+ @class THD
For each client connection we create a separate thread with THD serving as
a thread/connection descriptor
*/
@@ -1659,6 +1719,47 @@ public:
*p_db_length= db_length;
return FALSE;
}
+
+public:
+ /**
+ Add an internal error handler to the thread execution context.
+ @param handler the exception handler to add
+ */
+ void push_internal_handler(Internal_error_handler *handler);
+
+ /**
+ Handle an error condition.
+ @param sql_errno the error number
+ @param level the error level
+ @return true if the error is handled
+ */
+ virtual bool handle_error(uint sql_errno,
+ MYSQL_ERROR::enum_warning_level level);
+
+ /**
+ Remove the error handler last pushed.
+ */
+ void pop_internal_handler();
+
+private:
+ /** The current internal error handler for this thread, or NULL. */
+ Internal_error_handler *m_internal_handler;
+ /**
+ The lex to hold the parsed tree of conventional (non-prepared) queries.
+ Whereas for prepared and stored procedure statements we use an own lex
+ instance for each new query, for conventional statements we reuse
+ the same lex. (@see mysql_parse for details).
+ */
+ LEX main_lex;
+ /**
+ This memory root is used for two purposes:
+ - for conventional queries, to allocate structures stored in main_lex
+ during parsing, and allocate runtime data (execution plan, etc.)
+ during execution.
+ - for prepared queries, only to allocate runtime data. The parsed
+ tree itself is reused between executions and thus is stored elsewhere.
+ */
+ MEM_ROOT main_mem_root;
};
@@ -1674,7 +1775,7 @@ public:
#define SYSTEM_THREAD_SLAVE_SQL 4
/*
- Used to hold information about file and file structure in exchainge
+ Used to hold information about file and file structure in exchange
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
XXX: We never call destructor for objects of this class.
*/
@@ -1687,6 +1788,7 @@ public:
bool opt_enclosed;
bool dumpfile;
ulong skip_lines;
+ CHARSET_INFO *cs;
sql_exchange(char *name,bool dumpfile_flag);
};
@@ -1844,13 +1946,13 @@ class select_create: public select_insert {
MYSQL_LOCK *lock;
Field **field;
public:
- select_create(TABLE_LIST *table,
+ select_create(TABLE_LIST *table_arg,
HA_CREATE_INFO *create_info_arg,
Alter_info *alter_info_arg,
List<Item> &select_fields,
enum_duplicates duplic, bool ignore)
:select_insert(NULL, NULL, &select_fields, 0, 0, duplic, ignore),
- create_table(table),
+ create_table(table_arg),
create_info(create_info_arg),
alter_info(alter_info_arg),
lock(0)
@@ -1957,7 +2059,9 @@ public:
class select_singlerow_subselect :public select_subselect
{
public:
- select_singlerow_subselect(Item_subselect *item):select_subselect(item){}
+ select_singlerow_subselect(Item_subselect *item_arg)
+ :select_subselect(item_arg)
+ {}
bool send_data(List<Item> &items);
};
@@ -1968,8 +2072,8 @@ class select_max_min_finder_subselect :public select_subselect
bool (select_max_min_finder_subselect::*op)();
bool fmax;
public:
- select_max_min_finder_subselect(Item_subselect *item, bool mx)
- :select_subselect(item), cache(0), fmax(mx)
+ select_max_min_finder_subselect(Item_subselect *item_arg, bool mx)
+ :select_subselect(item_arg), cache(0), fmax(mx)
{}
void cleanup();
bool send_data(List<Item> &items);
@@ -1983,7 +2087,8 @@ public:
class select_exists_subselect :public select_subselect
{
public:
- select_exists_subselect(Item_subselect *item):select_subselect(item){}
+ select_exists_subselect(Item_subselect *item_arg)
+ :select_subselect(item_arg){}
bool send_data(List<Item> &items);
};
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 749ee04493b..fe89f0f28f0 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -371,7 +371,7 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
}
{
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, table_list, table_list->next_global)))
+ if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0)))
{
update_non_unique_table_error(table_list, "DELETE", duplicate);
DBUG_RETURN(TRUE);
@@ -468,7 +468,7 @@ bool mysql_multi_delete_prepare(THD *thd)
{
TABLE_LIST *duplicate;
if ((duplicate= unique_table(thd, target_tbl->correspondent_table,
- lex->query_tables)))
+ lex->query_tables, 0)))
{
update_non_unique_table_error(target_tbl->correspondent_table,
"DELETE", duplicate);
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 1765f8b73fa..cd46f3bcc0e 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -109,8 +109,6 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
SELECT_LEX *first_select= unit->first_select();
TABLE *table= 0;
select_union *derived_result;
- bool is_union= first_select->next_select() &&
- first_select->next_select()->linkage == UNION_TYPE;
/* prevent name resolving out of derived table */
for (SELECT_LEX *sl= first_select; sl; sl= sl->next_select())
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index dfff70e858e..35e724beec8 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -58,8 +58,8 @@
#include "sp_head.h"
#include "sql_trigger.h"
#include "sql_select.h"
+#include "slave.h"
-static int check_null_fields(THD *thd,TABLE *entry);
#ifndef EMBEDDED_LIBRARY
static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list);
static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, bool ignore,
@@ -189,11 +189,11 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option)
{
- Field_iterator_table fields;
- fields.set_table(table);
+ Field_iterator_table field_it;
+ field_it.set_table(table);
if (check_grant_all_columns(thd, INSERT_ACL, &table->grant,
table->s->db, table->s->table_name,
- &fields))
+ &field_it))
return -1;
}
#endif
@@ -370,8 +370,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
By default, both logs are enabled (this won't cause problems if the server
runs without --log-update or --log-bin).
*/
- bool log_on= (thd->options & OPTION_BIN_LOG) ||
- (!(thd->security_ctx->master_access & SUPER_ACL));
bool transactional_table, joins_freed= FALSE;
bool changed;
uint value_count;
@@ -386,6 +384,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
#ifndef EMBEDDED_LIBRARY
char *query= thd->query;
#endif
+ bool log_on= (thd->options & OPTION_BIN_LOG) ||
+ (!(thd->security_ctx->master_access & SUPER_ACL));
thr_lock_type lock_type = table_list->lock_type;
Item *unused_conds= 0;
DBUG_ENTER("mysql_insert");
@@ -406,11 +406,33 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
(duplic == DUP_UPDATE))
lock_type=TL_WRITE;
#endif
+ if ((lock_type == TL_WRITE_DELAYED) &&
+ log_on && mysql_bin_log.is_open() &&
+ (values_list.elements > 1))
+ {
+ /*
+ Statement-based binary logging does not work in this case, because:
+ a) two concurrent statements may have their rows intermixed in the
+ queue, leading to autoincrement replication problems on slave (because
+ the values generated used for one statement don't depend only on the
+ value generated for the first row of this statement, so are not
+ replicable)
+ b) if first row of the statement has an error the full statement is
+ not binlogged, while next rows of the statement may be inserted.
+ c) if first row succeeds, statement is binlogged immediately with a
+ zero error code (i.e. "no error"), if then second row fails, query
+ will fail on slave too and slave will stop (wrongly believing that the
+ master got no error).
+ So we fallback to non-delayed INSERT.
+ */
+ lock_type= TL_WRITE;
+ }
table_list->lock_type= lock_type;
#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
+ res= 1;
if (thd->locked_tables)
{
DBUG_ASSERT(table_list->db); /* Must be set in the parser */
@@ -504,7 +526,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
/*
Fill in the given fields and dump it to the table file
*/
- info.records= info.deleted= info.copied= info.updated= 0;
+ info.records= info.deleted= info.copied= info.updated= info.touched= 0;
info.ignore= ignore;
info.handle_duplicates=duplic;
info.update_fields= &update_fields;
@@ -523,6 +545,14 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->cuted_fields = 0L;
table->next_number_field=table->found_next_number_field;
+#ifdef HAVE_REPLICATION
+ if (thd->slave_thread &&
+ (info.handle_duplicates == DUP_UPDATE) &&
+ (table->next_number_field != NULL) &&
+ rpl_master_has_bug(&active_mi->rli, 24432))
+ goto abort;
+#endif
+
error=0;
id=0;
thd->proc_info="update";
@@ -733,8 +763,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
(!table->triggers || !table->triggers->has_delete_triggers()))
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
- /* Reset value of LAST_INSERT_ID if no rows where inserted */
- if (!info.copied && thd->insert_id_used)
+ /* Reset value of LAST_INSERT_ID if no rows were inserted or touched */
+ if (!info.copied && !info.touched && thd->insert_id_used)
{
thd->insert_id(0);
id=0;
@@ -804,7 +834,6 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
Field_translator *trans_start= view->field_translation,
*trans_end= trans_start + num;
Field_translator *trans;
- Field **field_ptr= table->field;
uint used_fields_buff_size= (table->s->fields + 7) / 8;
uchar *used_fields_buff= (uchar*)thd->alloc(used_fields_buff_size);
MY_BITMAP used_fields;
@@ -1057,7 +1086,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
{
Item *fake_conds= 0;
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, table_list, table_list->next_global)))
+ if ((duplicate= unique_table(thd, table_list, table_list->next_global, 1)))
{
update_non_unique_table_error(table_list, "INSERT", duplicate);
DBUG_RETURN(TRUE);
@@ -1196,24 +1225,26 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (res == VIEW_CHECK_ERROR)
goto before_trg_err;
+ table->file->restore_auto_increment();
if ((error=table->file->update_row(table->record[1],table->record[0])))
{
if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
{
- table->file->restore_auto_increment();
goto ok_or_after_trg_err;
}
goto err;
}
+
+ if (table->next_number_field)
+ table->file->adjust_next_insert_id_after_explicit_value(
+ table->next_number_field->val_int());
+ info->touched++;
+
if ((table->file->table_flags() & HA_PARTIAL_COLUMN_READ) ||
- compare_record(table, query_id))
+ compare_record(table, thd->query_id))
{
info->updated++;
- if (table->next_number_field)
- table->file->adjust_next_insert_id_after_explicit_value(
- table->next_number_field->val_int());
-
trg_error= (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER,
@@ -2448,7 +2479,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
query
*/
if (!(lex->current_select->options & OPTION_BUFFER_RESULT) &&
- unique_table(thd, table_list, table_list->next_global))
+ unique_table(thd, table_list, table_list->next_global, 0))
{
/* Using same table for INSERT and SELECT */
lex->current_select->options|= OPTION_BUFFER_RESULT;
@@ -2469,6 +2500,15 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
+
+#ifdef HAVE_REPLICATION
+ if (thd->slave_thread &&
+ (info.handle_duplicates == DUP_UPDATE) &&
+ (table->next_number_field != NULL) &&
+ rpl_master_has_bug(&active_mi->rli, 24432))
+ DBUG_RETURN(1);
+#endif
+
thd->cuted_fields=0;
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c3e18394c41..3be844b6761 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -99,6 +99,16 @@ void lex_free(void)
}
+void
+st_parsing_options::reset()
+{
+ allows_variable= TRUE;
+ allows_select_into= TRUE;
+ allows_select_procedure= TRUE;
+ allows_derived= TRUE;
+}
+
+
/*
This is called before every query that is to be parsed.
Because of this, it's critical to not do too much things here.
@@ -149,6 +159,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->safe_to_cache_query= 1;
lex->time_zone_tables_used= 0;
lex->leaf_tables_insert= 0;
+ lex->parsing_options.reset();
lex->empty_field_list_on_rset= 0;
lex->select_lex.select_number= 1;
lex->next_state=MY_LEX_START;
@@ -286,13 +297,15 @@ static char *get_text(LEX *lex)
{
c = yyGet();
#ifdef USE_MB
- int l;
- if (use_mb(cs) &&
- (l = my_ismbchar(cs,
- (const char *)lex->ptr-1,
- (const char *)lex->end_of_query))) {
+ {
+ int l;
+ if (use_mb(cs) &&
+ (l = my_ismbchar(cs,
+ (const char *)lex->ptr-1,
+ (const char *)lex->end_of_query))) {
lex->ptr += l-1;
continue;
+ }
}
#endif
if (c == '\\' &&
@@ -759,8 +772,8 @@ int MYSQLlex(void *arg, void *yythd)
lex->tok_start=lex->ptr; // Skip first `
while ((c=yyGet()))
{
- int length;
- if ((length= my_mbcharlen(cs, c)) == 1)
+ int var_length;
+ if ((var_length= my_mbcharlen(cs, c)) == 1)
{
if (c == (uchar) NAMES_SEP_CHAR)
break; /* Old .frm format can't handle this char */
@@ -774,9 +787,9 @@ int MYSQLlex(void *arg, void *yythd)
}
}
#ifdef USE_MB
- else if (length < 1)
+ else if (var_length < 1)
break; // Error
- lex->ptr+= length-1;
+ lex->ptr+= var_length-1;
#endif
}
if (double_quotes)
@@ -1151,6 +1164,7 @@ void st_select_lex::init_query()
cond_count= between_count= with_wild= 0;
conds_processed_with_permanent_arena= 0;
ref_pointer_array= 0;
+ select_n_where_fields= 0;
select_n_having_items= 0;
subquery_in_having= explicit_limit= 0;
is_item_list_lookup= 0;
@@ -1192,6 +1206,7 @@ void st_select_lex::init_select()
is_correlated= 0;
cur_pos_in_select_list= UNDEF_POS;
non_agg_fields.empty();
+ cond_value= having_value= Item::COND_UNDEF;
inner_refs_list.empty();
}
@@ -1550,6 +1565,7 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
(Item **)arena->alloc(sizeof(Item*) * (n_child_sum_items +
item_list.elements +
select_n_having_items +
+ select_n_where_fields +
order_group_num)*5)) == 0;
}
@@ -1633,6 +1649,36 @@ void st_select_lex::print_limit(THD *thd, String *str)
}
}
+/**
+ @brief Restore the LEX and THD in case of a parse error.
+
+ This is a clean up call that is invoked by the Bison generated
+ parser before returning an error from MYSQLparse. If your
+ semantic actions manipulate with the global thread state (which
+ is a very bad practice and should not normally be employed) and
+ need a clean-up in case of error, and you can not use %destructor
+ rule in the grammar file itself, this function should be used
+ to implement the clean up.
+*/
+
+void st_lex::cleanup_lex_after_parse_error(THD *thd)
+{
+ /*
+ Delete sphead for the side effect of restoring of the original
+ LEX state, thd->lex, thd->mem_root and thd->free_list if they
+ were replaced when parsing stored procedure statements. We
+ will never use sphead object after a parse error, so it's okay
+ to delete it only for the sake of the side effect.
+ TODO: make this functionality explicit in sp_head class.
+ Sic: we must nullify the member of the main lex, not the
+ current one that will be thrown away
+ */
+ if (thd->lex->sphead)
+ {
+ delete thd->lex->sphead;
+ thd->lex->sphead= NULL;
+ }
+}
/*
Initialize (or reset) Query_tables_list object.
@@ -1737,13 +1783,14 @@ bool st_lex::can_be_merged()
bool selects_allow_merge= select_lex.next_select() == 0;
if (selects_allow_merge)
{
- for (SELECT_LEX_UNIT *unit= select_lex.first_inner_unit();
- unit;
- unit= unit->next_unit())
+ for (SELECT_LEX_UNIT *tmp_unit= select_lex.first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
{
- if (unit->first_select()->parent_lex == this &&
- (unit->item == 0 ||
- (unit->item->place() != IN_WHERE && unit->item->place() != IN_ON)))
+ if (tmp_unit->first_select()->parent_lex == this &&
+ (tmp_unit->item == 0 ||
+ (tmp_unit->item->place() != IN_WHERE &&
+ tmp_unit->item->place() != IN_ON)))
{
selects_allow_merge= 0;
break;
@@ -2040,12 +2087,12 @@ void st_lex::first_lists_tables_same()
FALSE - success
*/
-bool st_lex::add_time_zone_tables_to_query_tables(THD *thd)
+bool st_lex::add_time_zone_tables_to_query_tables(THD *thd_arg)
{
/* We should not add these tables twice */
if (!time_zone_tables_used)
{
- time_zone_tables_used= my_tz_get_table_list(thd, &query_tables_last);
+ time_zone_tables_used= my_tz_get_table_list(thd_arg, &query_tables_last);
if (time_zone_tables_used == &fake_time_zone_tables_list)
return TRUE;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index f8d8e6efcb2..de7de0d46e9 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -397,7 +397,8 @@ protected:
select_result *result;
ulonglong found_rows_for_union;
- bool res;
+ bool saved_error;
+
public:
bool prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit)
@@ -487,6 +488,8 @@ public:
Item *where, *having; /* WHERE & HAVING clauses */
Item *prep_where; /* saved WHERE clause for prepared statement processing */
Item *prep_having;/* saved HAVING clause for prepared statement processing */
+ /* Saved values of the WHERE and HAVING clauses*/
+ Item::cond_result cond_value, having_value;
/* point on lex in which it was created, used in view subquery detection */
st_lex *parent_lex;
enum olap_type olap;
@@ -530,6 +533,11 @@ public:
uint select_n_having_items;
uint cond_count; /* number of arguments of and/or/xor in where/having/on */
uint between_count; /* number of between predicates in where/having/on */
+ /*
+ Number of fields used in select list or where clause of current select
+ and all inner subselects.
+ */
+ uint select_n_where_fields;
enum_parsing_place parsing_place; /* where we are parsing expression */
bool with_sum_func; /* sum function indicator */
/*
@@ -885,10 +893,8 @@ struct st_parsing_options
bool allows_select_procedure;
bool allows_derived;
- st_parsing_options()
- : allows_variable(TRUE), allows_select_into(TRUE),
- allows_select_procedure(TRUE), allows_derived(TRUE)
- {}
+ st_parsing_options() { reset(); }
+ void reset();
};
@@ -1178,6 +1184,10 @@ typedef struct st_lex : public Query_tables_list
{
return context_stack.head();
}
+ /*
+ Restore the LEX and THD in case of a parse error.
+ */
+ static void cleanup_lex_after_parse_error(THD *thd);
void reset_n_backup_query_tables_list(Query_tables_list *backup);
void restore_backup_query_tables_list(Query_tables_list *backup);
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 0e4057d9ae4..3f67a0c3f5d 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -82,10 +82,11 @@ static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &set_values, READ_INFO &read_info,
String &enclosed, ulong skip_lines,
bool ignore_check_option_errors);
+#ifndef EMBEDDED_LIBRARY
static bool write_execute_load_query_log_event(THD *thd,
bool duplicates, bool ignore,
bool transactional_table);
-
+#endif /* EMBEDDED_LIBRARY */
/*
Execute LOAD DATA query
@@ -175,7 +176,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table is marked to be 'used for insert' in which case we should never
mark this table as as 'const table' (ie, one that has only one row).
*/
- if (unique_table(thd, table_list, table_list->next_global))
+ if (unique_table(thd, table_list, table_list->next_global, 0))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
DBUG_RETURN(TRUE);
@@ -302,6 +303,15 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
is_fifo = 1;
#endif
+
+ if (opt_secure_file_priv &&
+ strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
+ {
+ /* Read only allowed from within dir specified by secure_file_priv */
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
+ DBUG_RETURN(TRUE);
+ }
+
}
if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
DBUG_RETURN(TRUE);
@@ -313,7 +323,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
info.handle_duplicates=handle_duplicates;
info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
- READ_INFO read_info(file,tot_length,thd->variables.collation_database,
+ READ_INFO read_info(file,tot_length,
+ ex->cs ? ex->cs : thd->variables.collation_database,
*field_term,*ex->line_start, *ex->line_term, *enclosed,
info.escape_char, read_file_from_client, is_fifo);
if (read_info.error)
@@ -454,7 +465,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
- send_ok(thd,info.copied+info.deleted,0L,name);
if (!transactional_table)
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
@@ -475,6 +485,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
+ /* ok to client sent only after binlog write and engine commit */
+ send_ok(thd, info.copied + info.deleted, 0L, name);
err:
if (thd->lock)
{
@@ -486,6 +498,8 @@ err:
}
+#ifndef EMBEDDED_LIBRARY
+
/* Not a very useful function; just to avoid duplication of code */
static bool write_execute_load_query_log_event(THD *thd,
bool duplicates, bool ignore,
@@ -501,6 +515,7 @@ static bool write_execute_load_query_log_event(THD *thd,
return mysql_bin_log.write(&e);
}
+#endif
/****************************************************************************
** Read of rows of fixed size + optional garage + optonal newline
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index affa6e130dc..1b8bfd38fc4 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -32,6 +32,7 @@
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
+#include "sql_trigger.h"
#ifdef HAVE_OPENSSL
/*
@@ -65,13 +66,12 @@
extern "C" int gethostname(char *name, int namelen);
#endif
-static void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
+static void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
static bool check_db_used(THD *thd,TABLE_LIST *tables);
-static bool check_multi_update_lock(THD *thd);
static void remove_escape(char *name);
static bool append_file_to_dir(THD *thd, const char **filename_ptr,
const char *table_name);
@@ -671,6 +671,8 @@ bool is_update_query(enum enum_sql_command command)
safe to test and modify members of the USER_CONN structure.
*/
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+
static void time_out_user_resource_limits(THD *thd, USER_CONN *uc)
{
time_t check_time = thd->start_time ? thd->start_time : time(NULL);
@@ -688,7 +690,6 @@ static void time_out_user_resource_limits(THD *thd, USER_CONN *uc)
DBUG_VOID_RETURN;
}
-
/*
Check if maximum queries per hour limit has been reached
returns 0 if OK.
@@ -696,7 +697,6 @@ static void time_out_user_resource_limits(THD *thd, USER_CONN *uc)
static bool check_mqh(THD *thd, uint check_command)
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool error= 0;
USER_CONN *uc=thd->user_connect;
DBUG_ENTER("check_mqh");
@@ -730,11 +730,10 @@ static bool check_mqh(THD *thd, uint check_command)
end:
(void) pthread_mutex_unlock(&LOCK_user_conn);
DBUG_RETURN(error);
-#else
- return (0);
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
+
static void reset_mqh(LEX_USER *lu, bool get_them= 0)
{
@@ -1163,7 +1162,6 @@ pthread_handler_t handle_one_connection(void *arg)
thd->version= refresh_version;
thd->proc_info= 0;
thd->command= COM_SLEEP;
- thd->set_time();
thd->init_for_queries();
if (sys_init_connect.value_length && !(sctx->master_access & SUPER_ACL))
@@ -1179,7 +1177,6 @@ pthread_handler_t handle_one_connection(void *arg)
sql_print_warning("%s", net->last_error);
}
thd->proc_info=0;
- thd->set_time();
thd->init_for_queries();
}
@@ -1308,23 +1305,35 @@ pthread_handler_t handle_bootstrap(void *arg)
thd->query= thd->memdup_w_gap(buff, length+1,
thd->db_length+1+QUERY_CACHE_FLAGS_SIZE);
thd->query[length] = '\0';
+ DBUG_PRINT("query",("%-.4096s",thd->query));
/*
We don't need to obtain LOCK_thread_count here because in bootstrap
mode we have only one thread.
*/
thd->query_id=next_query_id();
+ thd->set_time();
mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables
+
if (thd->is_fatal_error)
break;
+
+ if (thd->net.report_error)
+ {
+ /* The query failed, send error to log and abort bootstrap */
+ net_send_error(thd);
+ thd->fatal_error();
+ break;
+ }
+
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
#ifdef USING_TRANSACTIONS
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
#endif
}
- /* thd->fatal_error should be set in case something went wrong */
end:
+ /* Remember the exit code of bootstrap */
bootstrap_error= thd->is_fatal_error;
net_end(&thd->net);
@@ -1595,7 +1604,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_ENTER("dispatch_command");
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
+ {
thd->killed= THD::NOT_KILLED;
+ thd->mysys_var->abort= 0;
+ }
thd->command=command;
/*
@@ -1606,7 +1618,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
thd->set_time();
VOID(pthread_mutex_lock(&LOCK_thread_count));
- thd->query_id=query_id;
+ thd->query_id= global_query_id;
if (command != COM_STATISTICS && command != COM_PING)
next_query_id();
thread_running++;
@@ -1787,7 +1799,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while (!thd->killed && thd->lex->found_semicolon && !thd->net.report_error)
{
- char *packet= thd->lex->found_semicolon;
+ char *next_packet= thd->lex->found_semicolon;
net->no_send_error= 0;
/*
Multiple queries exits, execute them individually
@@ -1795,24 +1807,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (thd->lock || thd->open_tables || thd->derived_tables ||
thd->prelocked_mode)
close_thread_tables(thd);
- ulong length= (ulong)(packet_end-packet);
+ ulong length= (ulong)(packet_end - next_packet);
log_slow_statement(thd);
/* Remove garbage at start of query */
- while (my_isspace(thd->charset(), *packet) && length > 0)
+ while (my_isspace(thd->charset(), *next_packet) && length > 0)
{
- packet++;
+ next_packet++;
length--;
}
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_length= length;
- thd->query= packet;
+ thd->query= next_packet;
thd->query_id= next_query_id();
thd->set_time(); /* Reset the query start time. */
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
VOID(pthread_mutex_unlock(&LOCK_thread_count));
- mysql_parse(thd, packet, length);
+ mysql_parse(thd, next_packet, length);
}
if (!(specialflag & SPECIAL_NO_PRIOR))
@@ -1829,16 +1841,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
char *fields, *pend;
/* Locked closure of all tables */
- TABLE_LIST *locked_tables= NULL;
TABLE_LIST table_list;
LEX_STRING conv_name;
- /* Saved variable value */
- my_bool old_innodb_table_locks=
- IF_INNOBASE_DB(thd->variables.innodb_table_locks, FALSE);
+
/* used as fields initializator */
lex_start(thd, 0, 0);
-
statistic_increment(thd->status_var.com_stat[SQLCOM_SHOW_FIELDS],
&LOCK_status);
bzero((char*) &table_list,sizeof(table_list));
@@ -2034,7 +2042,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
STATUS_VAR current_global_status_var;
calc_sum_of_all_status(&current_global_status_var);
- ulong uptime = (ulong) (thd->start_time - start_time);
+ ulong uptime = (ulong) (thd->start_time - server_start_time);
sprintf((char*) buff,
"Uptime: %lu Threads: %d Questions: %lu Slow queries: %lu Opens: %lu Flush tables: %lu Open tables: %u Queries per second avg: %.3f",
uptime,
@@ -2081,13 +2089,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
statistic_increment(thd->status_var.com_stat[SQLCOM_SET_OPTION],
&LOCK_status);
- enum_mysql_set_option command= (enum_mysql_set_option) uint2korr(packet);
- switch (command) {
- case MYSQL_OPTION_MULTI_STATEMENTS_ON:
+ uint opt_command= uint2korr(packet);
+
+ switch (opt_command) {
+ case (int) MYSQL_OPTION_MULTI_STATEMENTS_ON:
thd->client_capabilities|= CLIENT_MULTI_STATEMENTS;
send_eof(thd);
break;
- case MYSQL_OPTION_MULTI_STATEMENTS_OFF:
+ case (int) MYSQL_OPTION_MULTI_STATEMENTS_OFF:
thd->client_capabilities&= ~CLIENT_MULTI_STATEMENTS;
send_eof(thd);
break;
@@ -2430,7 +2439,7 @@ mysql_execute_command(THD *thd)
{
bool res= FALSE;
bool need_start_waiting= FALSE; // have protection against global read lock
- int result= 0;
+ int up_result= 0;
LEX *lex= thd->lex;
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
SELECT_LEX *select_lex= &lex->select_lex;
@@ -2496,6 +2505,30 @@ mysql_execute_command(THD *thd)
#ifdef HAVE_REPLICATION
if (unlikely(thd->slave_thread))
{
+ if (lex->sql_command == SQLCOM_DROP_TRIGGER)
+ {
+ /*
+ When dropping a trigger, we need to load its table name
+ before checking slave filter rules.
+ */
+ add_table_for_trigger(thd, thd->lex->spname, 1, &all_tables);
+
+ if (!all_tables)
+ {
+ /*
+ If table name cannot be loaded,
+ it means the trigger does not exists possibly because
+ CREATE TRIGGER was previously skipped for this trigger
+ according to slave filtering rules.
+ Returning success without producing any errors in this case.
+ */
+ DBUG_RETURN(0);
+ }
+
+ // force searching in slave.cc:tables_ok()
+ all_tables->updating= 1;
+ }
+
/*
Check if statment should be skipped because of slave filtering
rules
@@ -2574,7 +2607,7 @@ mysql_execute_command(THD *thd)
new Item_int((ulonglong)thd->variables.select_limit);
}
- select_result *result=lex->result;
+ select_result *sel_result=lex->result;
if (all_tables)
{
if (lex->orig_sql_command != SQLCOM_SHOW_STATUS_PROC &&
@@ -2601,11 +2634,11 @@ mysql_execute_command(THD *thd)
to prepend EXPLAIN to any query and receive output for it,
even if the query itself redirects the output.
*/
- if (!(result= new select_send()))
+ if (!(sel_result= new select_send()))
goto error;
else
- thd->send_explain_fields(result);
- res= mysql_explain_union(thd, &thd->lex->unit, result);
+ thd->send_explain_fields(sel_result);
+ res= mysql_explain_union(thd, &thd->lex->unit, sel_result);
if (lex->describe & DESCRIBE_EXTENDED)
{
char buff[1024];
@@ -2616,17 +2649,17 @@ mysql_execute_command(THD *thd)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_YES, str.ptr());
}
- result->send_eof();
- delete result;
+ sel_result->send_eof();
+ delete sel_result;
}
else
{
- if (!result && !(result= new select_send()))
+ if (!sel_result && !(sel_result= new select_send()))
goto error;
query_cache_store_query(thd, all_tables);
- res= handle_select(thd, lex, result, 0);
- if (result != lex->result)
- delete result;
+ res= handle_select(thd, lex, sel_result, 0);
+ if (sel_result != lex->result)
+ delete sel_result;
}
}
break;
@@ -2979,7 +3012,7 @@ mysql_execute_command(THD *thd)
}
if (select_lex->item_list.elements) // With select
{
- select_result *result;
+ select_result *sel_result;
select_lex->options|= SELECT_NO_UNLOCK;
unit->set_limit(select_lex);
@@ -2993,7 +3026,7 @@ mysql_execute_command(THD *thd)
if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
{
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, create_table, select_tables)))
+ if ((duplicate= unique_table(thd, create_table, select_tables, 0)))
{
update_non_unique_table_error(create_table, "CREATE", duplicate);
res= 1;
@@ -3009,7 +3042,7 @@ mysql_execute_command(THD *thd)
tab= tab->next_local)
{
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, tab, select_tables)))
+ if ((duplicate= unique_table(thd, tab, select_tables, 0)))
{
update_non_unique_table_error(tab, "CREATE", duplicate);
res= 1;
@@ -3021,19 +3054,19 @@ mysql_execute_command(THD *thd)
select_create is currently not re-execution friendly and
needs to be created for every execution of a PS/SP.
*/
- if ((result= new select_create(create_table,
- &create_info,
- &alter_info,
- select_lex->item_list,
- lex->duplicates,
- lex->ignore)))
+ if ((sel_result= new select_create(create_table,
+ &create_info,
+ &alter_info,
+ select_lex->item_list,
+ lex->duplicates,
+ lex->ignore)))
{
/*
CREATE from SELECT give its SELECT_LEX for SELECT,
and item_list belong to SELECT
*/
- res= handle_select(thd, lex, result, 0);
- delete result;
+ res= handle_select(thd, lex, sel_result, 0);
+ delete sel_result;
}
}
}
@@ -3388,22 +3421,23 @@ end_with_restore_list:
break;
DBUG_ASSERT(select_lex->offset_limit == 0);
unit->set_limit(select_lex);
- res= (result= mysql_update(thd, all_tables,
- select_lex->item_list,
- lex->value_list,
- select_lex->where,
- select_lex->order_list.elements,
- (ORDER *) select_lex->order_list.first,
- unit->select_limit_cnt,
- lex->duplicates, lex->ignore));
+ res= (up_result= mysql_update(thd, all_tables,
+ select_lex->item_list,
+ lex->value_list,
+ select_lex->where,
+ select_lex->order_list.elements,
+ (ORDER *) select_lex->order_list.first,
+ unit->select_limit_cnt,
+ lex->duplicates, lex->ignore));
/* mysql_update return 2 if we need to switch to multi-update */
- if (result != 2)
+ if (up_result != 2)
break;
+ /* Fall through */
case SQLCOM_UPDATE_MULTI:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
/* if we switched from normal update, rights are checked */
- if (result != 2)
+ if (up_result != 2)
{
if ((res= multi_update_precheck(thd, all_tables)))
break;
@@ -3487,7 +3521,7 @@ end_with_restore_list:
case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT_SELECT:
{
- select_result *result;
+ select_result *sel_result;
DBUG_ASSERT(first_table == all_tables && first_table != 0);
if ((res= insert_precheck(thd, all_tables)))
break;
@@ -3516,13 +3550,15 @@ end_with_restore_list:
select_lex->context.table_list=
select_lex->context.first_name_resolution_table= second_table;
res= mysql_insert_select_prepare(thd);
- if (!res && (result= new select_insert(first_table, first_table->table,
- &lex->field_list,
- &lex->update_list,
- &lex->value_list,
- lex->duplicates, lex->ignore)))
+ if (!res && (sel_result= new select_insert(first_table,
+ first_table->table,
+ &lex->field_list,
+ &lex->update_list,
+ &lex->value_list,
+ lex->duplicates,
+ lex->ignore)))
{
- res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE);
+ res= handle_select(thd, lex, sel_result, OPTION_SETUP_TABLES_DONE);
/*
Invalidate the table in the query cache if something changed
after unlocking when changes become visible.
@@ -3540,7 +3576,7 @@ end_with_restore_list:
first_table->next_local= save_table;
thd->lock=0;
}
- delete result;
+ delete sel_result;
}
/* revert changes for SP */
select_lex->table_list.first= (byte*) first_table;
@@ -3605,7 +3641,7 @@ end_with_restore_list:
DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *aux_tables=
(TABLE_LIST *)thd->lex->auxiliary_table_list.first;
- multi_delete *result;
+ multi_delete *del_result;
if (!thd->locked_tables &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
@@ -3630,8 +3666,8 @@ end_with_restore_list:
if ((res= mysql_multi_delete_prepare(thd)))
goto error;
- if (!thd->is_fatal_error && (result= new multi_delete(aux_tables,
- lex->table_count)))
+ if (!thd->is_fatal_error &&
+ (del_result= new multi_delete(aux_tables, lex->table_count)))
{
res= mysql_select(thd, &select_lex->ref_pointer_array,
select_lex->get_table_list(),
@@ -3643,8 +3679,8 @@ end_with_restore_list:
select_lex->options | thd->options |
SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
- result, unit, select_lex);
- delete result;
+ del_result, unit, select_lex);
+ delete del_result;
}
else
res= TRUE; // Error
@@ -4322,7 +4358,7 @@ end_with_restore_list:
{
uint namelen;
char *name;
- int result= SP_INTERNAL_ERROR;
+ int sp_result= SP_INTERNAL_ERROR;
DBUG_ASSERT(lex->sphead != 0);
DBUG_ASSERT(lex->sphead->m_db.str); /* Must be initialized in the parser */
@@ -4395,18 +4431,18 @@ end_with_restore_list:
if (!lex->definer)
{
- bool res= FALSE;
+ bool local_res= FALSE;
Query_arena original_arena;
Query_arena *ps_arena = thd->activate_stmt_arena_if_needed(&original_arena);
if (!(lex->definer= create_default_definer(thd)))
- res= TRUE;
+ local_res= TRUE;
if (ps_arena)
thd->restore_active_arena(ps_arena, &original_arena);
/* Error has been already reported. */
- if (res)
+ if (local_res)
goto create_sp_error;
if (thd->slave_thread)
@@ -4446,8 +4482,8 @@ end_with_restore_list:
}
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
- res= (result= lex->sphead->create(thd));
- switch (result) {
+ res= (sp_result= lex->sphead->create(thd));
+ switch (sp_result) {
case SP_OK:
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* only add privileges if really neccessary */
@@ -4484,10 +4520,7 @@ end_with_restore_list:
clean up the environment.
*/
create_sp_error:
- lex->unit.cleanup();
- delete lex->sphead;
- lex->sphead= 0;
- if (result != SP_OK )
+ if (sp_result != SP_OK )
goto error;
send_ok(thd);
break; /* break super switch */
@@ -4599,7 +4632,7 @@ create_sp_error:
case SQLCOM_ALTER_PROCEDURE:
case SQLCOM_ALTER_FUNCTION:
{
- int result;
+ int sp_result;
sp_head *sp;
st_sp_chistics chistics;
@@ -4614,7 +4647,7 @@ create_sp_error:
if (! sp)
{
if (lex->spname->m_db.str)
- result= SP_KEY_NOT_FOUND;
+ sp_result= SP_KEY_NOT_FOUND;
else
{
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
@@ -4639,7 +4672,7 @@ create_sp_error:
{
my_message(ER_BINLOG_UNSAFE_ROUTINE,
ER(ER_BINLOG_UNSAFE_ROUTINE), MYF(0));
- result= SP_INTERNAL_ERROR;
+ sp_result= SP_INTERNAL_ERROR;
}
else
{
@@ -4649,15 +4682,15 @@ create_sp_error:
follow the restrictions that log-bin-trust-function-creators=0
already puts on CREATE FUNCTION.
*/
+ /* Conditionally writes to binlog */
if (lex->sql_command == SQLCOM_ALTER_PROCEDURE)
- /* Conditionally writes to binlog */
- result= sp_update_procedure(thd, lex->spname, &lex->sp_chistics);
+ sp_result= sp_update_procedure(thd, lex->spname,
+ &lex->sp_chistics);
else
- /* Conditionally writes to binlog */
- result= sp_update_function(thd, lex->spname, &lex->sp_chistics);
+ sp_result= sp_update_function(thd, lex->spname, &lex->sp_chistics);
}
}
- switch (result)
+ switch (sp_result)
{
case SP_OK:
send_ok(thd);
@@ -4676,13 +4709,13 @@ create_sp_error:
case SQLCOM_DROP_PROCEDURE:
case SQLCOM_DROP_FUNCTION:
{
- int result;
+ int sp_result;
int type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ?
TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION);
- result= sp_routine_exists_in_table(thd, type, lex->spname);
+ sp_result= sp_routine_exists_in_table(thd, type, lex->spname);
mysql_reset_errors(thd, 0);
- if (result == SP_OK)
+ if (sp_result == SP_OK)
{
char *db= lex->spname->m_db.str;
char *name= lex->spname->m_name.str;
@@ -4703,12 +4736,11 @@ create_sp_error:
ER(ER_PROC_AUTO_REVOKE_FAIL));
}
#endif
- if (lex->sql_command == SQLCOM_DROP_PROCEDURE)
/* Conditionally writes to binlog */
- result= sp_drop_procedure(thd, lex->spname); /* Conditionally writes to binlog */
+ if (lex->sql_command == SQLCOM_DROP_PROCEDURE)
+ sp_result= sp_drop_procedure(thd, lex->spname);
else
- /* Conditionally writes to binlog */
- result= sp_drop_function(thd, lex->spname); /* Conditionally writes to binlog */
+ sp_result= sp_drop_function(thd, lex->spname);
}
else
{
@@ -4732,16 +4764,15 @@ create_sp_error:
}
#endif
if (lex->spname->m_db.str)
- result= SP_KEY_NOT_FOUND;
+ sp_result= SP_KEY_NOT_FOUND;
else
{
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
goto error;
}
}
- res= result;
- switch (result)
- {
+ res= sp_result;
+ switch (sp_result) {
case SP_OK:
send_ok(thd);
break;
@@ -4859,9 +4890,6 @@ create_sp_error:
/* Conditionally writes to binlog. */
res= mysql_create_or_drop_trigger(thd, all_tables, 1);
- /* We don't care about trigger body after this point */
- delete lex->sphead;
- lex->sphead= 0;
break;
}
case SQLCOM_DROP_TRIGGER:
@@ -5377,7 +5405,9 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
{
uint found=0;
ulong found_access=0;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
TABLE_LIST *org_tables= tables;
+#endif
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
/*
@@ -5882,15 +5912,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
else
#endif
{
- if (thd->net.report_error)
- {
- if (thd->lex->sphead)
- {
- delete thd->lex->sphead;
- thd->lex->sphead= NULL;
- }
- }
- else
+ if (! thd->net.report_error)
{
/*
Binlog logs a string starting from thd->query and having length
@@ -5910,7 +5932,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
query_cache_end_of_result(thd);
}
}
- lex->unit.cleanup();
}
else
{
@@ -5918,19 +5939,14 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->is_fatal_error));
- /*
- The first thing we do after parse error is freeing sp_head to
- ensure that we have restored original memroot.
- */
- if (thd->lex->sphead)
- {
- /* Clean up after failed stored procedure/function */
- delete thd->lex->sphead;
- thd->lex->sphead= NULL;
- }
query_cache_abort(&thd->net);
- lex->unit.cleanup();
}
+ if (thd->lex->sphead)
+ {
+ delete thd->lex->sphead;
+ thd->lex->sphead= 0;
+ }
+ lex->unit.cleanup();
thd->proc_info="freeing items";
thd->end_statement();
thd->cleanup_after_query();
@@ -6581,18 +6597,18 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type)
0 on success
*/
-bool st_select_lex_unit::add_fake_select_lex(THD *thd)
+bool st_select_lex_unit::add_fake_select_lex(THD *thd_arg)
{
SELECT_LEX *first_sl= first_select();
DBUG_ENTER("add_fake_select_lex");
DBUG_ASSERT(!fake_select_lex);
- if (!(fake_select_lex= new (thd->mem_root) SELECT_LEX()))
+ if (!(fake_select_lex= new (thd_arg->mem_root) SELECT_LEX()))
DBUG_RETURN(1);
fake_select_lex->include_standalone(this,
(SELECT_LEX_NODE**)&fake_select_lex);
fake_select_lex->select_number= INT_MAX;
- fake_select_lex->parent_lex= thd->lex; /* Used in init_query. */
+ fake_select_lex->parent_lex= thd_arg->lex; /* Used in init_query. */
fake_select_lex->make_empty_select();
fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE;
fake_select_lex->select_limit= 0;
@@ -6612,9 +6628,9 @@ bool st_select_lex_unit::add_fake_select_lex(THD *thd)
*/
global_parameters= fake_select_lex;
fake_select_lex->no_table_names_allowed= 1;
- thd->lex->current_select= fake_select_lex;
+ thd_arg->lex->current_select= fake_select_lex;
}
- thd->lex->pop_context();
+ thd_arg->lex->pop_context();
DBUG_RETURN(0);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 8e807ca0ada..85092f14624 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -99,9 +99,12 @@ public:
#endif
};
-/******************************************************************************
- Prepared_statement: a statement that can contain placeholders
-******************************************************************************/
+/****************************************************************************/
+
+/**
+ @class Prepared_statement
+ @brief Prepared_statement: a statement that can contain placeholders
+*/
class Prepared_statement: public Statement
{
@@ -141,6 +144,16 @@ public:
bool execute(String *expanded_query, bool open_cursor);
/* Destroy this statement */
bool deallocate();
+private:
+ /**
+ Store the parsed tree of a prepared statement here.
+ */
+ LEX main_lex;
+ /**
+ The memory root to allocate parsed tree elements (instances of Item,
+ SELECT_LEX and other classes).
+ */
+ MEM_ROOT main_mem_root;
};
@@ -975,19 +988,19 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
/* Insert @'escaped-varname' instead of parameter in the query */
if (entry)
{
- char *begin, *ptr;
+ char *start, *ptr;
buf.length(0);
if (buf.reserve(entry->name.length*2+3))
DBUG_RETURN(1);
- begin= ptr= buf.c_ptr_quick();
+ start= ptr= buf.c_ptr_quick();
*ptr++= '@';
*ptr++= '\'';
ptr+= escape_string_for_mysql(&my_charset_utf8_general_ci,
ptr, 0, entry->name.str,
entry->name.length);
*ptr++= '\'';
- buf.length(ptr - begin);
+ buf.length(ptr - start);
val= &buf;
}
else
@@ -1025,7 +1038,6 @@ static bool mysql_test_insert(Prepared_statement *stmt,
enum_duplicates duplic)
{
THD *thd= stmt->thd;
- LEX *lex= stmt->lex;
List_iterator_fast<List_item> its(values_list);
List_item *values;
DBUG_ENTER("mysql_test_insert");
@@ -2011,6 +2023,7 @@ void mysql_sql_stmt_prepare(THD *thd)
uint query_len;
DBUG_ENTER("mysql_sql_stmt_prepare");
DBUG_ASSERT(thd->protocol == &thd->protocol_simple);
+ LINT_INIT(query_len);
if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
@@ -2034,6 +2047,7 @@ void mysql_sql_stmt_prepare(THD *thd)
delete stmt;
DBUG_VOID_RETURN;
}
+
if (thd->stmt_map.insert(thd, stmt))
{
/* The statement is deleted and an error is set if insert fails */
@@ -2199,7 +2213,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
{
uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
ulong stmt_id= uint4korr(packet);
- ulong flags= (ulong) ((uchar) packet[4]);
+ ulong flags= (ulong) packet[4];
/* Query text for binary, general or slow log, if any of them is open */
String expanded_query;
#ifndef EMBEDDED_LIBRARY
@@ -2523,7 +2537,9 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
uint param_number;
Prepared_statement *stmt;
Item_param *param;
+#ifndef EMBEDDED_LIBRARY
char *packet_end= packet + packet_length - 1;
+#endif
DBUG_ENTER("mysql_stmt_get_longdata");
statistic_increment(thd->status_var.com_stmt_send_long_data, &LOCK_status);
@@ -2577,8 +2593,8 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
Select_fetch_protocol_prep
****************************************************************************/
-Select_fetch_protocol_prep::Select_fetch_protocol_prep(THD *thd)
- :protocol(thd)
+Select_fetch_protocol_prep::Select_fetch_protocol_prep(THD *thd_arg)
+ :protocol(thd_arg)
{}
bool Select_fetch_protocol_prep::send_fields(List<Item> &list, uint flags)
@@ -2627,17 +2643,18 @@ Select_fetch_protocol_prep::send_data(List<Item> &fields)
****************************************************************************/
Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg)
- :Statement(INITIALIZED, ++thd_arg->statement_id_counter,
- thd_arg->variables.query_alloc_block_size,
- thd_arg->variables.query_prealloc_size),
+ :Statement(&main_lex, &main_mem_root,
+ INITIALIZED, ++thd_arg->statement_id_counter),
thd(thd_arg),
result(thd_arg),
protocol(protocol_arg),
param_array(0),
param_count(0),
last_errno(0),
- flags((uint) IS_IN_USE)
+ flags((uint) IS_IN_USE)
{
+ init_alloc_root(&main_mem_root, thd_arg->variables.query_alloc_block_size,
+ thd_arg->variables.query_prealloc_size);
*last_error= '\0';
}
@@ -2686,6 +2703,7 @@ Prepared_statement::~Prepared_statement()
*/
free_items();
delete lex->result;
+ free_root(&main_mem_root, MYF(0));
DBUG_VOID_RETURN;
}
@@ -2701,6 +2719,7 @@ void Prepared_statement::cleanup_stmt()
DBUG_ENTER("Prepared_statement::cleanup_stmt");
DBUG_PRINT("enter",("stmt: %p", this));
+ DBUG_ASSERT(lex->sphead == 0);
/* The order is important */
lex->unit.cleanup();
cleanup_items(free_list);
@@ -2788,15 +2807,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
thd->net.report_error || init_param_array(this);
/*
- The first thing we do after parse error is freeing sp_head to
- ensure that we have restored original memroot.
- */
- if (error && lex->sphead)
- {
- delete lex->sphead;
- lex->sphead= NULL;
- }
- /*
While doing context analysis of the query (in check_prepared_statement)
we allocate a lot of additional memory: for open tables, JOINs, derived
tables, etc. Let's save a snapshot of current parse tree to the
@@ -2821,12 +2831,18 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
if (error == 0)
error= check_prepared_statement(this, name.str != 0);
- /* Free sp_head if check_prepared_statement() failed. */
- if (error && lex->sphead)
+ /*
+ Currently CREATE PROCEDURE/TRIGGER/EVENT are prohibited in prepared
+ statements: ensure we have no memory leak here if by someone tries
+ to PREPARE stmt FROM "CREATE PROCEDURE ..."
+ */
+ DBUG_ASSERT(lex->sphead == NULL || error != 0);
+ if (lex->sphead)
{
delete lex->sphead;
lex->sphead= NULL;
}
+
lex_end(lex);
cleanup_stmt();
thd->restore_backup_statement(this, &stmt_backup);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 01b1149a2b3..b451c612398 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -22,7 +22,9 @@
int max_binlog_dump_events = 0; // unlimited
my_bool opt_sporadic_binlog_dump_fail = 0;
+#ifndef DBUG_OFF
static int binlog_dump_count = 0;
+#endif
/*
fake_rotate_event() builds a fake (=which does not exist physically in any
@@ -882,12 +884,14 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
{
+ DBUG_ENTER("stop_slave");
+
int slave_errno;
if (!thd)
thd = current_thd;
if (check_access(thd, SUPER_ACL, any_db,0,0,0,0))
- return 1;
+ DBUG_RETURN(1);
thd->proc_info = "Killing slave";
int thread_mask;
lock_slave_threads(mi);
@@ -921,12 +925,12 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
{
if (net_report)
my_message(slave_errno, ER(slave_errno), MYF(0));
- return 1;
+ DBUG_RETURN(1);
}
else if (net_report)
send_ok(thd);
- return 0;
+ DBUG_RETURN(0);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 414ed9f6e9d..9fe92d63da3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -109,7 +109,6 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
static COND *optimize_cond(JOIN *join, COND *conds,
List<TABLE_LIST> *join_list,
Item::cond_result *cond_value);
-static bool resolve_nested_join (TABLE_LIST *table);
static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
static bool open_tmp_table(TABLE *table);
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
@@ -397,6 +396,7 @@ JOIN::prepare(Item ***rref_pointer_array,
join_list= &select_lex->top_join_list;
union_part= (unit_arg->first_select()->next_select() != 0);
+ thd->lex->current_select->is_item_list_lookup= 1;
/*
If we have already executed SELECT, then it have not sense to prevent
its table from update (see unique_table())
@@ -456,6 +456,17 @@ JOIN::prepare(Item ***rref_pointer_array,
select_lex->fix_prepare_information(thd, &conds, &having);
+ if (order)
+ {
+ ORDER *ord;
+ for (ord= order; ord; ord= ord->next)
+ {
+ Item *item= *ord->item;
+ if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
+ item->split_sum_func(thd, ref_pointer_array, all_fields);
+ }
+ }
+
if (having && having->with_sum_func)
having->split_sum_func2(thd, ref_pointer_array, all_fields,
&having, TRUE);
@@ -749,7 +760,6 @@ JOIN::optimize()
}
{
- Item::cond_result having_value;
having= optimize_cond(this, having, join_list, &having_value);
if (thd->net.report_error)
{
@@ -757,6 +767,10 @@ JOIN::optimize()
DBUG_PRINT("error",("Error from optimize_cond"));
DBUG_RETURN(1);
}
+ if (select_lex->where)
+ select_lex->cond_value= cond_value;
+ if (select_lex->having)
+ select_lex->having_value= having_value;
if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
@@ -897,6 +911,7 @@ JOIN::optimize()
conds->update_used_tables();
DBUG_EXECUTE("where", print_where(conds, "after substitute_best_equal"););
}
+
/*
Permorm the the optimization on fields evaluation mentioned above
for all on expressions.
@@ -2531,14 +2546,14 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
for( ; sargables->field ; sargables++)
{
Field *field= sargables->field;
- JOIN_TAB *stat= field->table->reginfo.join_tab;
+ JOIN_TAB *join_tab= field->table->reginfo.join_tab;
key_map possible_keys= field->key_start;
possible_keys.intersect(field->table->keys_in_use_for_query);
bool is_const= 1;
- for (uint i=0; i< sargables->num_values; i++)
- is_const&= sargables->arg_value[i]->const_item();
+ for (uint j=0; j < sargables->num_values; j++)
+ is_const&= sargables->arg_value[j]->const_item();
if (is_const)
- stat[0].const_keys.merge(possible_keys);
+ join_tab[0].const_keys.merge(possible_keys);
}
}
@@ -3525,16 +3540,16 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
*/
if (keyuse->elements)
{
- KEYUSE end,*prev,*save_pos,*use;
+ KEYUSE key_end,*prev,*save_pos,*use;
qsort(keyuse->buffer,keyuse->elements,sizeof(KEYUSE),
(qsort_cmp) sort_keyuse);
- bzero((char*) &end,sizeof(end)); /* Add for easy testing */
- VOID(insert_dynamic(keyuse,(gptr) &end));
+ bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */
+ VOID(insert_dynamic(keyuse,(gptr) &key_end));
use=save_pos=dynamic_element(keyuse,0,KEYUSE*);
- prev=&end;
+ prev= &key_end;
found_eq_constant=0;
for (i=0 ; i < keyuse->elements-1 ; i++,use++)
{
@@ -3562,7 +3577,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
save_pos++;
}
i=(uint) (save_pos-(KEYUSE*) keyuse->buffer);
- VOID(set_dynamic(keyuse,(gptr) &end,i));
+ VOID(set_dynamic(keyuse,(gptr) &key_end,i));
keyuse->elements=i;
}
return FALSE;
@@ -3744,7 +3759,6 @@ best_access_path(JOIN *join,
double records= DBL_MAX;
double tmp;
ha_rows rec;
-
DBUG_ENTER("best_access_path");
if (s->keyuse)
@@ -3784,12 +3798,12 @@ best_access_path(JOIN *join,
found_part|= keyuse->keypart_map;
if (!(keyuse->used_tables & ~join->const_table_map))
const_part|= keyuse->keypart_map;
- double tmp= prev_record_reads(join, (found_ref |
+ double tmp2= prev_record_reads(join, (found_ref |
keyuse->used_tables));
- if (tmp < best_prev_record_reads)
+ if (tmp2 < best_prev_record_reads)
{
best_part_found_ref= keyuse->used_tables & ~join->const_table_map;
- best_prev_record_reads= tmp;
+ best_prev_record_reads= tmp2;
}
if (rec > keyuse->ref_table_rows)
rec= keyuse->ref_table_rows;
@@ -5842,37 +5856,42 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*/
COND *on_expr= *first_inner_tab->on_expr_ref;
- table_map used_tables= join->const_table_map |
- OUTER_REF_TABLE_BIT | RAND_TABLE_BIT;
+ table_map used_tables2= (join->const_table_map |
+ OUTER_REF_TABLE_BIT | RAND_TABLE_BIT);
for (tab= join->join_tab+join->const_tables; tab <= last_tab ; tab++)
{
current_map= tab->table->map;
- used_tables|= current_map;
- COND *tmp= make_cond_for_table(on_expr, used_tables, current_map);
- if (tmp)
+ used_tables2|= current_map;
+ COND *tmp_cond= make_cond_for_table(on_expr, used_tables2,
+ current_map);
+ if (tmp_cond)
{
JOIN_TAB *cond_tab= tab < first_inner_tab ? first_inner_tab : tab;
/*
First add the guards for match variables of
all embedding outer join operations.
*/
- if (!(tmp= add_found_match_trig_cond(cond_tab->first_inner,
- tmp, first_inner_tab)))
+ if (!(tmp_cond= add_found_match_trig_cond(cond_tab->first_inner,
+ tmp_cond,
+ first_inner_tab)))
DBUG_RETURN(1);
/*
Now add the guard turning the predicate off for
the null complemented row.
*/
DBUG_PRINT("info", ("Item_func_trig_cond"));
- tmp= new Item_func_trig_cond(tmp,
- &first_inner_tab->not_null_compl);
- DBUG_PRINT("info", ("Item_func_trig_cond 0x%lx", (ulong) tmp));
- if (tmp)
- tmp->quick_fix_field();
+ tmp_cond= new Item_func_trig_cond(tmp_cond,
+ &first_inner_tab->
+ not_null_compl);
+ DBUG_PRINT("info", ("Item_func_trig_cond 0x%lx",
+ (ulong) tmp_cond));
+ if (tmp_cond)
+ tmp_cond->quick_fix_field();
/* Add the predicate to other pushed down predicates */
DBUG_PRINT("info", ("Item_cond_and"));
- cond_tab->select_cond= !cond_tab->select_cond ? tmp :
- new Item_cond_and(cond_tab->select_cond,tmp);
+ cond_tab->select_cond= !cond_tab->select_cond ? tmp_cond :
+ new Item_cond_and(cond_tab->select_cond,
+ tmp_cond);
DBUG_PRINT("info", ("Item_cond_and 0x%lx",
(ulong)cond_tab->select_cond));
if (!cond_tab->select_cond)
@@ -6189,7 +6208,7 @@ void JOIN_TAB::cleanup()
void JOIN::join_free()
{
- SELECT_LEX_UNIT *unit;
+ SELECT_LEX_UNIT *tmp_unit;
SELECT_LEX *sl;
/*
Optimization: if not EXPLAIN and we are done with the JOIN,
@@ -6201,8 +6220,10 @@ void JOIN::join_free()
cleanup(full);
- for (unit= select_lex->first_inner_unit(); unit; unit= unit->next_unit())
- for (sl= unit->first_select(); sl; sl= sl->next_select())
+ for (tmp_unit= select_lex->first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
+ for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
{
Item_subselect *subselect= sl->master_unit()->item;
bool full_local= full && (!subselect || subselect->is_evaluated());
@@ -6840,9 +6861,9 @@ static bool check_simple_equality(Item *left_item, Item *right_item,
else
{
/* None of the fields was found in multiple equalities */
- Item_equal *item= new Item_equal((Item_field *) left_item,
- (Item_field *) right_item);
- cond_equal->current_level.push_back(item);
+ Item_equal *item_equal= new Item_equal((Item_field *) left_item,
+ (Item_field *) right_item);
+ cond_equal->current_level.push_back(item_equal);
}
}
return TRUE;
@@ -6949,8 +6970,8 @@ static bool check_row_equality(Item *left_row, Item_row *right_row,
for (uint i= 0 ; i < n; i++)
{
bool is_converted;
- Item *left_item= left_row->el(i);
- Item *right_item= right_row->el(i);
+ Item *left_item= left_row->element_index(i);
+ Item *right_item= right_row->element_index(i);
if (left_item->type() == Item::ROW_ITEM &&
right_item->type() == Item::ROW_ITEM)
is_converted= check_row_equality((Item_row *) left_item,
@@ -7340,14 +7361,15 @@ static COND *build_equal_items(THD *thd, COND *cond,
{
if (table->on_expr)
{
- List<TABLE_LIST> *join_list= table->nested_join ?
- &table->nested_join->join_list : NULL;
+ List<TABLE_LIST> *nested_join_list= table->nested_join ?
+ &table->nested_join->join_list : NULL;
/*
We can modify table->on_expr because its old value will
be restored before re-execution of PS/SP.
*/
table->on_expr= build_equal_items(thd, table->on_expr, inherited,
- join_list, &table->cond_equal);
+ nested_join_list,
+ &table->cond_equal);
}
}
}
@@ -7599,6 +7621,10 @@ static COND* substitute_for_best_equal_field(COND *cond,
break;
}
}
+ if (cond->type() == Item::COND_ITEM &&
+ !((Item_cond*)cond)->argument_list()->elements)
+ cond= new Item_int((int32)cond->val_bool());
+
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
@@ -7704,7 +7730,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
value->result_type() != STRING_RESULT ||
left_item->collation.collation == value->collation.collation))
{
- Item *tmp=value->new_item();
+ Item *tmp=value->clone_item();
tmp->collation.set(right_item->collation);
if (tmp)
@@ -7728,7 +7754,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
value->result_type() != STRING_RESULT ||
right_item->collation.collation == value->collation.collation))
{
- Item *tmp=value->new_item();
+ Item *tmp= value->clone_item();
tmp->collation.set(left_item->collation);
if (tmp)
@@ -8139,7 +8165,7 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
*/
if (nested_join->join_list.elements != 1)
{
- nested_join->nj_map= 1 << first_unused++;
+ nested_join->nj_map= (nested_join_map) 1 << first_unused++;
first_unused= build_bitmap_for_nested_joins(&nested_join->join_list,
first_unused);
}
@@ -8349,7 +8375,6 @@ optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list,
Item::cond_result *cond_value)
{
THD *thd= join->thd;
- SELECT_LEX *select= thd->lex->current_select;
DBUG_ENTER("optimize_cond");
if (!conds)
@@ -10115,6 +10140,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
enum_nested_loop_state error= NESTED_LOOP_OK;
JOIN_TAB *join_tab;
DBUG_ENTER("do_select");
+ LINT_INIT(join_tab);
join->procedure=procedure;
join->tmp_table= table; /* Save for easy recursion */
@@ -10159,7 +10185,6 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
else
{
DBUG_ASSERT(join->tables);
- DBUG_ASSERT(join_tab);
error= sub_select(join,join_tab,0);
if (error == NESTED_LOOP_OK || error == NESTED_LOOP_NO_MORE_ROWS)
error= sub_select(join,join_tab,1);
@@ -13153,7 +13178,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
Item **select_item; /* The corresponding item from the SELECT clause. */
Field *from_field; /* The corresponding field from the FROM clause. */
uint counter;
- bool unaliased;
+ enum_resolution_type resolution;
/*
Local SP variables may be int but are expressions, not positions.
@@ -13176,7 +13201,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
}
/* Lookup the current GROUP/ORDER field in the SELECT clause. */
select_item= find_item_in_list(order_item, fields, &counter,
- REPORT_EXCEPT_NOT_FOUND, &unaliased);
+ REPORT_EXCEPT_NOT_FOUND, &resolution);
if (!select_item)
return TRUE; /* The item is not unique, or some other error occured. */
@@ -13190,7 +13215,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
original field name, we should additionaly check if we have conflict
for this name (in case if we would perform lookup in all tables).
*/
- if (unaliased && !order_item->fixed &&
+ if (resolution == RESOLVED_BEHIND_ALIAS && !order_item->fixed &&
order_item->fix_fields(thd, order->item))
return TRUE;
@@ -13260,16 +13285,11 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
We check order_item->fixed because Item_func_group_concat can put
arguments for which fix_fields already was called.
*/
- thd->lex->current_select->is_item_list_lookup= 1;
if (!order_item->fixed &&
(order_item->fix_fields(thd, order->item) ||
(order_item= *order->item)->check_cols(1) ||
thd->is_fatal_error))
- {
- thd->lex->current_select->is_item_list_lookup= 0;
return TRUE; /* Wrong field. */
- }
- thd->lex->current_select->is_item_list_lookup= 0;
uint el= all_fields.elements;
all_fields.push_front(order_item); /* Add new field to field list. */
@@ -13424,7 +13444,7 @@ setup_new_fields(THD *thd, List<Item> &fields,
thd->set_query_id=1; // Not really needed, but...
uint counter;
- bool not_used;
+ enum_resolution_type not_used;
for (; new_field ; new_field= new_field->next)
{
if ((item= find_item_in_list(*new_field->item, fields, &counter,
@@ -13529,7 +13549,6 @@ count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields,
param->quick_group=1;
while ((field=li++))
{
- Item::Type type=field->type();
Item::Type real_type= field->real_item()->type();
if (real_type == Item::FIELD_ITEM)
param->field_count++;
@@ -14671,7 +14690,7 @@ int JOIN::rollup_send_data(uint idx)
1 if write_data_failed()
*/
-int JOIN::rollup_write_data(uint idx, TABLE *table)
+int JOIN::rollup_write_data(uint idx, TABLE *table_arg)
{
uint i;
for (i= send_group_parts ; i-- > idx ; )
@@ -14682,7 +14701,7 @@ int JOIN::rollup_write_data(uint idx, TABLE *table)
ref_pointer_array_size);
if ((!having || having->val_int()))
{
- int error;
+ int write_error;
Item *item;
List_iterator_fast<Item> it(rollup.fields[i]);
while ((item= it++))
@@ -14691,10 +14710,10 @@ int JOIN::rollup_write_data(uint idx, TABLE *table)
item->save_in_result_field(1);
}
copy_sum_funcs(sum_funcs_end[i+1], sum_funcs_end[i]);
- if ((error= table->file->write_row(table->record[0])))
+ if ((write_error= table_arg->file->write_row(table_arg->record[0])))
{
- if (create_myisam_from_heap(thd, table, &tmp_table_param,
- error, 0))
+ if (create_myisam_from_heap(thd, table_arg, &tmp_table_param,
+ write_error, 0))
return 1;
}
}
@@ -14875,9 +14894,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
else
{
- TABLE_LIST *tab=table->pos_in_table_list;
- item_list.push_back(new Item_string(tab->alias,
- strlen(tab->alias),
+ TABLE_LIST *real_table= table->pos_in_table_list;
+ item_list.push_back(new Item_string(real_table->alias,
+ strlen(real_table->alias),
cs));
}
/* type */
@@ -15324,10 +15343,13 @@ void st_select_lex::print(THD *thd, String *str)
Item *cur_where= where;
if (join)
cur_where= join->conds;
- if (cur_where)
+ if (cur_where || cond_value != Item::COND_UNDEF)
{
str->append(STRING_WITH_LEN(" where "));
- cur_where->print(str);
+ if (cur_where)
+ cur_where->print(str);
+ else
+ str->append(cond_value != Item::COND_FALSE ? "1" : "0");
}
// group by & olap
@@ -15353,10 +15375,13 @@ void st_select_lex::print(THD *thd, String *str)
if (join)
cur_having= join->having;
- if (cur_having)
+ if (cur_having || having_value != Item::COND_UNDEF)
{
str->append(STRING_WITH_LEN(" having "));
- cur_having->print(str);
+ if (cur_having)
+ cur_having->print(str);
+ else
+ str->append(having_value != Item::COND_FALSE ? "1" : "0");
}
if (order_list.elements)
diff --git a/sql/sql_select.h b/sql/sql_select.h
index a17d7fcb362..27ca633fdb5 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -292,7 +292,7 @@ public:
bool need_tmp, hidden_group_fields;
DYNAMIC_ARRAY keyuse;
- Item::cond_result cond_value;
+ Item::cond_result cond_value, having_value;
List<Item> all_fields; // to store all fields that used in query
//Above list changed to use temporary table
List<Item> tmp_all_fields1, tmp_all_fields2, tmp_all_fields3;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 659dd49d537..24aef80626f 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -28,11 +28,11 @@
#include "ha_berkeley.h" // For berkeley_show_logs
#endif
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
static const char *grant_names[]={
"select","insert","update","delete","create","drop","reload","shutdown",
"process","file","grant","references","index","alter"};
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
"grant_types",
grant_names, NULL};
@@ -462,10 +462,10 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
bool mysqld_show_create_db(THD *thd, char *dbname,
const HA_CREATE_INFO *create_info)
{
- Security_context *sctx= thd->security_ctx;
char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *sctx= thd->security_ctx;
uint db_access;
#endif
HA_CREATE_INFO create;
@@ -794,7 +794,7 @@ static int
store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
{
List<Item> field_list;
- char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], *end;
+ char tmp[MAX_FIELD_WIDTH], *for_str, buff[128];
const char *alias;
String type(tmp, sizeof(tmp), system_charset_info);
Field **ptr,*field;
@@ -992,7 +992,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (key_part->field &&
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&
- !(key_info->flags & HA_FULLTEXT)))
+ !(key_info->flags & (HA_FULLTEXT | HA_SPATIAL))))
{
buff[0] = '(';
char* end=int10_to_str((long) key_part->length /
@@ -1036,8 +1036,9 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
but may extrapolate its existence from that of an AUTO_INCREMENT column.
*/
- if(create_info.auto_increment_value > 1)
+ if (create_info.auto_increment_value > 1)
{
+ char *end;
packet->append(" AUTO_INCREMENT=", 16);
end= longlong10_to_str(create_info.auto_increment_value, buff,10);
packet->append(buff, (uint) (end - buff));
@@ -1059,6 +1060,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (share->min_rows)
{
+ char *end;
packet->append(STRING_WITH_LEN(" MIN_ROWS="));
end= longlong10_to_str(share->min_rows, buff, 10);
packet->append(buff, (uint) (end- buff));
@@ -1066,6 +1068,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (share->max_rows && !table_list->schema_table)
{
+ char *end;
packet->append(STRING_WITH_LEN(" MAX_ROWS="));
end= longlong10_to_str(share->max_rows, buff, 10);
packet->append(buff, (uint) (end - buff));
@@ -1073,6 +1076,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (share->avg_row_length)
{
+ char *end;
packet->append(STRING_WITH_LEN(" AVG_ROW_LENGTH="));
end= longlong10_to_str(share->avg_row_length, buff,10);
packet->append(buff, (uint) (end - buff));
@@ -1443,7 +1447,7 @@ static bool show_status_array(THD *thd, const char *wild,
long nr;
if (show_type == SHOW_SYS)
{
- show_type= ((sys_var*) value)->type();
+ show_type= ((sys_var*) value)->show_type();
value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
&null_lex_str);
}
@@ -1489,7 +1493,7 @@ static bool show_status_array(THD *thd, const char *wild,
break;
}
case SHOW_STARTTIME:
- nr= (long) (thd->query_start() - start_time);
+ nr= (long) (thd->query_start() - server_start_time);
end= int10_to_str(nr, buff, 10);
break;
case SHOW_QUESTION:
@@ -2118,19 +2122,21 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
List<char> bases;
List_iterator_fast<char> it(bases);
COND *partial_cond;
- Security_context *sctx= thd->security_ctx;
uint derived_tables= lex->derived_tables;
int error= 1;
db_type not_used;
Open_tables_state open_tables_state_backup;
bool save_view_prepare_mode= lex->view_prepare_mode;
Query_tables_list query_tables_list_backup;
- lex->view_prepare_mode= TRUE;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *sctx= thd->security_ctx;
+#endif
DBUG_ENTER("get_all_tables");
LINT_INIT(end);
LINT_INIT(len);
+ lex->view_prepare_mode= TRUE;
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
/*
@@ -2368,7 +2374,9 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
bool with_i_schema;
HA_CREATE_INFO create;
TABLE *table= tables->table;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *sctx= thd->security_ctx;
+#endif
DBUG_ENTER("fill_schema_shemata");
if (make_db_list(thd, &files, &idx_field_vals,
@@ -2507,20 +2515,21 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
if (file->create_time)
{
thd->variables.time_zone->gmt_sec_to_TIME(&time,
- file->create_time);
+ (my_time_t) file->create_time);
table->field[14]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
table->field[14]->set_notnull();
}
if (file->update_time)
{
thd->variables.time_zone->gmt_sec_to_TIME(&time,
- file->update_time);
+ (my_time_t) file->update_time);
table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
table->field[15]->set_notnull();
}
if (file->check_time)
{
- thd->variables.time_zone->gmt_sec_to_TIME(&time, file->check_time);
+ thd->variables.time_zone->gmt_sec_to_TIME(&time,
+ (my_time_t) file->check_time);
table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
table->field[16]->set_notnull();
}
@@ -2720,7 +2729,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
field->real_type() == MYSQL_TYPE_STRING) // For binary type
{
- uint32 octet_max_length= field->max_length();
+ uint32 octet_max_length= field->max_display_length();
if (is_blob && octet_max_length != (uint32) 4294967295U)
octet_max_length /= field->charset()->mbmaxlen;
longlong char_max_len= is_blob ?
@@ -2750,10 +2759,10 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
case FIELD_TYPE_LONG:
case FIELD_TYPE_LONGLONG:
case FIELD_TYPE_INT24:
- field_length= field->max_length() - 1;
+ field_length= field->max_display_length() - 1;
break;
case FIELD_TYPE_BIT:
- field_length= field->max_length();
+ field_length= field->max_display_length();
decimals= -1; // return NULL
break;
case FIELD_TYPE_FLOAT:
@@ -3420,8 +3429,8 @@ static int get_schema_key_column_usage_record(THD *thd,
show_table->file->get_foreign_key_list(thd, &f_key_list);
FOREIGN_KEY_INFO *f_key_info;
- List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
- while ((f_key_info= it++))
+ List_iterator_fast<FOREIGN_KEY_INFO> fkey_it(f_key_list);
+ while ((f_key_info= fkey_it++))
{
LEX_STRING *f_info;
LEX_STRING *r_info;
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index ef50e5864a5..9d7df73cd7a 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -617,27 +617,26 @@ skip:
}
/*
-** replace substring with string
-** If wrong parameter or not enough memory, do nothing
+ Replace substring with string
+ If wrong parameter or not enough memory, do nothing
*/
-
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
{
return replace(offset,arg_length,to.ptr(),to.length());
}
bool String::replace(uint32 offset,uint32 arg_length,
- const char *to,uint32 length)
+ const char *to, uint32 to_length)
{
- long diff = (long) length-(long) arg_length;
+ long diff = (long) to_length-(long) arg_length;
if (offset+arg_length <= str_length)
{
if (diff < 0)
{
- if (length)
- memcpy(Ptr+offset,to,length);
- bmove(Ptr+offset+length,Ptr+offset+arg_length,
+ if (to_length)
+ memcpy(Ptr+offset,to,to_length);
+ bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
str_length-offset-arg_length);
}
else
@@ -649,8 +648,8 @@ bool String::replace(uint32 offset,uint32 arg_length,
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
str_length-offset-arg_length);
}
- if (length)
- memcpy(Ptr+offset,to,length);
+ if (to_length)
+ memcpy(Ptr+offset,to,to_length);
}
str_length+=(uint32) diff;
}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index f4250f4c70a..c1d27cb1791 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -86,7 +86,8 @@ public:
{ /* never called */ }
~String() { free(); }
- inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; }
+ inline void set_charset(CHARSET_INFO *charset_arg)
+ { str_charset= charset_arg; }
inline CHARSET_INFO *charset() const { return str_charset; }
inline uint32 length() const { return str_length;}
inline uint32 alloced_length() const { return Alloced_length;}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6f57ac1ec42..14b9e0aa25d 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -222,9 +222,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
String wrong_tables;
int error;
bool some_tables_deleted=0, tmp_table_deleted=0, foreign_key_error=0;
-
DBUG_ENTER("mysql_rm_table_part2");
+ LINT_INIT(alias);
+
if (!drop_temporary && lock_table_names(thd, tables))
DBUG_RETURN(1);
@@ -773,14 +774,14 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
interval= sql_field->interval= typelib(stmt_root,
sql_field->interval_list);
- List_iterator<String> it(sql_field->interval_list);
+ List_iterator<String> int_it(sql_field->interval_list);
String conv, *tmp;
char comma_buf[2];
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
(uchar*) comma_buf +
sizeof(comma_buf));
DBUG_ASSERT(comma_length > 0);
- for (uint i= 0; (tmp= it++); i++)
+ for (uint i= 0; (tmp= int_it++); i++)
{
uint lengthsp;
if (String::needs_conversion(tmp->length(), tmp->charset(),
@@ -1343,6 +1344,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
else if (!f_is_geom(sql_field->pack_flag) &&
(column->length > length ||
+ !Field::type_can_have_key_part (sql_field->sql_type) ||
((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
(key_info->flags & HA_NOSAME))) &&
@@ -2160,7 +2162,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT *),
int (view_operator_func)(THD *, TABLE_LIST*))
{
- TABLE_LIST *table, *save_next_global, *save_next_local;
+ TABLE_LIST *table;
SELECT_LEX *select= &thd->lex->select_lex;
List<Item> field_list;
Item *item;
@@ -2191,30 +2193,33 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
strxmov(table_name, db, ".", table->table_name, NullS);
thd->open_options|= extra_open_options;
table->lock_type= lock_type;
- /* open only one table from local list of command */
- save_next_global= table->next_global;
- table->next_global= 0;
- save_next_local= table->next_local;
- table->next_local= 0;
- select->table_list.first= (byte*)table;
- /*
- Time zone tables and SP tables can be add to lex->query_tables list,
- so it have to be prepared.
- TODO: Investigate if we can put extra tables into argument instead of
- using lex->query_tables
- */
- lex->query_tables= table;
- lex->query_tables_last= &table->next_global;
- lex->query_tables_own_last= 0;
- thd->no_warnings_for_error= no_warnings_for_error;
- if (view_operator_func == NULL)
- table->required_type=FRMTYPE_TABLE;
- open_and_lock_tables(thd, table);
- thd->no_warnings_for_error= 0;
- table->next_global= save_next_global;
- table->next_local= save_next_local;
- thd->open_options&= ~extra_open_options;
+ /* open only one table from local list of command */
+ {
+ TABLE_LIST *save_next_global, *save_next_local;
+ save_next_global= table->next_global;
+ table->next_global= 0;
+ save_next_local= table->next_local;
+ table->next_local= 0;
+ select->table_list.first= (byte*)table;
+ /*
+ Time zone tables and SP tables can be add to lex->query_tables list,
+ so it have to be prepared.
+ TODO: Investigate if we can put extra tables into argument instead of
+ using lex->query_tables
+ */
+ lex->query_tables= table;
+ lex->query_tables_last= &table->next_global;
+ lex->query_tables_own_last= 0;
+ thd->no_warnings_for_error= no_warnings_for_error;
+ if (view_operator_func == NULL)
+ table->required_type=FRMTYPE_TABLE;
+ open_and_lock_tables(thd, table);
+ thd->no_warnings_for_error= 0;
+ table->next_global= save_next_global;
+ table->next_local= save_next_local;
+ thd->open_options&= ~extra_open_options;
+ }
if (prepare_func)
{
switch ((*prepare_func)(thd, table, check_opt)) {
@@ -3011,7 +3016,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint order_num, ORDER *order, bool ignore)
{
TABLE *table,*new_table=0;
- int error;
+ int error= 0;
char tmp_name[80],old_name[32],new_name_buff[FN_REFLEN];
char new_alias_buff[FN_REFLEN], *table_name, *db, *new_alias, *alias;
char index_file[FN_REFLEN], data_file[FN_REFLEN];
@@ -3064,9 +3069,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(1);
VOID(pthread_mutex_lock(&LOCK_open));
if (lock_table_names(thd, table_list))
+ {
+ error= 1;
goto view_err;
+ }
- error=0;
if (!do_rename(thd, table_list, new_db, new_name, new_name, 1))
{
if (mysql_bin_log.is_open())
@@ -3165,7 +3172,6 @@ view_err:
{
switch (alter_info->keys_onoff) {
case LEAVE_AS_IS:
- error= 0;
break;
case ENABLE:
/*
@@ -3193,10 +3199,10 @@ view_err:
}
if (error == HA_ERR_WRONG_COMMAND)
{
+ error= 0;
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
table->alias);
- error= 0;
}
VOID(pthread_mutex_lock(&LOCK_open));
@@ -3236,10 +3242,10 @@ view_err:
if (error == HA_ERR_WRONG_COMMAND)
{
+ error= 0;
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
table->alias);
- error= 0;
}
if (!error)
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 632f9933532..55d51ad07b7 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -106,10 +106,6 @@ const LEX_STRING trg_event_type_names[]=
};
-static int
-add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists,
- TABLE_LIST ** table);
-
class Handle_old_incorrect_sql_modes_hook: public Unknown_key_hook
{
private:
@@ -800,8 +796,8 @@ bool Table_triggers_list::prepare_record1_accessors(TABLE *table)
void Table_triggers_list::set_table(TABLE *new_table)
{
- table= new_table;
- for (Field **field= table->triggers->record1_field ; *field ; field++)
+ trigger_table= new_table;
+ for (Field **field= new_table->triggers->record1_field ; *field ; field++)
{
(*field)->table= (*field)->orig_table= new_table;
(*field)->table_name= &new_table->alias;
@@ -987,11 +983,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
thd->spcont= 0;
if (MYSQLparse((void *)thd) || thd->is_fatal_error)
{
- /*
- Free lex associated resources.
- QQ: Do we really need all this stuff here ?
- */
- delete lex.sphead;
+ /* Currently sphead is always deleted in case of a parse error */
+ DBUG_ASSERT(lex.sphead == 0);
goto err_with_lex_cleanup;
}
@@ -1182,7 +1175,7 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event,
1 Error
*/
-static int
+int
add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists,
TABLE_LIST **table)
{
@@ -1365,7 +1358,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
It is OK to allocate some memory on table's MEM_ROOT since this
table instance will be thrown out at the end of rename anyway.
*/
- new_def.str= memdup_root(&table->mem_root, buff.ptr(), buff.length());
+ new_def.str= memdup_root(&trigger_table->mem_root, buff.ptr(),
+ buff.length());
new_def.length= buff.length();
on_table_name->str= new_def.str + before_on_len;
on_table_name->length= on_q_table_name_len;
@@ -1545,17 +1539,17 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event,
if (old_row_is_record1)
{
old_field= record1_field;
- new_field= table->field;
+ new_field= trigger_table->field;
}
else
{
new_field= record1_field;
- old_field= table->field;
+ old_field= trigger_table->field;
}
thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER);
err_status= sp_trigger->execute_trigger
- (thd, table->s->db, table->s->table_name,
+ (thd, trigger_table->s->db, trigger_table->s->table_name,
&subject_table_grants[event][time_type]);
thd->restore_sub_statement_state(&statement_state);
}
@@ -1591,7 +1585,7 @@ void Table_triggers_list::mark_fields_used(THD *thd, trg_event_type event)
{
/* We cannot mark fields which does not present in table. */
if (trg_field->field_idx != (uint)-1)
- table->field[trg_field->field_idx]->query_id = thd->query_id;
+ trigger_table->field[trg_field->field_idx]->query_id = thd->query_id;
}
}
}
@@ -1622,7 +1616,7 @@ bool Table_triggers_list::is_updated_in_before_update_triggers(Field *fld)
{
if (trg_fld->get_settable_routine_parameter() &&
trg_fld->field_idx != (uint)-1 &&
- table->field[trg_fld->field_idx]->eq(fld))
+ trigger_table->field[trg_fld->field_idx]->eq(fld))
return TRUE;
}
return FALSE;
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h
index 91ce571e3f5..19b2b24a3fe 100644
--- a/sql/sql_trigger.h
+++ b/sql/sql_trigger.h
@@ -42,8 +42,9 @@ class Table_triggers_list: public Sql_alloc
*/
Field **new_field;
Field **old_field;
+
/* TABLE instance for which this triggers list object was created */
- TABLE *table;
+ TABLE *trigger_table;
/*
Names of triggers.
Should correspond to order of triggers on definitions_list,
@@ -83,7 +84,7 @@ public:
List<LEX_STRING> definers_list;
Table_triggers_list(TABLE *table_arg):
- record1_field(0), table(table_arg)
+ record1_field(0), trigger_table(table_arg)
{
bzero((char *)bodies, sizeof(bodies));
bzero((char *)trigger_fields, sizeof(trigger_fields));
@@ -138,3 +139,7 @@ private:
extern const LEX_STRING trg_action_time_type_names[];
extern const LEX_STRING trg_event_type_names[];
+
+int
+add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists,
+ TABLE_LIST **table);
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 0632d88875e..1ec724a6338 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -111,7 +111,7 @@ bool select_union::flush()
*/
bool
-select_union::create_result_table(THD *thd, List<Item> *column_types,
+select_union::create_result_table(THD *thd_arg, List<Item> *column_types,
bool is_union_distinct, ulonglong options,
const char *alias)
{
@@ -119,7 +119,7 @@ select_union::create_result_table(THD *thd, List<Item> *column_types,
tmp_table_param.init();
tmp_table_param.field_count= column_types->elements;
- if (! (table= create_tmp_table(thd, &tmp_table_param, *column_types,
+ if (! (table= create_tmp_table(thd_arg, &tmp_table_param, *column_types,
(ORDER*) 0, is_union_distinct, 1,
options, HA_POS_ERROR, (char*) alias)))
return TRUE;
@@ -141,9 +141,9 @@ select_union::create_result_table(THD *thd, List<Item> *column_types,
*/
void
-st_select_lex_unit::init_prepare_fake_select_lex(THD *thd)
+st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg)
{
- thd->lex->current_select= fake_select_lex;
+ thd_arg->lex->current_select= fake_select_lex;
fake_select_lex->table_list.link_in_list((byte *)&result_table_list,
(byte **)
&result_table_list.next_local);
@@ -199,7 +199,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
DBUG_RETURN(FALSE);
}
prepared= 1;
- res= FALSE;
+ saved_error= FALSE;
thd_arg->lex->current_select= sl= first_sl;
found_rows_for_union= first_sl->options & OPTION_FOUND_ROWS;
@@ -240,23 +240,25 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
can_skip_order_by= is_union && !(sl->braces && sl->explicit_limit);
- res= join->prepare(&sl->ref_pointer_array,
- (TABLE_LIST*) sl->table_list.first, sl->with_wild,
- sl->where,
- (can_skip_order_by ? 0 : sl->order_list.elements) +
- sl->group_list.elements,
- can_skip_order_by ?
- (ORDER*) 0 : (ORDER *)sl->order_list.first,
- (ORDER*) sl->group_list.first,
- sl->having,
- (is_union ? (ORDER*) 0 :
- (ORDER*) thd_arg->lex->proc_list.first),
- sl, this);
+ saved_error= join->prepare(&sl->ref_pointer_array,
+ (TABLE_LIST*) sl->table_list.first,
+ sl->with_wild,
+ sl->where,
+ (can_skip_order_by ? 0 :
+ sl->order_list.elements) +
+ sl->group_list.elements,
+ can_skip_order_by ?
+ (ORDER*) 0 : (ORDER *)sl->order_list.first,
+ (ORDER*) sl->group_list.first,
+ sl->having,
+ (is_union ? (ORDER*) 0 :
+ (ORDER*) thd_arg->lex->proc_list.first),
+ sl, this);
/* There are no * in the statement anymore (for PS) */
sl->with_wild= 0;
last_procedure= join->procedure;
- if ((res= (res || thd_arg->is_fatal_error)))
+ if (saved_error || (saved_error= thd_arg->is_fatal_error))
goto err;
/*
Use items list of underlaid select for derived tables to preserve
@@ -351,12 +353,12 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
arena= thd->activate_stmt_arena_if_needed(&backup_arena);
- res= table->fill_item_list(&item_list);
+ saved_error= table->fill_item_list(&item_list);
if (arena)
thd->restore_active_arena(arena, &backup_arena);
- if (res)
+ if (saved_error)
goto err;
if (thd->stmt_arena->is_stmt_prepare())
@@ -375,7 +377,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
fake_select_lex->item_list= item_list;
thd_arg->lex->current_select= fake_select_lex;
- res= fake_select_lex->join->
+ saved_error= fake_select_lex->join->
prepare(&fake_select_lex->ref_pointer_array,
(TABLE_LIST*) fake_select_lex->table_list.first,
0, 0,
@@ -400,7 +402,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg->lex->current_select= lex_select_save;
- DBUG_RETURN(res || thd_arg->is_fatal_error);
+ DBUG_RETURN(saved_error || thd_arg->is_fatal_error);
err:
thd_arg->lex->current_select= lex_select_save;
@@ -442,7 +444,7 @@ bool st_select_lex_unit::exec()
thd->lex->current_select= sl;
if (optimized)
- res= sl->join->reinit();
+ saved_error= sl->join->reinit();
else
{
set_limit(sl);
@@ -465,9 +467,9 @@ bool st_select_lex_unit::exec()
sl->join->select_options=
(select_limit_cnt == HA_POS_ERROR || sl->braces) ?
sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
- res= sl->join->optimize();
+ saved_error= sl->join->optimize();
}
- if (!res)
+ if (!saved_error)
{
records_at_start= table->file->records;
sl->join->exec();
@@ -477,11 +479,11 @@ bool st_select_lex_unit::exec()
DBUG_RETURN(TRUE);
table->no_keyread=1;
}
- res= sl->join->error;
+ saved_error= sl->join->error;
offset_limit_cnt= (ha_rows)(sl->offset_limit ?
sl->offset_limit->val_uint() :
0);
- if (!res)
+ if (!saved_error)
{
examined_rows+= thd->examined_row_count;
if (union_result->flush())
@@ -491,10 +493,10 @@ bool st_select_lex_unit::exec()
}
}
}
- if (res)
+ if (saved_error)
{
thd->lex->current_select= lex_select_save;
- DBUG_RETURN(res);
+ DBUG_RETURN(saved_error);
}
/* Needed for the following test and for records_at_start in next loop */
int error= table->file->info(HA_STATUS_VARIABLE);
@@ -520,7 +522,7 @@ bool st_select_lex_unit::exec()
optimized= 1;
/* Send result to 'result' */
- res= TRUE;
+ saved_error= TRUE;
{
List<Item_func_match> empty_list;
empty_list.empty();
@@ -561,17 +563,17 @@ bool st_select_lex_unit::exec()
}
join->init(thd, item_list, fake_select_lex->options, result);
}
- res= mysql_select(thd, &fake_select_lex->ref_pointer_array,
- &result_table_list,
- 0, item_list, NULL,
- global_parameters->order_list.elements,
- (ORDER*)global_parameters->order_list.first,
- (ORDER*) NULL, NULL, (ORDER*) NULL,
- fake_select_lex->options | SELECT_NO_UNLOCK,
- result, this, fake_select_lex);
+ saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
+ &result_table_list,
+ 0, item_list, NULL,
+ global_parameters->order_list.elements,
+ (ORDER*)global_parameters->order_list.first,
+ (ORDER*) NULL, NULL, (ORDER*) NULL,
+ fake_select_lex->options | SELECT_NO_UNLOCK,
+ result, this, fake_select_lex);
fake_select_lex->table_list.empty();
- if (!res)
+ if (!saved_error)
{
thd->limit_found_rows = (ulonglong)table->file->records + add_rows;
thd->examined_row_count+= examined_rows;
@@ -583,7 +585,7 @@ bool st_select_lex_unit::exec()
}
}
thd->lex->current_select= lex_select_save;
- DBUG_RETURN(res);
+ DBUG_RETURN(saved_error);
}
@@ -619,6 +621,12 @@ bool st_select_lex_unit::cleanup()
join->tables= 0;
}
error|= fake_select_lex->cleanup();
+ if (fake_select_lex->order_list.elements)
+ {
+ ORDER *ord;
+ for (ord= (ORDER*)fake_select_lex->order_list.first; ord; ord= ord->next)
+ (*ord->item)->cleanup();
+ }
}
DBUG_RETURN(error);
@@ -660,18 +668,18 @@ void st_select_lex_unit::reinit_exec_mechanism()
TRUE - error
*/
-bool st_select_lex_unit::change_result(select_subselect *result,
+bool st_select_lex_unit::change_result(select_subselect *new_result,
select_subselect *old_result)
{
bool res= FALSE;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{
if (sl->join && sl->join->result == old_result)
- if (sl->join->change_result(result))
+ if (sl->join->change_result(new_result))
return TRUE;
}
if (fake_select_lex && fake_select_lex->join)
- res= fake_select_lex->join->change_result(result);
+ res= fake_select_lex->join->change_result(new_result);
return (res);
}
@@ -751,4 +759,3 @@ void st_select_lex::cleanup_all_joins(bool full)
for (sl= unit->first_select(); sl; sl= sl->next_select())
sl->cleanup_all_joins(full);
}
-
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 60b7ac1df1c..27d38114885 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -64,7 +64,6 @@ static bool check_fields(THD *thd, List<Item> &items)
List_iterator<Item> it(items);
Item *item;
Item_field *field;
- Name_resolution_context *context= &thd->lex->select_lex.context;
while ((item= it++))
{
@@ -641,7 +640,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
/* Check that we are not using table that we are updating in a sub select */
{
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, table_list, table_list->next_global)))
+ if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0)))
{
update_non_unique_table_error(table_list, "UPDATE", duplicate);
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
@@ -788,7 +787,7 @@ reopen_tables:
tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ;
tl->updating= 0;
/* Update TABLE::lock_type accordingly. */
- if (!tl->placeholder() && !tl->schema_table && !using_lock_tables)
+ if (!tl->placeholder() && !using_lock_tables)
tl->table->reginfo.lock_type= tl->lock_type;
}
}
@@ -868,7 +867,7 @@ reopen_tables:
tl->lock_type != TL_READ_NO_INSERT)
{
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, tl, table_list)))
+ if ((duplicate= unique_table(thd, tl, table_list, 0)))
{
update_non_unique_table_error(table_list, "UPDATE", duplicate);
DBUG_RETURN(TRUE);
@@ -1087,7 +1086,7 @@ static bool safe_update_on_fly(THD *thd, JOIN_TAB *join_tab,
List<Item> *fields)
{
TABLE *table= join_tab->table;
- if (unique_table(thd, table_ref, all_tables))
+ if (unique_table(thd, table_ref, all_tables, 0))
return 0;
switch (join_tab->type) {
case JT_SYSTEM:
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index fd2d6c89785..7143df8474a 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -861,7 +861,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
Query_arena *arena, backup;
TABLE_LIST *top_view= table->top_table();
int res;
- bool result;
+ bool result, view_is_mergeable;
+ TABLE_LIST *view_main_select_tables;
DBUG_ENTER("mysql_make_view");
DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
@@ -1088,9 +1089,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
table->next_global= view_tables;
}
- bool view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
- lex->can_be_merged());
- TABLE_LIST *view_main_select_tables;
+ view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
+ lex->can_be_merged());
+ LINT_INIT(view_main_select_tables);
+
if (view_is_mergeable)
{
/*
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index d5b3aadbf39..258283d113e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -46,33 +46,92 @@ const LEX_STRING null_lex_str={0,0};
#define yyoverflow(A,B,C,D,E,F) {ulong val= *(F); if (my_yyoverflow((B), (D), &val)) { yyerror((char*) (A)); return 2; } else { *(F)= (YYSIZE_T)val; }}
+#undef WARN_DEPRECATED /* this macro is also defined in mysql_priv.h */
#define WARN_DEPRECATED(A,B) \
push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN, \
ER_WARN_DEPRECATED_SYNTAX, \
ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B));
-#define YYERROR_UNLESS(A) \
+#define MYSQL_YYABORT \
+ do \
+ { \
+ LEX::cleanup_lex_after_parse_error(YYTHD);\
+ YYABORT; \
+ } while (0)
+
+#define MYSQL_YYABORT_UNLESS(A) \
if (!(A)) \
- { \
- yyerror(ER(ER_SYNTAX_ERROR)); \
- YYABORT; \
+ { \
+ my_parse_error(ER(ER_SYNTAX_ERROR));\
+ MYSQL_YYABORT; \
}
-/* Helper for parsing "IS [NOT] truth_value" */
-inline Item *is_truth_value(Item *A, bool v1, bool v2)
-{
- return new Item_func_if(create_func_ifnull(A,
- new Item_int((char *) (v2 ? "TRUE" : "FALSE"), v2, 1)),
- new Item_int((char *) (v1 ? "TRUE" : "FALSE"), v1, 1),
- new Item_int((char *) (v1 ? "FALSE" : "TRUE"),!v1, 1));
-}
-
#ifndef DBUG_OFF
#define YYDEBUG 1
#else
#define YYDEBUG 0
#endif
+/**
+ @brief Push an error message into MySQL error stack with line
+ and position information.
+
+ This function provides semantic action implementers with a way
+ to push the famous "You have a syntax error near..." error
+ message into the error stack, which is normally produced only if
+ a parse error is discovered internally by the Bison generated
+ parser.
+*/
+
+void my_parse_error(const char *s)
+{
+ THD *thd= current_thd;
+
+ char *yytext= (char*) thd->lex->tok_start;
+ /* Push an error into the error stack */
+ my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
+ (yytext ? (char*) yytext : ""),
+ thd->lex->yylineno);
+}
+
+/**
+ @brief Bison callback to report a syntax/OOM error
+
+ This function is invoked by the bison-generated parser
+ when a syntax error, a parse error or an out-of-memory
+ condition occurs. This function is not invoked when the
+ parser is requested to abort by semantic action code
+ by means of YYABORT or YYACCEPT macros. This is why these
+ macros should not be used (use MYSQL_YYABORT/MYSQL_YYACCEPT
+ instead).
+
+ The parser will abort immediately after invoking this callback.
+
+ This function is not for use in semantic actions and is internal to
+ the parser, as it performs some pre-return cleanup.
+ In semantic actions, please use my_parse_error or my_error to
+ push an error into the error stack and MYSQL_YYABORT
+ to abort from the parser.
+*/
+
+void MYSQLerror(const char *s)
+{
+ THD *thd= current_thd;
+
+ /*
+ Restore the original LEX if it was replaced when parsing
+ a stored procedure. We must ensure that a parsing error
+ does not leave any side effects in the THD.
+ */
+ LEX::cleanup_lex_after_parse_error(thd);
+
+ /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
+ if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
+ s= ER(ER_SYNTAX_ERROR);
+ my_parse_error(s);
+}
+
+
#ifndef DBUG_OFF
void turn_parser_debug_on()
{
@@ -276,6 +335,81 @@ void case_stmt_action_end_case(LEX *lex, bool simple)
lex->sphead->do_cont_backpatch();
}
+/**
+ Helper to resolve the SQL:2003 Syntax exception 1) in <in predicate>.
+ See SQL:2003, Part 2, section 8.4 <in predicate>, Note 184, page 383.
+ This function returns the proper item for the SQL expression
+ <code>left [NOT] IN ( expr )</code>
+ @param thd the current thread
+ @param left the in predicand
+ @param equal true for IN predicates, false for NOT IN predicates
+ @param expr first and only expression of the in value list
+ @return an expression representing the IN predicate.
+*/
+Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
+ Item *expr)
+{
+ /*
+ Relevant references for this issue:
+ - SQL:2003, Part 2, section 8.4 <in predicate>, page 383,
+ - SQL:2003, Part 2, section 7.2 <row value expression>, page 296,
+ - SQL:2003, Part 2, section 6.3 <value expression primary>, page 174,
+ - SQL:2003, Part 2, section 7.15 <subquery>, page 370,
+ - SQL:2003 Feature F561, "Full value expressions".
+
+ The exception in SQL:2003 Note 184 means:
+ Item_singlerow_subselect, which corresponds to a <scalar subquery>,
+ should be re-interpreted as an Item_in_subselect, which corresponds
+ to a <table subquery> when used inside an <in predicate>.
+
+ Our reading of Note 184 is reccursive, so that all:
+ - IN (( <subquery> ))
+ - IN ((( <subquery> )))
+ - IN '('^N <subquery> ')'^N
+ - etc
+ should be interpreted as a <table subquery>, no matter how deep in the
+ expression the <subquery> is.
+ */
+
+ Item *result;
+
+ DBUG_ENTER("handle_sql2003_note184_exception");
+
+ if (expr->type() == Item::SUBSELECT_ITEM)
+ {
+ Item_subselect *expr2 = (Item_subselect*) expr;
+
+ if (expr2->substype() == Item_subselect::SINGLEROW_SUBS)
+ {
+ Item_singlerow_subselect *expr3 = (Item_singlerow_subselect*) expr2;
+ st_select_lex *subselect;
+
+ /*
+ Implement the mandated change, by altering the semantic tree:
+ left IN Item_singlerow_subselect(subselect)
+ is modified to
+ left IN (subselect)
+ which is represented as
+ Item_in_subselect(left, subselect)
+ */
+ subselect= expr3->invalidate_and_restore_select_lex();
+ result= new (thd->mem_root) Item_in_subselect(left, subselect);
+
+ if (! equal)
+ result = negate_expression(thd, result);
+
+ DBUG_RETURN(result);
+ }
+ }
+
+ if (equal)
+ result= new (thd->mem_root) Item_func_eq(left, expr);
+ else
+ result= new (thd->mem_root) Item_func_ne(left, expr);
+
+ DBUG_RETURN(result);
+}
+
%}
%union {
int num;
@@ -322,6 +456,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%}
%pure_parser /* We have threads */
+/*
+ Currently there is 251 shift/reduce conflict. We should not introduce
+ new conflicts any more.
+*/
+%expect 251
%token END_OF_INPUT
@@ -953,7 +1092,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
key_alg opt_btree_or_rtree
%type <string_list>
- key_usage_list using_list
+ key_usage_list key_usage_list_inner using_list
%type <key_part>
key_part
@@ -992,6 +1131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
old_or_new_charset_name_or_default
collation_name
collation_name_or_default
+ opt_load_data_charset
%type <variable> internal_variable_name
@@ -1065,7 +1205,7 @@ query:
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{
my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -1137,8 +1277,8 @@ deallocate:
LEX *lex= thd->lex;
if (lex->stmt_prepare_mode)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
lex->prepared_stmt_name= $3;
@@ -1157,8 +1297,8 @@ prepare:
LEX *lex= thd->lex;
if (lex->stmt_prepare_mode)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_PREPARE;
lex->prepared_stmt_name= $2;
@@ -1187,8 +1327,8 @@ execute:
LEX *lex= thd->lex;
if (lex->stmt_prepare_mode)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_EXECUTE;
lex->prepared_stmt_name= $2;
@@ -1212,7 +1352,7 @@ execute_var_ident: '@' ident_or_text
LEX *lex=Lex;
LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING));
if (!lexstr || lex->prepared_stmt_params.push_back(lexstr))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -1224,7 +1364,7 @@ help:
if (Lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP");
- YYABORT;
+ MYSQL_YYABORT;
}
}
ident_or_text
@@ -1351,7 +1491,7 @@ create:
(using_update_log ?
TL_READ_NO_INSERT:
TL_READ)))
- YYABORT;
+ MYSQL_YYABORT;
lex->alter_info.reset();
lex->col_list.empty();
lex->change=NullS;
@@ -1369,7 +1509,7 @@ create:
lex->sql_command= SQLCOM_CREATE_INDEX;
if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
TL_OPTION_UPDATING))
- YYABORT;
+ MYSQL_YYABORT;
lex->alter_info.reset();
lex->alter_info.flags= ALTER_ADD_INDEX;
lex->col_list.empty();
@@ -1430,12 +1570,12 @@ sp_name:
if (!$1.str || check_db_name($1.str))
{
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
if (check_routine_name($3))
{
my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= new sp_name($1, $3);
$$->init_qname(YYTHD);
@@ -1447,10 +1587,10 @@ sp_name:
if (check_routine_name($1))
{
my_error(ER_SP_WRONG_NAME, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
if (thd->copy_db_to(&db.str, &db.length))
- YYABORT;
+ MYSQL_YYABORT;
$$= new sp_name(db, $1);
if ($$)
$$->init_qname(YYTHD);
@@ -1470,7 +1610,7 @@ create_function_tail:
and is considered a parsing error.
*/
my_error(ER_WRONG_USAGE, MYF(0), "SONAME", "DEFINER");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_CREATE_FUNCTION;
lex->udf.name = lex->spname->m_name;
@@ -1489,13 +1629,13 @@ create_function_tail:
if (lex->udf.type == UDFTYPE_AGGREGATE)
{
my_error(ER_SP_NO_AGGREGATE, MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->sphead)
{
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
- YYABORT;
+ MYSQL_YYABORT;
}
/* Order is important here: new - reset - init */
sp= new sp_head();
@@ -1536,7 +1676,7 @@ create_function_tail:
if (sp->fill_field_definition(YYTHD, lex,
(enum enum_field_types) $8,
&sp->m_return_field_def))
- YYABORT;
+ MYSQL_YYABORT;
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
@@ -1553,14 +1693,14 @@ create_function_tail:
sp_head *sp= lex->sphead;
if (sp->is_not_allowed_in_function("function"))
- YYABORT;
+ MYSQL_YYABORT;
lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->init_strings(YYTHD, lex);
if (!(sp->m_flags & sp_head::HAS_RETURN))
{
my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str);
- YYABORT;
+ MYSQL_YYABORT;
}
/* Restore flag if it was cleared above */
if (sp->m_old_cmq)
@@ -1690,7 +1830,7 @@ sp_fdparam:
if (spc->find_variable(&$1, TRUE))
{
my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
sp_variable_t *spvar= spc->push_variable(&$1,
(enum enum_field_types)$3,
@@ -1700,7 +1840,7 @@ sp_fdparam:
(enum enum_field_types) $3,
&spvar->field_def))
{
- YYABORT;
+ MYSQL_YYABORT;
}
spvar->field_def.field_name= spvar->name.str;
spvar->field_def.pack_flag |= FIELDFLAG_MAYBE_NULL;
@@ -1727,7 +1867,7 @@ sp_pdparam:
if (spc->find_variable(&$3, TRUE))
{
my_error(ER_SP_DUP_PARAM, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
sp_variable_t *spvar= spc->push_variable(&$3,
(enum enum_field_types)$4,
@@ -1737,7 +1877,7 @@ sp_pdparam:
(enum enum_field_types) $4,
&spvar->field_def))
{
- YYABORT;
+ MYSQL_YYABORT;
}
spvar->field_def.field_name= spvar->name.str;
spvar->field_def.pack_flag |= FIELDFLAG_MAYBE_NULL;
@@ -1776,13 +1916,13 @@ sp_decls:
{ /* Variable or condition following cursor or handler */
my_message(ER_SP_VARCOND_AFTER_CURSHNDLR,
ER(ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
if ($2.curs && $1.hndlrs)
{ /* Cursor following handler */
my_message(ER_SP_CURSOR_AFTER_HANDLER,
ER(ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
$$.vars= $1.vars + $2.vars;
$$.conds= $1.conds + $2.conds;
@@ -1820,7 +1960,7 @@ sp_decl:
sp_variable_t *spvar= pctx->find_variable(var_idx);
if (!spvar)
- YYABORT;
+ MYSQL_YYABORT;
spvar->type= var_type;
spvar->dflt= dflt_value_item;
@@ -1828,7 +1968,7 @@ sp_decl:
if (lex->sphead->fill_field_definition(YYTHD, lex, var_type,
&spvar->field_def))
{
- YYABORT;
+ MYSQL_YYABORT;
}
spvar->field_def.field_name= spvar->name.str;
@@ -1856,7 +1996,7 @@ sp_decl:
if (spc->find_cond(&$2, TRUE))
{
my_error(ER_SP_DUP_COND, MYF(0), $2.str);
- YYABORT;
+ MYSQL_YYABORT;
}
YYTHD->lex->spcont->push_cond(&$2, $5);
$$.vars= $$.hndlrs= $$.curs= 0;
@@ -1914,7 +2054,7 @@ sp_decl:
{
my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
delete $5;
- YYABORT;
+ MYSQL_YYABORT;
}
i= new sp_instr_cpush(sp->instructions(), ctx, $5,
ctx->current_cursor_count());
@@ -1942,13 +2082,13 @@ sp_cursor_stmt:
{
my_message(ER_SP_BAD_CURSOR_QUERY, ER(ER_SP_BAD_CURSOR_QUERY),
MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->result)
{
my_message(ER_SP_BAD_CURSOR_SELECT, ER(ER_SP_BAD_CURSOR_SELECT),
MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sp_lex_in_use= TRUE;
$$= lex;
@@ -1972,7 +2112,7 @@ sp_hcond_list:
if (ctx->find_handler($1))
{
my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -1993,7 +2133,7 @@ sp_hcond_list:
if (ctx->find_handler($3))
{
my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2019,7 +2159,7 @@ sp_cond:
if (!sp_cond_check(&$3))
{
my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
$$->type= sp_cond_type_t::state;
@@ -2044,7 +2184,7 @@ sp_hcond:
if ($$ == NULL)
{
my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
}
| SQLWARNING_SYM /* SQLSTATEs 01??? */
@@ -2075,7 +2215,7 @@ sp_decl_idents:
if (spc->find_variable(&$1, TRUE))
{
my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
spc->push_variable(&$1, (enum_field_types)0, sp_param_in);
$$= 1;
@@ -2090,7 +2230,7 @@ sp_decl_idents:
if (spc->find_variable(&$3, TRUE))
{
my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
spc->push_variable(&$3, (enum_field_types)0, sp_param_in);
$$= $1 + 1;
@@ -2118,7 +2258,7 @@ sp_proc_stmt:
if (lex->sql_command == SQLCOM_CHANGE_DB)
{ /* "USE db" doesn't work in a procedure */
my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
- YYABORT;
+ MYSQL_YYABORT;
}
/*
Don't add an instruction for SET statements, since all
@@ -2158,7 +2298,7 @@ sp_proc_stmt:
if (sp->m_type != TYPE_ENUM_FUNCTION)
{
my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2199,7 +2339,7 @@ sp_proc_stmt:
if (! lab)
{
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2228,7 +2368,7 @@ sp_proc_stmt:
if (! lab || lab->type != SP_LAB_ITER)
{
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2256,7 +2396,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset))
{
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
- YYABORT;
+ MYSQL_YYABORT;
}
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
sp->add_instr(i);
@@ -2271,7 +2411,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$3, &offset))
{
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
sp->add_instr(i);
@@ -2288,7 +2428,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset))
{
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
- YYABORT;
+ MYSQL_YYABORT;
}
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
sp->add_instr(i);
@@ -2312,7 +2452,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_variable(&$1)))
{
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2333,7 +2473,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_variable(&$3)))
{
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2402,7 +2542,7 @@ simple_case_stmt:
{
LEX *lex= Lex;
if (case_stmt_action_expr(lex, $3))
- YYABORT;
+ MYSQL_YYABORT;
lex->sphead->restore_lex(YYTHD); /* For expr $3 */
}
@@ -2505,7 +2645,7 @@ sp_labeled_control:
if (lab)
{
my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -2526,7 +2666,7 @@ sp_labeled_control:
my_strcasecmp(system_charset_info, $5.str, lab->name) != 0)
{
my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
- YYABORT;
+ MYSQL_YYABORT;
}
}
lex->sphead->backpatch(lex->spcont->pop_label());
@@ -2643,11 +2783,11 @@ create2:
LEX *lex=Lex;
THD *thd= lex->thd;
if (!(lex->name= (char *)$2))
- YYABORT;
+ MYSQL_YYABORT;
if ($2->db.str == NULL &&
thd->copy_db_to(&($2->db.str), &($2->db.length)))
{
- YYABORT;
+ MYSQL_YYABORT;
}
}
| '(' LIKE table_ident ')'
@@ -2655,11 +2795,11 @@ create2:
LEX *lex=Lex;
THD *thd= lex->thd;
if (!(lex->name= (char *)$3))
- YYABORT;
+ MYSQL_YYABORT;
if ($3->db.str == NULL &&
thd->copy_db_to(&($3->db.str), &($3->db.length)))
{
- YYABORT;
+ MYSQL_YYABORT;
}
}
;
@@ -2771,8 +2911,8 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_PACK_KEYS;
break;
default:
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
}
@@ -2788,17 +2928,17 @@ create_table_option:
| RAID_TYPE opt_equal raid_types
{
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_TYPE", "PARTITION");
- YYABORT;
+ MYSQL_YYABORT;
}
| RAID_CHUNKS opt_equal ulong_num
{
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKS", "PARTITION");
- YYABORT;
+ MYSQL_YYABORT;
}
| RAID_CHUNKSIZE opt_equal ulong_num
{
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKSIZE", "PARTITION");
- YYABORT;
+ MYSQL_YYABORT;
}
| UNION_SYM opt_equal '(' table_list ')'
{
@@ -2834,7 +2974,7 @@ default_charset:
my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
"CHARACTER SET ", cinfo->default_table_charset->csname,
"CHARACTER SET ", $4->csname);
- YYABORT;
+ MYSQL_YYABORT;
}
Lex->create_info.default_table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
@@ -2850,7 +2990,7 @@ default_collation:
{
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$4->name, cinfo->default_table_charset->csname);
- YYABORT;
+ MYSQL_YYABORT;
}
Lex->create_info.default_table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
@@ -2862,7 +3002,7 @@ storage_engines:
$$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) {
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
};
@@ -2997,7 +3137,7 @@ field_spec:
&lex->comment,
lex->change,&lex->interval_list,lex->charset,
lex->uint_geom_type))
- YYABORT;
+ MYSQL_YYABORT;
};
type:
@@ -3066,7 +3206,7 @@ type:
#else
my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
- YYABORT;
+ MYSQL_YYABORT;
#endif
}
| MEDIUMBLOB { Lex->charset=&my_charset_bin;
@@ -3227,7 +3367,7 @@ attribute:
{
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$2->name,Lex->charset->csname);
- YYABORT;
+ MYSQL_YYABORT;
}
else
{
@@ -3252,7 +3392,7 @@ charset_name:
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
}
| BINARY { $$= &my_charset_bin; }
@@ -3262,6 +3402,10 @@ charset_name_or_default:
charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
+opt_load_data_charset:
+ /* Empty */ { $$= NULL; }
+ | charset charset_name_or_default { $$= $2; }
+ ;
old_or_new_charset_name:
ident_or_text
@@ -3270,7 +3414,7 @@ old_or_new_charset_name:
!($$=get_old_charset_by_name($1.str)))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
}
| BINARY { $$= &my_charset_bin; }
@@ -3286,7 +3430,7 @@ collation_name:
if (!($$=get_charset_by_name($1.str,MYF(0))))
{
my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
};
@@ -3313,7 +3457,7 @@ opt_binary:
MY_CS_PRIMARY,MYF(0))))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
- YYABORT;
+ MYSQL_YYABORT;
}
}
| charset charset_name opt_bin_mod { Lex->charset=$2; }
@@ -3332,7 +3476,7 @@ opt_bin_charset:
MY_CS_PRIMARY,MYF(0))))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
- YYABORT;
+ MYSQL_YYABORT;
}
}
| charset charset_name { Lex->charset=$2; } ;
@@ -3395,7 +3539,7 @@ key_type:
#else
my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
- YYABORT;
+ MYSQL_YYABORT;
#endif
};
@@ -3428,7 +3572,7 @@ opt_unique_or_fulltext:
#else
my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
- YYABORT;
+ MYSQL_YYABORT;
#endif
}
;
@@ -3488,7 +3632,7 @@ alter:
lex->duplicates= DUP_ERROR;
if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
TL_OPTION_UPDATING))
- YYABORT;
+ MYSQL_YYABORT;
lex->col_list.empty();
lex->select_lex.init_order();
lex->select_lex.db=
@@ -3514,7 +3658,7 @@ alter:
lex->sql_command=SQLCOM_ALTER_DB;
lex->name= $3;
if (lex->name == NULL && thd->copy_db_to(&lex->name, NULL))
- YYABORT;
+ MYSQL_YYABORT;
}
| ALTER PROCEDURE sp_name
{
@@ -3523,7 +3667,7 @@ alter:
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
- YYABORT;
+ MYSQL_YYABORT;
}
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
@@ -3541,7 +3685,7 @@ alter:
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
- YYABORT;
+ MYSQL_YYABORT;
}
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
@@ -3620,7 +3764,7 @@ alter_list_item:
&lex->comment,
$3.str, &lex->interval_list, lex->charset,
lex->uint_geom_type))
- YYABORT;
+ MYSQL_YYABORT;
}
opt_place
| DROP opt_column field_ident opt_restrict
@@ -3681,13 +3825,13 @@ alter_list_item:
if (lex->select_lex.db == NULL &&
thd->copy_db_to(&lex->select_lex.db, NULL))
{
- YYABORT;
+ MYSQL_YYABORT;
}
if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name($3->db.str))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
- YYABORT;
+ MYSQL_YYABORT;
}
lex->name= $3->table.str;
lex->alter_info.flags|= ALTER_RENAME;
@@ -3704,7 +3848,7 @@ alter_list_item:
{
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$5->name, $4->csname);
- YYABORT;
+ MYSQL_YYABORT;
}
LEX *lex= Lex;
lex->create_info.table_charset=
@@ -3842,7 +3986,7 @@ slave_until:
{
my_message(ER_BAD_SLAVE_UNTIL_COND,
ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
}
@@ -3934,7 +4078,7 @@ check:
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
@@ -3994,12 +4138,12 @@ rename_list:
user TO_SYM user
{
if (Lex->users_list.push_back($1) || Lex->users_list.push_back($3))
- YYABORT;
+ MYSQL_YYABORT;
}
| rename_list ',' user TO_SYM user
{
if (Lex->users_list.push_back($3) || Lex->users_list.push_back($5))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -4016,7 +4160,7 @@ table_to_table:
TL_IGNORE) ||
!sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
TL_IGNORE))
- YYABORT;
+ MYSQL_YYABORT;
};
keycache:
@@ -4041,7 +4185,7 @@ assign_to_keycache:
TL_READ,
sel->get_use_index(),
(List<String> *)0))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -4073,7 +4217,7 @@ preload_keys:
TL_READ,
sel->get_use_index(),
(List<String> *)0))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -4128,16 +4272,16 @@ select_paren:
SELECT_LEX * sel= lex->current_select;
if (sel->set_braces(1))
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
if (sel->linkage == UNION_TYPE &&
!sel->master_unit()->first_select()->braces &&
sel->master_unit()->first_select()->linkage ==
UNION_TYPE)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
/* select in braces, can't contain global parameters */
if (sel->master_unit()->fake_select_lex)
@@ -4153,14 +4297,14 @@ select_init2:
SELECT_LEX * sel= lex->current_select;
if (lex->current_select->set_braces(0))
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
if (sel->linkage == UNION_TYPE &&
sel->master_unit()->first_select()->braces)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
}
union_clause
@@ -4209,7 +4353,7 @@ select_options:
if (test_all_bits(Select->options, SELECT_ALL | SELECT_DISTINCT))
{
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT");
- YYABORT;
+ MYSQL_YYABORT;
}
}
;
@@ -4223,7 +4367,7 @@ select_option:
| HIGH_PRIORITY
{
if (check_simple_select())
- YYABORT;
+ MYSQL_YYABORT;
Lex->lock_option= TL_READ_HIGH_PRIORITY;
}
| DISTINCT { Select->options|= SELECT_DISTINCT; }
@@ -4232,13 +4376,13 @@ select_option:
| SQL_BUFFER_RESULT
{
if (check_simple_select())
- YYABORT;
+ MYSQL_YYABORT;
Select->options|= OPTION_BUFFER_RESULT;
}
| SQL_CALC_FOUND_ROWS
{
if (check_simple_select())
- YYABORT;
+ MYSQL_YYABORT;
Select->options|= OPTION_FOUND_ROWS;
}
| SQL_NO_CACHE_SYM
@@ -4287,7 +4431,7 @@ select_item_list:
new Item_field(&thd->lex->current_select->
context,
NULL, NULL, "*")))
- YYABORT;
+ MYSQL_YYABORT;
(thd->lex->current_select->with_wild)++;
};
@@ -4296,7 +4440,7 @@ select_item:
remember_name select_item2 remember_end select_alias
{
if (add_item_to_list(YYTHD, $2))
- YYABORT;
+ MYSQL_YYABORT;
if ($4.str)
{
$2->is_autogenerated_name= FALSE;
@@ -4387,13 +4531,18 @@ bool_factor:
| bool_test ;
bool_test:
- bool_pri IS TRUE_SYM { $$= is_truth_value($1,1,0); }
- | bool_pri IS not TRUE_SYM { $$= is_truth_value($1,0,0); }
- | bool_pri IS FALSE_SYM { $$= is_truth_value($1,0,1); }
- | bool_pri IS not FALSE_SYM { $$= is_truth_value($1,1,1); }
- | bool_pri IS UNKNOWN_SYM { $$= new Item_func_isnull($1); }
- | bool_pri IS not UNKNOWN_SYM { $$= new Item_func_isnotnull($1); }
- | bool_pri ;
+ bool_pri IS TRUE_SYM
+ { $$= new (YYTHD->mem_root) Item_func_istrue($1); }
+ | bool_pri IS not TRUE_SYM
+ { $$= new (YYTHD->mem_root) Item_func_isnottrue($1); }
+ | bool_pri IS FALSE_SYM
+ { $$= new (YYTHD->mem_root) Item_func_isfalse($1); }
+ | bool_pri IS not FALSE_SYM
+ { $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); }
+ | bool_pri IS UNKNOWN_SYM { $$= new Item_func_isnull($1); }
+ | bool_pri IS not UNKNOWN_SYM { $$= new Item_func_isnotnull($1); }
+ | bool_pri
+ ;
bool_pri:
bool_pri IS NULL_SYM { $$= new Item_func_isnull($1); }
@@ -4406,31 +4555,37 @@ bool_pri:
| predicate ;
predicate:
- bit_expr IN_SYM '(' subselect ')'
- { $$= new Item_in_subselect($1, $4); }
- | bit_expr not IN_SYM '(' subselect ')'
- { $$= negate_expression(YYTHD, new Item_in_subselect($1, $5)); }
+ bit_expr IN_SYM '(' subselect ')'
+ {
+ $$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
+ }
+ | bit_expr not IN_SYM '(' subselect ')'
+ {
+ THD *thd= YYTHD;
+ Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
+ $$= negate_expression(thd, item);
+ }
| bit_expr IN_SYM '(' expr ')'
{
- $$= new Item_func_eq($1, $4);
+ $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
}
- | bit_expr IN_SYM '(' expr ',' expr_list ')'
- {
- $6->push_front($4);
- $6->push_front($1);
- $$= new Item_func_in(*$6);
+ | bit_expr IN_SYM '(' expr ',' expr_list ')'
+ {
+ $6->push_front($4);
+ $6->push_front($1);
+ $$= new (YYTHD->mem_root) Item_func_in(*$6);
}
| bit_expr not IN_SYM '(' expr ')'
{
- $$= new Item_func_ne($1, $5);
+ $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
}
- | bit_expr not IN_SYM '(' expr ',' expr_list ')'
+ | bit_expr not IN_SYM '(' expr ',' expr_list ')'
{
- $7->push_front($5);
- $7->push_front($1);
- Item_func_in *item = new Item_func_in(*$7);
- item->negate();
- $$= item;
+ $7->push_front($5);
+ $7->push_front($1);
+ Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
+ item->negate();
+ $$= item;
}
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
{ $$= new Item_func_between($1,$3,$5); }
@@ -4565,7 +4720,7 @@ simple_expr:
lex->dec ? atoi(lex->dec) : 0,
lex->charset);
if (!$$)
- YYABORT;
+ MYSQL_YYABORT;
}
| CASE_SYM opt_expr when_list opt_else END
{ $$= new Item_func_case(* $3, $2, $4 ); }
@@ -4576,7 +4731,7 @@ simple_expr:
Lex->dec ? atoi(Lex->dec) : 0,
Lex->charset);
if (!$$)
- YYABORT;
+ MYSQL_YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }
@@ -4587,7 +4742,7 @@ simple_expr:
Item_splocal *il= static_cast<Item_splocal *>($3);
my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= new Item_default_value(Lex->current_context(), $3);
}
@@ -4600,7 +4755,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name,
$1.symbol->group->needed_define);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= ((Item*(*)(void))($1.symbol->create_func))();
}
@@ -4611,7 +4766,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name,
$1.symbol->group->needed_define);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= ((Item*(*)(Item*))($1.symbol->create_func))($3);
}
@@ -4622,7 +4777,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name,
$1.symbol->group->needed_define);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5);
}
@@ -4633,7 +4788,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name,
$1.symbol->group->needed_define);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7);
}
@@ -4664,7 +4819,7 @@ simple_expr:
| CONVERT_TZ_SYM '(' expr ',' expr ',' expr ')'
{
if (Lex->add_time_zone_tables_to_query_tables(YYTHD))
- YYABORT;
+ MYSQL_YYABORT;
$$= new Item_func_convert_tz($3, $5, $7);
}
| CURDATE optional_braces
@@ -4739,7 +4894,7 @@ simple_expr:
#else
my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
- YYABORT;
+ MYSQL_YYABORT;
#endif
}
| GET_FORMAT '(' date_time_type ',' expr ')'
@@ -4757,8 +4912,8 @@ simple_expr:
{
if ($1->type() != Item::ROW_ITEM)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
$$= new Item_func_interval((Item_row *)$1);
}
@@ -4918,8 +5073,8 @@ simple_expr:
{
if (lex->current_select->inc_in_sum_expr())
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
}
lex->current_select->udf_list.push_front(udf);
@@ -4927,9 +5082,9 @@ simple_expr:
}
udf_expr_list ')'
{
+ LEX *lex= Lex;
#ifdef HAVE_DLOPEN
udf_func *udf;
- LEX *lex= Lex;
if (NULL != (udf= lex->current_select->udf_list.pop()))
{
@@ -5002,17 +5157,16 @@ simple_expr:
}
break;
default:
- YYABORT;
+ MYSQL_YYABORT;
}
}
else
#endif /* HAVE_DLOPEN */
{
- LEX *lex= Lex;
THD *thd= lex->thd;
LEX_STRING db;
if (thd->copy_db_to(&db.str, &db.length))
- YYABORT;
+ MYSQL_YYABORT;
sp_name *name= new sp_name(db, $1);
if (name)
name->init_qname(thd);
@@ -5173,8 +5327,8 @@ udf_expr:
Disallow using AS to specify explicit names for the arguments
of stored routine calls
*/
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
$2->is_autogenerated_name= FALSE;
@@ -5253,7 +5407,7 @@ variable:
if (! Lex->parsing_options.allows_variable)
{
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
}
variable_aux
@@ -5279,11 +5433,11 @@ variable_aux:
{
if ($3.str && $4.str && check_reserved_words(&$3))
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
if (!($$= get_system_var(YYTHD, $2, $3, $4)))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -5317,8 +5471,8 @@ in_sum_expr:
LEX *lex= Lex;
if (lex->current_select->inc_in_sum_expr())
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
}
expr
@@ -5398,12 +5552,12 @@ table_ref:
{
LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd)))
- YYABORT;
+ MYSQL_YYABORT;
}
;
join_table_list:
- derived_table_list { YYERROR_UNLESS($$=$1); }
+ derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); }
;
/* Warning - may return NULL in case of incomplete SELECT */
@@ -5411,7 +5565,7 @@ derived_table_list:
table_ref { $$=$1; }
| derived_table_list ',' table_ref
{
- YYERROR_UNLESS($1 && ($$=$3));
+ MYSQL_YYABORT_UNLESS($1 && ($$=$3));
}
;
@@ -5430,16 +5584,16 @@ join_table:
left-associative joins.
*/
table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
- { YYERROR_UNLESS($1 && ($$=$3)); }
+ { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor
- { YYERROR_UNLESS($1 && ($$=$3)); $3->straight=1; }
+ { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
| table_ref normal_join table_ref
ON
{
- YYERROR_UNLESS($1 && $3);
+ MYSQL_YYABORT_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3))
- YYABORT;
+ MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
expr
@@ -5451,10 +5605,10 @@ join_table:
| table_ref STRAIGHT_JOIN table_factor
ON
{
- YYERROR_UNLESS($1 && $3);
+ MYSQL_YYABORT_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3))
- YYABORT;
+ MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
expr
@@ -5467,14 +5621,13 @@ join_table:
| table_ref normal_join table_ref
USING
{
- SELECT_LEX *sel= Select;
- YYERROR_UNLESS($1 && $3);
+ MYSQL_YYABORT_UNLESS($1 && $3);
}
'(' using_list ')'
{ add_join_natural($1,$3,$7,Select); $$=$3; }
| table_ref NATURAL JOIN_SYM table_factor
{
- YYERROR_UNLESS($1 && ($$=$4));
+ MYSQL_YYABORT_UNLESS($1 && ($$=$4));
add_join_natural($1,$4,NULL,Select);
}
@@ -5482,10 +5635,10 @@ join_table:
| table_ref LEFT opt_outer JOIN_SYM table_ref
ON
{
- YYERROR_UNLESS($1 && $5);
+ MYSQL_YYABORT_UNLESS($1 && $5);
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $5))
- YYABORT;
+ MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
expr
@@ -5498,8 +5651,7 @@ join_table:
}
| table_ref LEFT opt_outer JOIN_SYM table_factor
{
- SELECT_LEX *sel= Select;
- YYERROR_UNLESS($1 && $5);
+ MYSQL_YYABORT_UNLESS($1 && $5);
}
USING '(' using_list ')'
{
@@ -5509,7 +5661,7 @@ join_table:
}
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
{
- YYERROR_UNLESS($1 && $6);
+ MYSQL_YYABORT_UNLESS($1 && $6);
add_join_natural($1,$6,NULL,Select);
$6->outer_join|=JOIN_TYPE_LEFT;
$$=$6;
@@ -5519,40 +5671,39 @@ join_table:
| table_ref RIGHT opt_outer JOIN_SYM table_ref
ON
{
- YYERROR_UNLESS($1 && $5);
+ MYSQL_YYABORT_UNLESS($1 && $5);
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $5))
- YYABORT;
+ MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
expr
{
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
- YYABORT;
+ MYSQL_YYABORT;
add_join_on($$, $8);
Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
| table_ref RIGHT opt_outer JOIN_SYM table_factor
{
- SELECT_LEX *sel= Select;
- YYERROR_UNLESS($1 && $5);
+ MYSQL_YYABORT_UNLESS($1 && $5);
}
USING '(' using_list ')'
{
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
- YYABORT;
+ MYSQL_YYABORT;
add_join_natural($$,$5,$9,Select);
}
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
{
- YYERROR_UNLESS($1 && $6);
+ MYSQL_YYABORT_UNLESS($1 && $6);
add_join_natural($6,$1,NULL,Select);
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
- YYABORT;
+ MYSQL_YYABORT;
};
normal_join:
@@ -5577,7 +5728,7 @@ table_factor:
lex->lock_option,
sel->get_use_index(),
sel->get_ignore_index())))
- YYABORT;
+ MYSQL_YYABORT;
sel->add_joined_table($$);
}
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref
@@ -5585,19 +5736,19 @@ table_factor:
{
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $3, $7))
- YYABORT;
+ MYSQL_YYABORT;
}
expr '}'
{
LEX *lex= Lex;
- YYERROR_UNLESS($3 && $7);
+ MYSQL_YYABORT_UNLESS($3 && $7);
add_join_on($7,$10);
Lex->pop_context();
$7->outer_join|=JOIN_TYPE_LEFT;
$$=$7;
if (!($$= lex->current_select->nest_last_join(lex->thd)))
- YYABORT;
+ MYSQL_YYABORT;
}
| select_derived_init get_select_lex select_derived2
{
@@ -5607,8 +5758,8 @@ table_factor:
{
if (sel->set_braces(1))
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
/* select in braces, can't contain global parameters */
if (sel->master_unit()->fake_select_lex)
@@ -5616,7 +5767,7 @@ table_factor:
sel->master_unit()->fake_select_lex;
}
if ($2->init_nested_join(lex->thd))
- YYABORT;
+ MYSQL_YYABORT;
$$= 0;
/* incomplete derived tables return NULL, we must be
nested in select_derived rule to be here. */
@@ -5650,7 +5801,7 @@ table_factor:
TL_READ,(List<String> *)0,
(List<String> *)0)))
- YYABORT;
+ MYSQL_YYABORT;
sel->add_joined_table($$);
lex->pop_context();
}
@@ -5658,8 +5809,8 @@ table_factor:
if ($4 || $6)
{
/* simple nested joins cannot have aliases or unions */
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
else
$$= $3;
@@ -5672,7 +5823,7 @@ select_derived:
{
LEX *lex= Lex;
if ($1->init_nested_join(lex->thd))
- YYABORT;
+ MYSQL_YYABORT;
}
derived_table_list
{
@@ -5681,11 +5832,11 @@ select_derived:
for derived tables, both must equal NULL */
if (!($$= $1->end_nested_join(lex->thd)) && $3)
- YYABORT;
+ MYSQL_YYABORT;
if (!$3 && $$)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
}
;
@@ -5697,12 +5848,12 @@ select_derived2:
if (lex->sql_command == (int)SQLCOM_HA_READ ||
lex->sql_command == (int)SQLCOM_KILL)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
mysql_new_select(lex, 1))
- YYABORT;
+ MYSQL_YYABORT;
mysql_init_select(lex);
lex->current_select->linkage= DERIVED_TABLE_TYPE;
lex->current_select->parsing_place= SELECT_LIST;
@@ -5726,7 +5877,7 @@ select_derived_init:
if (! lex->parsing_options.allows_derived)
{
my_error(ER_VIEW_SELECT_DERIVED, MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
SELECT_LEX *sel= lex->current_select;
@@ -5734,8 +5885,8 @@ select_derived_init:
if (!sel->embedding || sel->end_nested_join(lex->thd))
{
/* we are not in parentheses */
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
embedding= Select->embedding;
$$= embedding &&
@@ -5748,6 +5899,10 @@ opt_outer:
/* empty */ {}
| OUTER {};
+opt_for_join:
+ /* empty */
+ | FOR_SYM JOIN_SYM;
+
opt_key_definition:
/* empty */ {}
| USE_SYM key_usage_list
@@ -5763,15 +5918,20 @@ opt_key_definition:
sel->use_index_ptr= &sel->use_index;
sel->table_join_options|= TL_OPTION_FORCE_INDEX;
}
- | IGNORE_SYM key_usage_list
+ | IGNORE_SYM key_or_index opt_for_join key_usage_list_inner
{
SELECT_LEX *sel= Select;
- sel->ignore_index= *$2;
+ sel->ignore_index= *$4;
sel->ignore_index_ptr= &sel->ignore_index;
};
key_usage_list:
- key_or_index { Select->interval_list.empty(); }
+ key_or_index key_usage_list_inner
+ { $$= $2; }
+ ;
+
+key_usage_list_inner:
+ { Select->interval_list.empty(); }
'(' key_list_or_empty ')'
{ $$= &Select->interval_list; }
;
@@ -5799,7 +5959,7 @@ using_list:
ident
{
if (!($$= new List<String>))
- YYABORT;
+ MYSQL_YYABORT;
$$->push_back(new (YYTHD->mem_root)
String((const char *) $1.str, $1.length,
system_charset_info));
@@ -5919,9 +6079,9 @@ group_clause:
group_list:
group_list ',' order_ident order_dir
- { if (add_group_to_list(YYTHD, $3,(bool) $4)) YYABORT; }
+ { if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
| order_ident order_dir
- { if (add_group_to_list(YYTHD, $1,(bool) $2)) YYABORT; };
+ { if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; };
olap_opt:
/* empty */ {}
@@ -5932,11 +6092,11 @@ olap_opt:
{
my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
"global union parameters");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->current_select->olap= CUBE_TYPE;
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
- YYABORT; /* To be deleted in 5.1 */
+ MYSQL_YYABORT; /* To be deleted in 5.1 */
}
| WITH ROLLUP_SYM
{
@@ -5945,7 +6105,7 @@ olap_opt:
{
my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
"global union parameters");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->current_select->olap= ROLLUP_TYPE;
}
@@ -5970,7 +6130,7 @@ alter_order_item:
THD *thd= YYTHD;
bool ascending= ($2 == 1) ? true : false;
if (add_order_to_list(thd, $1, ascending))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -5993,7 +6153,7 @@ order_clause:
{
my_error(ER_WRONG_USAGE, MYF(0),
"CUBE/ROLLUP", "ORDER BY");
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
{
@@ -6010,15 +6170,15 @@ order_clause:
(first_sl->order_list.elements ||
first_sl->select_limit) &&
unit->add_fake_select_lex(lex->thd))
- YYABORT;
+ MYSQL_YYABORT;
}
} order_list;
order_list:
order_list ',' order_ident order_dir
- { if (add_order_to_list(YYTHD, $3,(bool) $4)) YYABORT; }
+ { if (add_order_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
| order_ident order_dir
- { if (add_order_to_list(YYTHD, $1,(bool) $2)) YYABORT; };
+ { if (add_order_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; };
order_dir:
/* empty */ { $$ = 1; }
@@ -6115,13 +6275,13 @@ procedure_clause:
if (! lex->parsing_options.allows_select_procedure)
{
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "PROCEDURE");
- YYABORT;
+ MYSQL_YYABORT;
}
if (&lex->select_lex != lex->current_select)
{
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->proc_list.elements=0;
lex->proc_list.first=0;
@@ -6130,7 +6290,7 @@ procedure_clause:
current_select->
context,
NULL,NULL,$2.str)))
- YYABORT;
+ MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
}
'(' procedure_list ')';
@@ -6149,7 +6309,7 @@ procedure_item:
{
LEX *lex= Lex;
if (add_proc_to_list(lex->thd, $2))
- YYABORT;
+ MYSQL_YYABORT;
if (!$2->name)
$2->set_name($1,(uint) ((char*) lex->tok_end - $1),
YYTHD->charset());
@@ -6161,7 +6321,7 @@ select_var_list_init:
{
LEX *lex=Lex;
if (!lex->describe && (!(lex->result= new select_dumpvar())))
- YYABORT;
+ MYSQL_YYABORT;
}
select_var_list
{}
@@ -6193,7 +6353,7 @@ select_var_ident:
if (!lex->spcont || !(t=lex->spcont->find_variable(&$1)))
{
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->result)
{
@@ -6222,7 +6382,7 @@ into:
if (! Lex->parsing_options.allows_select_into)
{
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO");
- YYABORT;
+ MYSQL_YYABORT;
}
}
into_destination
@@ -6235,7 +6395,7 @@ into_destination:
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
if (!(lex->exchange= new sql_exchange($2.str, 0)) ||
!(lex->result= new select_export(lex->exchange)))
- YYABORT;
+ MYSQL_YYABORT;
}
opt_field_term opt_line_term
| DUMPFILE TEXT_STRING_filesystem
@@ -6245,9 +6405,9 @@ into_destination:
{
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
if (!(lex->exchange= new sql_exchange($2.str,1)))
- YYABORT;
+ MYSQL_YYABORT;
if (!(lex->result= new select_dump(lex->exchange)))
- YYABORT;
+ MYSQL_YYABORT;
}
}
| select_var_list_init
@@ -6294,7 +6454,7 @@ drop:
$3.str));
if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
TL_OPTION_UPDATING))
- YYABORT;
+ MYSQL_YYABORT;
}
| DROP DATABASE if_exists ident
{
@@ -6309,7 +6469,7 @@ drop:
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_DROP_FUNCTION;
lex->drop_if_exists= $3;
@@ -6321,7 +6481,7 @@ drop:
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_DROP_PROCEDURE;
lex->drop_if_exists= $3;
@@ -6354,7 +6514,7 @@ table_name:
table_ident
{
if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -6452,7 +6612,7 @@ insert_field_spec:
LEX *lex=Lex;
if (!(lex->insert_list = new List_item) ||
lex->many_values.push_back(lex->insert_list))
- YYABORT;
+ MYSQL_YYABORT;
}
ident_eq_list;
@@ -6482,7 +6642,7 @@ ident_eq_value:
LEX *lex=Lex;
if (lex->field_list.push_back($1) ||
lex->insert_list->push_back($3))
- YYABORT;
+ MYSQL_YYABORT;
};
equal: EQ {}
@@ -6498,13 +6658,13 @@ no_braces:
'('
{
if (!(Lex->insert_list = new List_item))
- YYABORT;
+ MYSQL_YYABORT;
}
opt_values ')'
{
LEX *lex=Lex;
if (lex->many_values.push_back(lex->insert_list))
- YYABORT;
+ MYSQL_YYABORT;
};
opt_values:
@@ -6515,12 +6675,12 @@ values:
values ',' expr_or_default
{
if (Lex->insert_list->push_back($3))
- YYABORT;
+ MYSQL_YYABORT;
}
| expr_or_default
{
if (Lex->insert_list->push_back($1))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -6557,7 +6717,7 @@ update:
/* it is single table update and it is update of derived table */
my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
lex->select_lex.get_table_list()->alias, "UPDATE");
- YYABORT;
+ MYSQL_YYABORT;
}
/*
In case of multi-update setting write lock for all tables may
@@ -6577,7 +6737,7 @@ update_elem:
simple_ident_nospvar equal expr_or_default
{
if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3))
- YYABORT;
+ MYSQL_YYABORT;
};
insert_update_list:
@@ -6590,7 +6750,7 @@ insert_update_elem:
LEX *lex= Lex;
if (lex->update_list.push_back($1) ||
lex->value_list.push_back($3))
- YYABORT;
+ MYSQL_YYABORT;
};
opt_low_priority:
@@ -6617,7 +6777,7 @@ single_multi:
{
if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING,
Lex->lock_option))
- YYABORT;
+ MYSQL_YYABORT;
}
where_clause opt_order_clause
delete_limit_clause {}
@@ -6626,14 +6786,14 @@ single_multi:
FROM join_table_list where_clause
{
if (multi_delete_set_locks_and_link_aux_tables(Lex))
- YYABORT;
+ MYSQL_YYABORT;
}
| FROM table_wild_list
{ mysql_init_multi_delete(Lex); }
USING join_table_list where_clause
{
if (multi_delete_set_locks_and_link_aux_tables(Lex))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -6647,7 +6807,7 @@ table_wild_one:
if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3,
TL_OPTION_UPDATING |
TL_OPTION_ALIAS, Lex->lock_option))
- YYABORT;
+ MYSQL_YYABORT;
}
| ident '.' ident opt_wild opt_table_alias
{
@@ -6657,7 +6817,7 @@ table_wild_one:
TL_OPTION_UPDATING |
TL_OPTION_ALIAS,
Lex->lock_option))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -6712,7 +6872,7 @@ show_param:
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_DATABASES;
if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA))
- YYABORT;
+ MYSQL_YYABORT;
}
| opt_full TABLES opt_db wild_and_where
{
@@ -6721,7 +6881,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_TABLES;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
- YYABORT;
+ MYSQL_YYABORT;
}
| opt_full TRIGGERS_SYM opt_db wild_and_where
{
@@ -6730,7 +6890,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_TRIGGERS;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS))
- YYABORT;
+ MYSQL_YYABORT;
}
| TABLE_SYM STATUS_SYM opt_db wild_and_where
{
@@ -6739,7 +6899,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_TABLE_STATUS;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES))
- YYABORT;
+ MYSQL_YYABORT;
}
| OPEN_SYM TABLES opt_db wild_and_where
{
@@ -6748,7 +6908,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_OPEN_TABLES;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
- YYABORT;
+ MYSQL_YYABORT;
}
| ENGINE_SYM storage_engines
{ Lex->create_info.db_type= $2; }
@@ -6761,7 +6921,7 @@ show_param:
if ($5)
$4->change_db($5);
if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
- YYABORT;
+ MYSQL_YYABORT;
}
| NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ
TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num
@@ -6794,7 +6954,7 @@ show_param:
if ($4)
$3->change_db($4);
if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS))
- YYABORT;
+ MYSQL_YYABORT;
}
| COLUMN_SYM TYPES_SYM
{
@@ -6832,7 +6992,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_STATUS;
lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
- YYABORT;
+ MYSQL_YYABORT;
}
| INNOBASE_SYM STATUS_SYM
{ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; WARN_DEPRECATED("SHOW INNODB STATUS", "SHOW ENGINE INNODB STATUS"); }
@@ -6847,7 +7007,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_VARIABLES;
lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES))
- YYABORT;
+ MYSQL_YYABORT;
}
| charset wild_and_where
{
@@ -6855,7 +7015,7 @@ show_param:
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_CHARSETS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS))
- YYABORT;
+ MYSQL_YYABORT;
}
| COLLATION_SYM wild_and_where
{
@@ -6863,7 +7023,7 @@ show_param:
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_COLLATIONS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS))
- YYABORT;
+ MYSQL_YYABORT;
}
| BERKELEY_DB_SYM LOGS_SYM
{ Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); }
@@ -6875,7 +7035,7 @@ show_param:
lex->sql_command= SQLCOM_SHOW_GRANTS;
LEX_USER *curr_user;
if (!(curr_user= (LEX_USER*) lex->thd->alloc(sizeof(st_lex_user))))
- YYABORT;
+ MYSQL_YYABORT;
bzero(curr_user, sizeof(st_lex_user));
lex->grant_user= curr_user;
}
@@ -6897,7 +7057,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE;
if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0))
- YYABORT;
+ MYSQL_YYABORT;
lex->only_view= 0;
}
| CREATE VIEW_SYM table_ident
@@ -6905,7 +7065,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE;
if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0))
- YYABORT;
+ MYSQL_YYABORT;
lex->only_view= 1;
}
| MASTER_SYM STATUS_SYM
@@ -6936,9 +7096,9 @@ show_param:
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_STATUS_PROC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
- YYABORT;
+ MYSQL_YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
- YYABORT;
+ MYSQL_YYABORT;
}
| FUNCTION_SYM STATUS_SYM wild_and_where
{
@@ -6946,15 +7106,15 @@ show_param:
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_STATUS_FUNC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
- YYABORT;
+ MYSQL_YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
- YYABORT;
+ MYSQL_YYABORT;
}
| PROCEDURE CODE_SYM sp_name
{
#ifdef DBUG_OFF
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
#else
Lex->sql_command= SQLCOM_SHOW_PROC_CODE;
Lex->spname= $3;
@@ -6963,8 +7123,8 @@ show_param:
| FUNCTION_SYM CODE_SYM sp_name
{
#ifdef DBUG_OFF
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
#else
Lex->sql_command= SQLCOM_SHOW_FUNC_CODE;
Lex->spname= $3;
@@ -6984,7 +7144,7 @@ show_engine_param:
break;
default:
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
- YYABORT;
+ MYSQL_YYABORT;
}
}
| LOGS_SYM
@@ -6995,7 +7155,7 @@ show_engine_param:
break;
default:
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LOGS");
- YYABORT;
+ MYSQL_YYABORT;
}
};
@@ -7054,7 +7214,7 @@ describe:
lex->select_lex.db= 0;
lex->verbose= 0;
if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS))
- YYABORT;
+ MYSQL_YYABORT;
}
opt_describe_column {}
| describe_command opt_extended_describe
@@ -7196,7 +7356,7 @@ load: LOAD DATA_SYM
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->fname_start= lex->ptr;
}
@@ -7209,14 +7369,14 @@ load: LOAD DATA_SYM
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
WARN_DEPRECATED("LOAD TABLE FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
- YYABORT;
+ MYSQL_YYABORT;
};
load_data:
@@ -7229,7 +7389,7 @@ load_data:
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
if (!(lex->exchange= new sql_exchange($4.str, 0)))
- YYABORT;
+ MYSQL_YYABORT;
}
opt_duplicate INTO
{
@@ -7241,11 +7401,13 @@ load_data:
LEX *lex=Lex;
if (!Select->add_table_to_list(YYTHD, $10, NULL, TL_OPTION_UPDATING,
lex->lock_option))
- YYABORT;
+ MYSQL_YYABORT;
lex->field_list.empty();
lex->update_list.empty();
lex->value_list.empty();
}
+ opt_load_data_charset
+ { Lex->exchange->cs= $12; }
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
{}
@@ -7418,13 +7580,13 @@ param_marker:
if (! lex->parsing_options.allows_variable)
{
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query));
if (!($$= item) || lex->param_list.push_back(item))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
}
;
@@ -7490,7 +7652,7 @@ NUM_literal:
$$= new Item_decimal($1.str, $1.length, YYTHD->charset());
if (YYTHD->net.report_error)
{
- YYABORT;
+ MYSQL_YYABORT;
}
}
| FLOAT_NUM
@@ -7498,7 +7660,7 @@ NUM_literal:
$$ = new Item_float($1.str, $1.length);
if (YYTHD->net.report_error)
{
- YYABORT;
+ MYSQL_YYABORT;
}
}
;
@@ -7543,7 +7705,7 @@ simple_ident:
if (! lex->parsing_options.allows_variable)
{
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
Item_splocal *splocal;
@@ -7603,14 +7765,14 @@ simple_ident_q:
!new_row)
{
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT");
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->trg_chistics.event == TRG_EVENT_DELETE &&
new_row)
{
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE");
- YYABORT;
+ MYSQL_YYABORT;
}
DBUG_ASSERT(!new_row ||
@@ -7625,7 +7787,7 @@ simple_ident_q:
$3.str,
SELECT_ACL,
read_only)))
- YYABORT;
+ MYSQL_YYABORT;
/*
Let us add this item to list of all Item_trigger_field objects
@@ -7696,13 +7858,13 @@ field_ident:
if (my_strcasecmp(table_alias_charset, $1.str, table->db))
{
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
if (my_strcasecmp(table_alias_charset, $3.str,
table->table_name))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str);
- YYABORT;
+ MYSQL_YYABORT;
}
$$=$5;
}
@@ -7712,7 +7874,7 @@ field_ident:
if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
- YYABORT;
+ MYSQL_YYABORT;
}
$$=$3;
}
@@ -7744,7 +7906,7 @@ IDENT_sys:
{
my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
cs->csname, $1.str + wlen);
- YYABORT;
+ MYSQL_YYABORT;
}
$$= $1;
}
@@ -7821,32 +7983,32 @@ user:
{
THD *thd= YYTHD;
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- YYABORT;
+ MYSQL_YYABORT;
$$->user = $1;
$$->host.str= (char *) "%";
$$->host.length= 1;
if (check_string_length(&$$->user,
ER(ER_USERNAME), USERNAME_LENGTH))
- YYABORT;
+ MYSQL_YYABORT;
}
| ident_or_text '@' ident_or_text
{
THD *thd= YYTHD;
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- YYABORT;
+ MYSQL_YYABORT;
$$->user = $1; $$->host=$3;
if (check_string_length(&$$->user,
ER(ER_USERNAME), USERNAME_LENGTH) ||
check_string_length(&$$->host,
ER(ER_HOSTNAME), HOSTNAME_LENGTH))
- YYABORT;
+ MYSQL_YYABORT;
}
| CURRENT_USER optional_braces
{
if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user))))
- YYABORT;
+ MYSQL_YYABORT;
/*
empty LEX_USER means current_user and
will be handled in the get_current_user() function
@@ -7931,6 +8093,7 @@ keyword_sp:
| COMPACT_SYM {}
| COMPRESSED_SYM {}
| CONCURRENT {}
+ | CONNECTION_SYM {}
| CONSISTENT_SYM {}
| CUBE_SYM {}
| DATA_SYM {}
@@ -8188,7 +8351,7 @@ option_type_value:
if (!(i= new sp_instr_stmt(sp->instructions(), lex->spcont,
lex)))
- YYABORT;
+ MYSQL_YYABORT;
/*
Extract the query statement from the tokenizer. The
@@ -8201,7 +8364,7 @@ option_type_value:
qbuff.length= lex->tok_end - sp->m_tmp_query;
if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5)))
- YYABORT;
+ MYSQL_YYABORT;
strmake(strmake(qbuff.str, "SET ", 4), (char *)sp->m_tmp_query,
qbuff.length);
@@ -8257,8 +8420,8 @@ sys_option_value:
LINT_INIT(sp_fld);
if ($1)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
if ($4)
it= $4;
@@ -8280,7 +8443,7 @@ sys_option_value:
lex->spcont,
trg_fld,
it, lex)))
- YYABORT;
+ MYSQL_YYABORT;
/*
Let us add this item to list of all Item_trigger_field
@@ -8307,8 +8470,8 @@ sys_option_value:
Item *it;
if ($1)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
spv= ctx->find_variable(&$2.base_name);
@@ -8364,9 +8527,9 @@ option_value:
if (spc && spc->find_variable(&names))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
else
- yyerror(ER(ER_SYNTAX_ERROR));
+ my_parse_error(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ MYSQL_YYABORT;
}
| NAMES_SYM charset_name_or_default opt_collate
{
@@ -8377,7 +8540,7 @@ option_value:
{
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$3->name, $2->csname);
- YYABORT;
+ MYSQL_YYABORT;
}
lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
}
@@ -8394,10 +8557,10 @@ option_value:
if (spc && spc->find_variable(&pw))
{
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str);
- YYABORT;
+ MYSQL_YYABORT;
}
if (!(user=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
- YYABORT;
+ MYSQL_YYABORT;
user->host=null_lex_str;
user->user.str=thd->security_ctx->priv_user;
thd->lex->var_list.push_back(new set_var_password(user, $3));
@@ -8421,7 +8584,7 @@ internal_variable_name:
/* Not an SP local variable */
sys_var *tmp=find_sys_var($1.str, $1.length);
if (!tmp)
- YYABORT;
+ MYSQL_YYABORT;
$$.var= tmp;
$$.base_name= null_lex_str;
/*
@@ -8430,7 +8593,7 @@ internal_variable_name:
*/
if (tmp == &sys_time_zone &&
lex->add_time_zone_tables_to_query_tables(YYTHD))
- YYABORT;
+ MYSQL_YYABORT;
else if (spc && tmp == &sys_autocommit)
{
/*
@@ -8452,8 +8615,8 @@ internal_variable_name:
LEX *lex= Lex;
if (check_reserved_words(&$1))
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER &&
(!my_strcasecmp(system_charset_info, $1.str, "NEW") ||
@@ -8462,18 +8625,18 @@ internal_variable_name:
if ($1.str[0]=='O' || $1.str[0]=='o')
{
my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", "");
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->trg_chistics.event == TRG_EVENT_DELETE)
{
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0),
"NEW", "on DELETE");
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->trg_chistics.action_time == TRG_ACTION_AFTER)
{
my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after ");
- YYABORT;
+ MYSQL_YYABORT;
}
/* This special combination will denote field of NEW row */
$$.var= &trg_new_row_fake_var;
@@ -8483,7 +8646,7 @@ internal_variable_name:
{
sys_var *tmp=find_sys_var($3.str, $3.length);
if (!tmp)
- YYABORT;
+ MYSQL_YYABORT;
if (!tmp->is_struct())
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp;
@@ -8494,7 +8657,7 @@ internal_variable_name:
{
sys_var *tmp=find_sys_var($3.str, $3.length);
if (!tmp)
- YYABORT;
+ MYSQL_YYABORT;
if (!tmp->is_struct())
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp;
@@ -8546,7 +8709,7 @@ lock:
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_LOCK_TABLES;
}
@@ -8566,7 +8729,7 @@ table_lock:
table_ident opt_table_alias lock_option
{
if (!Select->add_table_to_list(YYTHD, $1, $2, 0, (thr_lock_type) $3))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -8585,7 +8748,7 @@ unlock:
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_UNLOCK_TABLES;
}
@@ -8605,11 +8768,11 @@ handler:
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_HA_OPEN;
if (!lex->current_select->add_table_to_list(lex->thd, $2, $4, 0))
- YYABORT;
+ MYSQL_YYABORT;
}
| HANDLER_SYM table_ident_nodb CLOSE_SYM
{
@@ -8617,11 +8780,11 @@ handler:
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_HA_CLOSE;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
- YYABORT;
+ MYSQL_YYABORT;
}
| HANDLER_SYM table_ident_nodb READ_SYM
{
@@ -8629,14 +8792,14 @@ handler:
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
lex->current_select->select_limit= new Item_int((int32) 1);
lex->current_select->offset_limit= 0;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
- YYABORT;
+ MYSQL_YYABORT;
}
handler_read_or_scan where_clause opt_limit_clause {}
;
@@ -8662,7 +8825,7 @@ handler_rkey_function:
lex->ha_read_mode = RKEY;
lex->ha_rkey_mode=$1;
if (!(lex->insert_list = new List_item))
- YYABORT;
+ MYSQL_YYABORT;
} '(' values ')' { }
;
@@ -8694,8 +8857,8 @@ revoke_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_REVOKE;
lex->type= TYPE_ENUM_FUNCTION;
@@ -8707,8 +8870,8 @@ revoke_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_REVOKE;
lex->type= TYPE_ENUM_PROCEDURE;
@@ -8740,8 +8903,8 @@ grant_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_GRANT;
lex->type= TYPE_ENUM_FUNCTION;
@@ -8753,8 +8916,8 @@ grant_command:
LEX *lex= Lex;
if (lex->columns.elements)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_GRANT;
lex->type= TYPE_ENUM_PROCEDURE;
@@ -8831,7 +8994,7 @@ require_list_element:
if (lex->x509_subject)
{
my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->x509_subject=$2.str;
}
@@ -8841,7 +9004,7 @@ require_list_element:
if (lex->x509_issuer)
{
my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->x509_issuer=$2.str;
}
@@ -8851,7 +9014,7 @@ require_list_element:
if (lex->ssl_cipher)
{
my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->ssl_cipher=$2.str;
}
@@ -8863,14 +9026,14 @@ grant_ident:
LEX *lex= Lex;
THD *thd= lex->thd;
if (thd->copy_db_to(&lex->current_select->db, NULL))
- YYABORT;
+ MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
{
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
}
| ident '.' '*'
@@ -8883,7 +9046,7 @@ grant_ident:
{
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
}
| '*' '.' '*'
@@ -8896,14 +9059,14 @@ grant_ident:
{
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
- YYABORT;
+ MYSQL_YYABORT;
}
}
| table_ident
{
LEX *lex=Lex;
if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,0))
- YYABORT;
+ MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
lex->grant = TABLE_ACLS & ~GRANT_ACL;
}
@@ -8911,21 +9074,21 @@ grant_ident:
user_list:
- user { if (Lex->users_list.push_back($1)) YYABORT;}
+ user { if (Lex->users_list.push_back($1)) MYSQL_YYABORT;}
| user_list ',' user
{
if (Lex->users_list.push_back($3))
- YYABORT;
+ MYSQL_YYABORT;
}
;
grant_list:
- grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
+ grant_user { if (Lex->users_list.push_back($1)) MYSQL_YYABORT;}
| grant_list ',' grant_user
{
if (Lex->users_list.push_back($3))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -9148,17 +9311,17 @@ union_list:
{
/* Only the last SELECT can have INTO...... */
my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
- YYABORT;
+ MYSQL_YYABORT;
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
/* This counter shouldn't be incremented for UNION parts */
Lex->nest_level--;
if (mysql_new_select(lex, 0))
- YYABORT;
+ MYSQL_YYABORT;
mysql_init_select(lex);
lex->current_select->linkage=UNION_TYPE;
if ($2) /* UNION DISTINCT - remember position */
@@ -9223,7 +9386,6 @@ subselect:
}
| '(' subselect_start subselect ')'
{
- LEX *lex= Lex;
THD *thd= YYTHD;
/*
note that a local variable can't be used for
@@ -9253,8 +9415,8 @@ subselect_start:
if (lex->sql_command == (int)SQLCOM_HA_READ ||
lex->sql_command == (int)SQLCOM_KILL)
{
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
}
/*
we are making a "derived table" for the parenthesis
@@ -9264,7 +9426,7 @@ subselect_start:
SELECT * FROM ((SELECT ...) UNION ...)
*/
if (mysql_new_select(Lex, 1))
- YYABORT;
+ MYSQL_YYABORT;
};
subselect_end:
@@ -9275,6 +9437,12 @@ subselect_end:
lex->current_select = lex->current_select->return_after_parsing();
lex->nest_level--;
lex->current_select->n_child_sum_items += child->n_sum_items;
+ /*
+ A subselect can add fields to an outer select. Reserve space for
+ them.
+ */
+ lex->current_select->select_n_where_fields+=
+ child->select_n_where_fields;
};
/**************************************************************************
@@ -9376,7 +9544,7 @@ view_tail:
lex->sql_command= SQLCOM_CREATE_VIEW;
/* first table in list is target VIEW name */
if (!lex->select_lex.add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING))
- YYABORT;
+ MYSQL_YYABORT;
}
view_list_opt AS view_select view_check_option
{}
@@ -9467,11 +9635,11 @@ trigger_tail:
if (lex->sphead)
{
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
- YYABORT;
+ MYSQL_YYABORT;
}
if (!(sp= new sp_head()))
- YYABORT;
+ MYSQL_YYABORT;
sp->reset_thd_mem_root(YYTHD);
sp->init(lex);
sp->init_sp_name(YYTHD, $3);
@@ -9510,7 +9678,7 @@ trigger_tail:
sp->restore_thd_mem_root(YYTHD);
if (sp->is_not_allowed_in_function("trigger"))
- YYABORT;
+ MYSQL_YYABORT;
/*
We have to do it after parsing trigger body, because some of
@@ -9521,7 +9689,7 @@ trigger_tail:
(LEX_STRING*) 0,
TL_OPTION_UPDATING,
TL_IGNORE))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -9549,7 +9717,7 @@ sp_tail:
if (lex->sphead)
{
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
- YYABORT;
+ MYSQL_YYABORT;
}
lex->stmt_definition_begin= $2;
@@ -9635,23 +9803,23 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume
xid: text_string
{
- YYERROR_UNLESS($1->length() <= MAXGTRIDSIZE);
+ MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
- YYABORT;
+ MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
}
| text_string ',' text_string
{
- YYERROR_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
+ MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
- YYABORT;
+ MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}
| text_string ',' text_string ',' ulong_num
{
- YYERROR_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
+ MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
- YYABORT;
+ MYSQL_YYABORT;
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}
;
diff --git a/sql/table.cc b/sql/table.cc
index e2cb0bea300..960534bf7d4 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -892,17 +892,17 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if (share->blob_fields)
{
Field **ptr;
- uint i, *save;
+ uint k, *save;
/* Store offsets to blob fields to find them fast */
if (!(share->blob_field= save=
(uint*) alloc_root(&outparam->mem_root,
(uint) (share->blob_fields* sizeof(uint)))))
goto err;
- for (i=0, ptr= outparam->field ; *ptr ; ptr++, i++)
+ for (k=0, ptr= outparam->field ; *ptr ; ptr++, k++)
{
if ((*ptr)->flags & BLOB_FLAG)
- (*save++)= i;
+ (*save++)= k;
}
}
@@ -2080,7 +2080,9 @@ void st_table_list::hide_view_error(THD *thd)
thd->net.last_errno == ER_SP_DOES_NOT_EXIST ||
thd->net.last_errno == ER_PROCACCESS_DENIED_ERROR ||
thd->net.last_errno == ER_COLUMNACCESS_DENIED_ERROR ||
- thd->net.last_errno == ER_TABLEACCESS_DENIED_ERROR)
+ thd->net.last_errno == ER_TABLEACCESS_DENIED_ERROR ||
+ thd->net.last_errno == ER_TABLE_NOT_LOCKED ||
+ thd->net.last_errno == ER_NO_SUCH_TABLE)
{
TABLE_LIST *top= top_table();
thd->clear_error();
@@ -2161,19 +2163,17 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
{
if (check_option && check_option->val_int() == 0)
{
- TABLE_LIST *view= top_table();
+ TABLE_LIST *main_view= top_table();
if (ignore_failure)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED),
- view->view_db.str, view->view_name.str);
+ main_view->view_db.str, main_view->view_name.str);
return(VIEW_CHECK_SKIP);
}
- else
- {
- my_error(ER_VIEW_CHECK_FAILED, MYF(0), view->view_db.str, view->view_name.str);
- return(VIEW_CHECK_ERROR);
- }
+ my_error(ER_VIEW_CHECK_FAILED, MYF(0), main_view->view_db.str,
+ main_view->view_name.str);
+ return(VIEW_CHECK_ERROR);
}
return(VIEW_CHECK_OK);
}
@@ -2185,19 +2185,20 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
SYNOPSIS
st_table_list::check_single_table()
- table reference on variable where to store found table
+ table_arg reference on variable where to store found table
(should be 0 on call, to find table, or point to table for
unique test)
map bit mask of tables
- view view for which we are looking table
+ view_arg view for which we are looking table
RETURN
FALSE table not found or found only one
TRUE found several tables
*/
-bool st_table_list::check_single_table(st_table_list **table, table_map map,
- st_table_list *view)
+bool st_table_list::check_single_table(st_table_list **table_arg,
+ table_map map,
+ st_table_list *view_arg)
{
for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local)
{
@@ -2205,13 +2206,13 @@ bool st_table_list::check_single_table(st_table_list **table, table_map map,
{
if (tbl->table->map & map)
{
- if (*table)
+ if (*table_arg)
return TRUE;
- *table= tbl;
- tbl->check_option= view->check_option;
+ *table_arg= tbl;
+ tbl->check_option= view_arg->check_option;
}
}
- else if (tbl->check_single_table(table, map, view))
+ else if (tbl->check_single_table(table_arg, map, view_arg))
return TRUE;
}
return FALSE;
@@ -2536,18 +2537,19 @@ bool st_table_list::prepare_security(THD *thd)
while ((tbl= tb++))
{
DBUG_ASSERT(tbl->referencing_view);
- char *db, *table_name;
+ char *local_db, *local_table_name;
if (tbl->view)
{
- db= tbl->view_db.str;
- table_name= tbl->view_name.str;
+ local_db= tbl->view_db.str;
+ local_table_name= tbl->view_name.str;
}
else
{
- db= tbl->db;
- table_name= tbl->table_name;
+ local_db= tbl->db;
+ local_table_name= tbl->table_name;
}
- fill_effective_table_privileges(thd, &tbl->grant, db, table_name);
+ fill_effective_table_privileges(thd, &tbl->grant, local_db,
+ local_table_name);
if (tbl->table)
tbl->table->grant= grant;
}
@@ -2907,12 +2909,13 @@ Field_iterator_table_ref::get_or_create_column_ref(TABLE_LIST *parent_table_ref)
uint field_count;
TABLE_LIST *add_table_ref= parent_table_ref ?
parent_table_ref : table_ref;
-
+ LINT_INIT(field_count);
+
if (field_it == &table_field_it)
{
/* The field belongs to a stored table. */
- Field *field= table_field_it.field();
- nj_col= new Natural_join_column(field, table_ref);
+ Field *tmp_field= table_field_it.field();
+ nj_col= new Natural_join_column(tmp_field, table_ref);
field_count= table_ref->table->s->fields;
}
else if (field_it == &view_field_it)
@@ -3023,16 +3026,16 @@ void st_table_list::reinit_before_use(THD *thd)
schema_table_state= NOT_PROCESSED;
TABLE_LIST *embedded; /* The table at the current level of nesting. */
- TABLE_LIST *embedding= this; /* The parent nested table reference. */
+ TABLE_LIST *parent_embedding= this; /* The parent nested table reference. */
do
{
- embedded= embedding;
+ embedded= parent_embedding;
if (embedded->prep_on_expr)
embedded->on_expr= embedded->prep_on_expr->copy_andor_structure(thd);
- embedding= embedded->embedding;
+ parent_embedding= embedded->embedding;
}
- while (embedding &&
- embedding->nested_join->join_list.head() == embedded);
+ while (parent_embedding &&
+ parent_embedding->nested_join->join_list.head() == embedded);
}
/*
diff --git a/sql/table.h b/sql/table.h
index 8f013f3de19..e2bd5ba0a7d 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -649,7 +649,7 @@ typedef struct st_table_list
int view_check_option(THD *thd, bool ignore_failure);
bool setup_underlying(THD *thd);
void cleanup_items();
- bool placeholder() {return derived || view; }
+ bool placeholder() {return derived || view || schema_table || !table; }
void print(THD *thd, String *str);
bool check_single_table(st_table_list **table, table_map map,
st_table_list *view);
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 91bd4471463..70f7cc5ea86 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -780,6 +780,8 @@ gmt_sec_to_TIME(TIME *tmp, my_time_t sec_in_utc, const TIME_ZONE_INFO *sp)
static my_time_t
sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
{
+ /* Guard against my_time_t overflow(on system with 32 bit my_time_t) */
+ DBUG_ASSERT(!(year == TIMESTAMP_MAX_YEAR && mon == 1 && mday > 17));
#ifndef WE_WANT_TO_HANDLE_UNORMALIZED_DATES
/*
It turns out that only whenever month is normalized or unnormalized
@@ -948,12 +950,12 @@ TIME_to_gmt_sec(const TIME *t, const TIME_ZONE_INFO *sp,
*/
if (shift)
{
- if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift*86400L +
+ if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift * SECS_PER_DAY +
sp->revtis[i].rt_offset - saved_seconds))
{
DBUG_RETURN(0); /* my_time_t overflow */
}
- local_t+= shift*86400L;
+ local_t+= shift * SECS_PER_DAY;
}
if (sp->revtis[i].rt_type)
@@ -1341,6 +1343,7 @@ my_time_t
Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
{
my_time_t local_t;
+ int shift= 0;
/*
Check timestamp range.we have to do this as calling function relies on
@@ -1349,10 +1352,24 @@ Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
if (!validate_timestamp_range(t))
return 0;
- local_t= sec_since_epoch(t->year, t->month, t->day,
+ /*
+ Do a temporary shift of the boundary dates to avoid
+ overflow of my_time_t if the time value is near it's
+ maximum range
+ */
+ if ((t->year == TIMESTAMP_MAX_YEAR) && (t->month == 1) && t->day > 4)
+ shift= 2;
+
+ local_t= sec_since_epoch(t->year, t->month, (t->day - shift),
t->hour, t->minute, t->second) -
offset;
+ if (shift)
+ {
+ /* Add back the shifted time */
+ local_t+= shift * SECS_PER_DAY;
+ }
+
if (local_t >= TIMESTAMP_MIN_VALUE && local_t <= TIMESTAMP_MAX_VALUE)
return local_t;
@@ -1755,8 +1772,8 @@ end_with_setting_default_tz:
/* If we have default time zone try to load it */
if (default_tzname)
{
- String tmp_tzname(default_tzname, &my_charset_latin1);
- if (!(global_system_variables.time_zone= my_tz_find(&tmp_tzname, tables)))
+ String tmp_tzname2(default_tzname, &my_charset_latin1);
+ if (!(global_system_variables.time_zone= my_tz_find(&tmp_tzname2, tables)))
{
sql_print_error("Fatal error: Illegal or unknown default time zone '%s'",
default_tzname);
diff --git a/sql/udf_example.def b/sql/udf_example.def
index ee107d58e51..7a87147d7b6 100644
--- a/sql/udf_example.def
+++ b/sql/udf_example.def
@@ -1,5 +1,4 @@
LIBRARY udf_example
-DESCRIPTION 'MySQL Sample for UDF'
VERSION 1.0
EXPORTS
lookup
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 31276c58ce8..06b2e0c10a2 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -82,7 +82,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
uchar fileinfo[64],forminfo[288],*keybuff;
TYPELIB formnames;
uchar *screen_buff;
- char buff[2];
+ char buff[128];
DBUG_ENTER("mysql_create_frm");
formnames.type_names=0;
@@ -149,7 +149,6 @@ bool mysql_create_frm(THD *thd, my_string file_name,
create_info->comment.length, 60);
if (tmp_len < create_info->comment.length)
{
- char buff[128];
(void) my_snprintf(buff, sizeof(buff), "Too long comment for table '%s'",
table);
if ((thd->variables.sql_mode &
@@ -178,13 +177,13 @@ bool mysql_create_frm(THD *thd, my_string file_name,
goto err;
int2store(buff, create_info->connect_string.length);
- if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
+ if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) ||
my_write(file, (const byte*)create_info->connect_string.str,
create_info->connect_string.length, MYF(MY_NABP)))
goto err;
int2store(buff, str_db_type.length);
- if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
+ if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) ||
my_write(file, (const byte*)str_db_type.str,
str_db_type.length, MYF(MY_NABP)))
goto err;
@@ -474,11 +473,11 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
create_field *field;
while ((field=it++))
{
-
uint tmp_len= system_charset_info->cset->charpos(system_charset_info,
field->comment.str,
field->comment.str +
- field->comment.length, 255);
+ field->comment.length,
+ 255);
if (tmp_len < field->comment.length)
{
char buff[128];
@@ -547,8 +546,9 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
for (uint pos= 0; pos < field->interval->count; pos++)
{
char *dst;
- uint length= field->save_interval->type_lengths[pos], hex_length;
const char *src= field->save_interval->type_names[pos];
+ uint hex_length;
+ length= field->save_interval->type_lengths[pos];
hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length;
field->interval->type_names[pos]= dst= sql_alloc(hex_length + 1);
@@ -839,7 +839,10 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
field->field_name,
&table);
if (!regfield)
+ {
+ error= 1;
goto err; // End of memory
+ }
if (!(field->flags & NOT_NULL_FLAG))
{