#At file:///home/kgeorge/mysql/bzr/B32124-5.0-bugteam/
2672 Georgi Kodinov 2008-09-04
Bug #32124: crash if prepared statements refer to variables in the where clause
The code to get read the value of a system variable was extracting its value
on PREPARE stage and was substituting the value (as a constant) into the parse tree.
Note that this must be a reversible transformation, i.e. it must be reversed before
each re-execution.
Unfortunately this cannot be reliably done using the current code, because there are
other non-reversible source tree transformations that can interfere with this
reversible transformation.
Fixed by not resolving the value at PREPARE, but at EXECUTE (as the rest of the
functions operate). Added a cache of the value (so that it's constant throughout
the execution of the query).
Updated an obsolete related test suite (variables-big) and the code to test the
result type of system variables (as per bug 74).
modified:
mysql-test/r/ps_11bugs.result
mysql-test/r/variables-big.result
mysql-test/r/variables.result
mysql-test/t/ps_11bugs.test
sql/item.cc
sql/item.h
sql/item_func.cc
sql/item_func.h
sql/set_var.cc
sql/set_var.h
tests/mysql_client_test.c
per-file messages:
mysql-test/r/ps_11bugs.result
Bug #32124: test case
mysql-test/r/variables-big.result
Bug #32124: updated obsolete result file.
mysql-test/r/variables.result
Bug#32124: updated test result
mysql-test/t/ps_11bugs.test
Bug #32124: test case
sql/item.cc
Bug #32124: placed the code to convert string to longlong to a function
(so that it can be reused)
sql/item.h
Bug #32124: placed the code to convert string to longlong to a function
(so that it can be reused)
sql/item_func.cc
Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/item_func.h
Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/set_var.cc
Bug #32124: removed the code that calculated the system variable's value
at PREPARE
sql/set_var.h
Bug #32124: removed the code that calculated the system variable's value
at PREPARE
tests/mysql_client_test.c
Bug #32124 :
- removed the reading of the system variable, because its max
length is depended on the system charset and client charset and can't be
easily calculated.
- updated the check values for the integer system variables.
=== modified file 'mysql-test/r/ps_11bugs.result'
--- a/mysql-test/r/ps_11bugs.result 2006-10-04 15:19:23 +0000
+++ b/mysql-test/r/ps_11bugs.result 2008-09-04 12:02:56 +0000
@@ -162,4 +162,31 @@ a b
12 NULL
drop table t1;
drop table t2;
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))';
+EXECUTE stmt;
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (400000), (400001);
+SET @@sort_buffer_size=400000;
+CREATE FUNCTION p1(i INT) RETURNS INT
+BEGIN
+SET @@sort_buffer_size= i;
+RETURN i + 1;
+END|
+SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1;
+a
+400000
+DROP TABLE t2;
+SELECT CONCAT(@@sort_buffer_size);
+CONCAT(@@sort_buffer_size)
+400001
+SELECT LEFT("12345", @@tmpdir);
+LEFT("12345", @@tmpdir)
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value:
'/home/kgeorge/mysql/bzr/B32124-5.0-bugteam/mysql-test/var/tmp'
+SET @@sort_buffer_size=DEFAULT;
End of 5.0 tests.
=== modified file 'mysql-test/r/variables-big.result'
--- a/mysql-test/r/variables-big.result 2007-12-21 19:30:23 +0000
+++ b/mysql-test/r/variables-big.result 2008-09-04 12:02:56 +0000
@@ -1,24 +1,20 @@
set session transaction_prealloc_size=1024*1024*1024*1;
show processlist;
Id User Host db Command Time State Info
-6 root localhost test Query 0 NULL show processlist
+1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*2;
show processlist;
Id User Host db Command Time State Info
-6 root localhost test Query 1 NULL show processlist
+1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*3;
show processlist;
Id User Host db Command Time State Info
-6 root localhost test Query 0 NULL show processlist
+1 root localhost test Query 1 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*4;
-Warnings:
-Warning 1292 Truncated incorrect transaction_prealloc_size value: '4294967296'
show processlist;
Id User Host db Command Time State Info
-6 root localhost test Query 0 NULL show processlist
+1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*5;
-Warnings:
-Warning 1292 Truncated incorrect transaction_prealloc_size value: '5368709120'
show processlist;
Id User Host db Command Time State Info
-6 root localhost test Query 0 NULL show processlist
+1 root localhost test Query 0 NULL show processlist
=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result 2008-02-17 11:37:39 +0000
+++ b/mysql-test/r/variables.result 2008-09-04 12:02:56 +0000
@@ -143,7 +143,7 @@ explain extended select @@IDENTITY,last_
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS
`@@identity`
+Note 1003 select @@IDENTITY AS `@@IDENTITY`,last_insert_id() AS
`last_insert_id()`,@@identity AS `@@identity`
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF",
big_tables="ON";
set global concurrent_insert=2;
show variables like 'concurrent_insert';
=== modified file 'mysql-test/t/ps_11bugs.test'
--- a/mysql-test/t/ps_11bugs.test 2006-10-04 15:19:23 +0000
+++ b/mysql-test/t/ps_11bugs.test 2008-09-04 12:02:56 +0000
@@ -177,4 +177,40 @@ select * from t2;
drop table t1;
drop table t2;
+#
+# Bug #32124: crash if prepared statements refer to variables in the where
+# clause
+#
+
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (400000), (400001);
+
+SET @@sort_buffer_size=400000;
+
+DELIMITER |;
+
+CREATE FUNCTION p1(i INT) RETURNS INT
+BEGIN
+ SET @@sort_buffer_size= i;
+ RETURN i + 1;
+END|
+
+DELIMITER ;|
+
+SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1;
+
+DROP TABLE t2;
+
+
+SELECT CONCAT(@@sort_buffer_size);
+SELECT LEFT("12345", @@tmpdir);
+
+SET @@sort_buffer_size=DEFAULT;
+
--echo End of 5.0 tests.
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2008-08-20 09:49:28 +0000
+++ b/sql/item.cc 2008-09-04 12:02:56 +0000
@@ -2326,16 +2326,14 @@ double Item_string::val_real()
}
-longlong Item_string::val_int()
+longlong
+longlong_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end)
{
- DBUG_ASSERT(fixed == 1);
int err;
longlong tmp;
- char *end= (char*) str_value.ptr()+ str_value.length();
char *org_end= end;
- CHARSET_INFO *cs= str_value.charset();
- tmp= (*(cs->cset->strtoll10))(cs, str_value.ptr(), &end, &err);
+ tmp= (*(cs->cset->strtoll10))(cs, cptr, &end, &err);
/*
TODO: Give error if we wanted a signed integer and we got an unsigned
one
@@ -2346,12 +2344,20 @@ longlong Item_string::val_int()
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
- str_value.ptr());
+ cptr);
}
return tmp;
}
+longlong Item_string::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ return longlong_from_string_with_check(str_value.charset(), str_value.ptr(),
+ (char *) str_value.ptr()+ str_value.length());
+}
+
+
my_decimal *Item_string::val_decimal(my_decimal *decimal_value)
{
return val_decimal_from_string(decimal_value);
=== modified file 'sql/item.h'
--- a/sql/item.h 2008-08-15 20:13:27 +0000
+++ b/sql/item.h 2008-09-04 12:02:56 +0000
@@ -1781,6 +1781,9 @@ public:
};
+longlong
+longlong_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end);
+
class Item_static_string_func :public Item_string
{
const char *func_name;
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2008-07-30 11:07:37 +0000
+++ b/sql/item_func.cc 2008-09-04 12:02:56 +0000
@@ -4778,30 +4778,228 @@ Item_func_get_system_var::
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
LEX_STRING *component_arg, const char *name_arg,
size_t name_len_arg)
- :var(var_arg), var_type(var_type_arg), component(*component_arg)
+ :var(var_arg), var_type(var_type_arg), component(*component_arg),
+ cache_present(false)
{
/* set_name() will allocate the name */
set_name(name_arg, name_len_arg, system_charset_info);
}
-bool
-Item_func_get_system_var::fix_fields(THD *thd, Item **ref)
+void Item_func_get_system_var::fix_length_and_dec()
{
- Item *item;
- DBUG_ENTER("Item_func_get_system_var::fix_fields");
+ maybe_null=0;
+ decimals=NOT_FIXED_DEC;
+ max_length=MAX_BLOB_WIDTH;
+
+ if (var->check_type(var_type))
+ {
+ if (var_type != OPT_DEFAULT)
+ {
+ my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
+ var->name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
+ return;
+ }
+ /* As there was no local variable, return the global value */
+ var_type= OPT_GLOBAL;
+ }
+
+ switch (var->show_type())
+ {
+ case SHOW_LONG:
+ case SHOW_INT:
+ unsigned_flag= TRUE;
+ max_length= MY_INT64_NUM_DECIMAL_DIGITS;
+ decimals=0;
+ break;
+ case SHOW_HA_ROWS:
+ case SHOW_LONGLONG:
+ unsigned_flag= FALSE;
+ max_length= MY_INT64_NUM_DECIMAL_DIGITS;
+ decimals=0;
+ break;
+ case SHOW_CHAR:
+ collation.set(system_charset_info, DERIVATION_SYSCONST);
+ max_length= MAX_BLOB_WIDTH;
+ break;
+ case SHOW_MY_BOOL:
+ unsigned_flag= TRUE;
+ max_length= 1;
+ decimals=0;
+ break;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
+ break;
+ }
+}
+
+
+void Item_func_get_system_var::print(String *str)
+{
+ str->append(name, name_length);
+}
+
+
+enum Item_result Item_func_get_system_var::result_type() const
+{
+ switch (var->show_type())
+ {
+ case SHOW_MY_BOOL:
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ return INT_RESULT;
+ case SHOW_CHAR: return STRING_RESULT;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
+ return STRING_RESULT; // keep the compiler happy
+ }
+}
+
+
+enum_field_types Item_func_get_system_var::field_type() const
+{
+ switch (var->show_type())
+ {
+ case SHOW_MY_BOOL:
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ return MYSQL_TYPE_LONGLONG;
+ case SHOW_CHAR: return MYSQL_TYPE_VARCHAR;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
+ return MYSQL_TYPE_VARCHAR; // keep the compiler happy
+ }
+}
+
+
+double Item_func_get_system_var::val_real()
+{
+ return (double) val_int();
+}
+
+#define get_sys_var_safe(type) \
+do { \
+ type value; \
+ pthread_mutex_lock(&LOCK_global_system_variables); \
+ value= *(type*) var->value_ptr(thd, var_type, &component); \
+ pthread_mutex_unlock(&LOCK_global_system_variables); \
+ cache_present= true; \
+ used_query_id= thd->query_id; \
+ cached_llval= (longlong) value; \
+ return cached_llval; \
+} while (0)
+
+
+longlong Item_func_get_system_var::val_int()
+{
+ THD *thd= current_thd;
+
+ if (cache_present && thd->query_id == used_query_id)
+ return cached_llval;
+
+ switch (var->show_type())
+ {
+ case SHOW_INT: get_sys_var_safe (uint);
+ case SHOW_LONG: get_sys_var_safe (ulong);
+ case SHOW_LONGLONG: get_sys_var_safe (longlong);
+ case SHOW_HA_ROWS: get_sys_var_safe (ha_rows);
+ case SHOW_MY_BOOL: get_sys_var_safe (my_bool);
+ case SHOW_CHAR:
+ {
+ longlong val;
+ char *cptr;
+
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ cptr= (char*) var->value_ptr(thd, var_type, &component);
+ if (cptr)
+ val= longlong_from_string_with_check (system_charset_info,
+ cptr, cptr + strlen (cptr));
+ else
+ {
+ null_value= TRUE;
+ val= 0;
+ }
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ cache_present= true;
+ used_query_id= thd->query_id;
+ cached_llval= val;
+ return val;
+ }
+
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
+ return 0; // keep the compiler happy
+ }
+}
- /*
- Evaluate the system variable and substitute the result (a basic constant)
- instead of this item. If the variable can not be evaluated,
- the error is reported in sys_var::item().
- */
- if (!(item= var->item(thd, var_type, &component)))
- DBUG_RETURN(1); // Impossible
- item->set_name(name, 0, system_charset_info); // don't allocate a new name
- thd->change_item_tree(ref, item);
- DBUG_RETURN(0);
+String* Item_func_get_system_var::val_str(String* str)
+{
+ THD *thd= current_thd;
+
+ if (cache_present && thd->query_id == used_query_id)
+ return &cached_strval;
+
+ switch (var->show_type())
+ {
+ case SHOW_CHAR:
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ char *cptr= (char*) var->value_ptr(thd, var_type, &component);
+ if (cptr)
+ {
+ if (str->copy(cptr, strlen(cptr), collation.collation))
+ str= NULL;
+ }
+ else
+ {
+ null_value= TRUE;
+ str= NULL;
+ }
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ break;
+ }
+
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ case SHOW_MY_BOOL:
+ str->set (val_int(), collation.collation);
+ break;
+
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
+ str= NULL;
+ break;
+ }
+
+ if (str)
+ {
+ cache_present= true;
+ used_query_id= thd->query_id;
+ if (cached_strval.copy(*str))
+ cache_present= false;
+ }
+ return str;
+}
+
+
+bool Item_func_get_system_var::eq(const Item *item, bool binary_cmp) const
+{
+ /* Assume we don't have rtti */
+ if (this == item)
+ return 1; // Same item is same.
+ /* Check if other type is also a get_user_var() object */
+ if (item->type() != FUNC_ITEM ||
+ ((Item_func*) item)->functype() != functype())
+ return 0;
+ Item_func_get_system_var *other=(Item_func_get_system_var*) item;
+ return (var == other->var && var_type == other->var_type);
}
=== modified file 'sql/item_func.h'
--- a/sql/item_func.h 2008-02-28 13:23:22 +0000
+++ b/sql/item_func.h 2008-09-04 12:02:56 +0000
@@ -55,7 +55,7 @@ public:
NOW_FUNC, TRIG_COND_FUNC,
SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC,
- NEG_FUNC };
+ NEG_FUNC, GSYSVAR_FUNC };
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
OPTIMIZE_EQUAL };
enum Type type() const { return FUNC_ITEM; }
@@ -1397,21 +1397,28 @@ class Item_func_get_system_var :public I
sys_var *var;
enum_var_type var_type;
LEX_STRING component;
+ longlong cached_llval;
+ String cached_strval;
+ query_id_t used_query_id;
+ bool cache_present;
+
public:
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
LEX_STRING *component_arg, const char *name_arg,
size_t name_len_arg);
- bool fix_fields(THD *thd, Item **ref);
- /*
- Stubs for pure virtual methods. Should never be called: this
- item is always substituted with a constant in fix_fields().
- */
- double val_real() { DBUG_ASSERT(0); return 0.0; }
- longlong val_int() { DBUG_ASSERT(0); return 0; }
- String* val_str(String*) { DBUG_ASSERT(0); return 0; }
- void fix_length_and_dec() { DBUG_ASSERT(0); }
+ enum Functype functype() const { return GSYSVAR_FUNC; }
+ void fix_length_and_dec();
+ void print(String *str);
+ bool const_item() const { return true; }
+ table_map used_tables() const { return 0; }
+ enum Item_result result_type() const;
+ enum_field_types field_type() const;
+ double val_real();
+ longlong val_int();
+ String* val_str(String*);
/* TODO: fix to support views */
const char *func_name() const { return "get_system_var"; }
+ bool eq(const Item *item, bool binary_cmp) const;
};
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2008-07-16 22:29:22 +0000
+++ b/sql/set_var.cc 2008-09-04 12:02:56 +0000
@@ -1853,82 +1853,6 @@ err:
}
-/*
- Return an Item for a variable. Used with @@[global.]variable_name
- If type is not given, return local value if exists, else global
-*/
-
-Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
-{
- if (check_type(var_type))
- {
- if (var_type != OPT_DEFAULT)
- {
- my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
- name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
- return 0;
- }
- /* As there was no local variable, return the global value */
- var_type= OPT_GLOBAL;
- }
- switch (show_type()) {
- case SHOW_INT:
- {
- uint value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(uint*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((ulonglong) value);
- }
- case SHOW_LONG:
- {
- ulong value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(ulong*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((ulonglong) value);
- }
- case SHOW_LONGLONG:
- {
- longlong value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(longlong*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_int(value);
- }
- case SHOW_HA_ROWS:
- {
- ha_rows value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(ha_rows*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_int((longlong) value);
- }
- case SHOW_MY_BOOL:
- return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1);
- case SHOW_CHAR:
- {
- Item *tmp;
- pthread_mutex_lock(&LOCK_global_system_variables);
- char *str= (char*) value_ptr(thd, var_type, base);
- if (str)
- tmp= new Item_string(str, strlen(str),
- system_charset_info, DERIVATION_SYSCONST);
- else
- {
- tmp= new Item_null();
- tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
- }
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return tmp;
- }
- default:
- my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
- }
- return 0;
-}
-
-
bool sys_var_thd_enum::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
=== modified file 'sql/set_var.h'
--- a/sql/set_var.h 2008-01-23 15:03:58 +0000
+++ b/sql/set_var.h 2008-09-04 12:02:56 +0000
@@ -65,7 +65,6 @@ public:
{ return type != INT_RESULT; } /* Assume INT */
virtual bool check_default(enum_var_type type)
{ return option_limits == 0; }
- Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
};
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2008-08-20 09:49:28 +0000
+++ b/tests/mysql_client_test.c 2008-09-04 12:02:56 +0000
@@ -6930,9 +6930,6 @@ static void test_field_misc()
{
MYSQL_STMT *stmt;
MYSQL_RES *result;
- MYSQL_BIND my_bind[1];
- char table_type[NAME_LEN];
- ulong type_length;
int rc;
myheader("test_field_misc");
@@ -6975,53 +6972,6 @@ static void test_field_misc()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt= mysql_simple_prepare(mysql, "SELECT @@table_type");
- check_stmt(stmt);
-
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- bzero((char*) my_bind, sizeof(my_bind));
- my_bind[0].buffer_type= MYSQL_TYPE_STRING;
- my_bind[0].buffer= table_type;
- my_bind[0].length= &type_length;
- my_bind[0].buffer_length= NAME_LEN;
-
- rc= mysql_stmt_bind_result(stmt, my_bind);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_fetch(stmt);
- check_execute(stmt, rc);
- if (!opt_silent)
- fprintf(stdout, "\n default table type: %s(%ld)", table_type, type_length);
-
- rc= mysql_stmt_fetch(stmt);
- DIE_UNLESS(rc == MYSQL_NO_DATA);
-
- mysql_stmt_close(stmt);
-
- stmt= mysql_simple_prepare(mysql, "SELECT @@table_type");
- check_stmt(stmt);
-
- result= mysql_stmt_result_metadata(stmt);
- mytest(result);
- DIE_UNLESS(mysql_stmt_field_count(stmt) == mysql_num_fields(result));
-
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- DIE_UNLESS(1 == my_process_stmt_result(stmt));
-
- verify_prepare_field(result, 0,
- "@@table_type", "", /* field and its org name */
- mysql_get_server_version(mysql) <= 50000 ?
- MYSQL_TYPE_STRING : MYSQL_TYPE_VAR_STRING,
- "", "", /* table and its org name */
- "", type_length, 0); /* db name, length */
-
- mysql_free_result(result);
- mysql_stmt_close(stmt);
-
stmt= mysql_simple_prepare(mysql, "SELECT @@max_error_count");
check_stmt(stmt);
@@ -7038,7 +6988,8 @@ static void test_field_misc()
"@@max_error_count", "", /* field and its org name */
MYSQL_TYPE_LONGLONG, /* field type */
"", "", /* table and its org name */
- "", 10, 0); /* db name, length */
+ /* db name, length */
+ "", MY_INT64_NUM_DECIMAL_DIGITS , 0);
mysql_free_result(result);
mysql_stmt_close(stmt);
@@ -7058,7 +7009,8 @@ static void test_field_misc()
"@@max_allowed_packet", "", /* field and its org name */
MYSQL_TYPE_LONGLONG, /* field type */
"", "", /* table and its org name */
- "", 10, 0); /* db name, length */
+ /* db name, length */
+ "", MY_INT64_NUM_DECIMAL_DIGITS, 0);
mysql_free_result(result);
mysql_stmt_close(stmt);