mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merged
sql/set_var.cc: Auto merged
This commit is contained in:
@ -296,5 +296,6 @@
|
||||
#define ER_MISSING_SKIP_SLAVE 1277
|
||||
#define ER_UNTIL_COND_IGNORED 1278
|
||||
#define ER_WRONG_INDEX_NAME 1279
|
||||
#define ER_BAD_FT_COLUMN 1280
|
||||
#define ER_ERROR_MESSAGES 281
|
||||
#define ER_WARN_QC_RESIZE 1280
|
||||
#define ER_BAD_FT_COLUMN 1281
|
||||
#define ER_ERROR_MESSAGES 282
|
||||
|
@ -579,24 +579,32 @@ query_cache_size 0
|
||||
select * from t1;
|
||||
a
|
||||
set GLOBAL query_cache_size=1024;
|
||||
Warnings:
|
||||
Warning 1280 Query cache failed to set size 1024, new query cache size is 0
|
||||
show global variables like "query_cache_size";
|
||||
Variable_name Value
|
||||
query_cache_size 0
|
||||
select * from t1;
|
||||
a
|
||||
set GLOBAL query_cache_size=10240;
|
||||
Warnings:
|
||||
Warning 1280 Query cache failed to set size 10240, new query cache size is 0
|
||||
show global variables like "query_cache_size";
|
||||
Variable_name Value
|
||||
query_cache_size 0
|
||||
select * from t1;
|
||||
a
|
||||
set GLOBAL query_cache_size=20480;
|
||||
Warnings:
|
||||
Warning 1280 Query cache failed to set size 20480, new query cache size is 0
|
||||
show global variables like "query_cache_size";
|
||||
Variable_name Value
|
||||
query_cache_size 0
|
||||
select * from t1;
|
||||
a
|
||||
set GLOBAL query_cache_size=40960;
|
||||
Warnings:
|
||||
Warning 1280 Query cache failed to set size 40960, new query cache size is 0
|
||||
show global variables like "query_cache_size";
|
||||
Variable_name Value
|
||||
query_cache_size 0
|
||||
|
@ -1489,3 +1489,17 @@ set sort_buffer_size = (select s1 from t1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
do (select * from t1);
|
||||
drop table t1;
|
||||
create table t1 (s1 char);
|
||||
insert into t1 values ('e');
|
||||
select * from t1 where 'f' > any (select s1 from t1);
|
||||
s1
|
||||
e
|
||||
select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
|
||||
s1
|
||||
e
|
||||
explain select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 system NULL NULL NULL NULL 1
|
||||
3 UNION t1 system NULL NULL NULL NULL 1
|
||||
drop table t1;
|
||||
|
@ -1010,3 +1010,13 @@ insert into t1 values (2);
|
||||
set sort_buffer_size = (select s1 from t1);
|
||||
do (select * from t1);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# optimized ALL/ANY with union
|
||||
#
|
||||
create table t1 (s1 char);
|
||||
insert into t1 values ('e');
|
||||
select * from t1 where 'f' > any (select s1 from t1);
|
||||
select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
|
||||
explain select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
|
||||
drop table t1;
|
||||
|
@ -421,6 +421,7 @@ bool Item_in_optimizer::fix_left(THD *thd,
|
||||
not_null_tables_cache= args[0]->not_null_tables();
|
||||
with_sum_func= args[0]->with_sum_func;
|
||||
const_item_cache= args[0]->const_item();
|
||||
fixed= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ inline Item * and_items(Item* cond, Item *item)
|
||||
}
|
||||
|
||||
Item_subselect::Item_subselect():
|
||||
Item_result_field(), engine_owner(1), value_assigned(0), substitution(0),
|
||||
Item_result_field(), value_assigned(0), substitution(0),
|
||||
engine(0), used_tables_cache(0), have_to_be_excluded(0),
|
||||
const_item_cache(1), engine_changed(0)
|
||||
{
|
||||
@ -66,7 +66,6 @@ void Item_subselect::init(st_select_lex *select_lex,
|
||||
|
||||
Item_subselect::~Item_subselect()
|
||||
{
|
||||
if (engine_owner)
|
||||
delete engine;
|
||||
}
|
||||
|
||||
@ -183,7 +182,8 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
Item_maxmin_subselect::Item_maxmin_subselect(st_select_lex *select_lex,
|
||||
Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent,
|
||||
st_select_lex *select_lex,
|
||||
bool max)
|
||||
:Item_singlerow_subselect()
|
||||
{
|
||||
@ -192,6 +192,14 @@ Item_maxmin_subselect::Item_maxmin_subselect(st_select_lex *select_lex,
|
||||
max_columns= 1;
|
||||
maybe_null= 1;
|
||||
max_columns= 1;
|
||||
|
||||
/*
|
||||
Following information was collected during performing fix_fields()
|
||||
of Items belonged to subquery, which will be not repeated
|
||||
*/
|
||||
used_tables_cache= parent->get_used_tables_cache();
|
||||
const_item_cache= parent->get_const_item_cache();
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -527,9 +535,16 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
||||
func == &Item_bool_func2::ge_creator ||
|
||||
func == &Item_bool_func2::le_creator))
|
||||
{
|
||||
if (substitution)
|
||||
{
|
||||
// It is second (third, ...) SELECT of UNION => All is done
|
||||
DBUG_RETURN(RES_OK);
|
||||
}
|
||||
|
||||
Item *subs;
|
||||
if (!select_lex->group_list.elements &&
|
||||
!select_lex->with_sum_func)
|
||||
!select_lex->with_sum_func &&
|
||||
!(select_lex->next_select()))
|
||||
{
|
||||
Item *item;
|
||||
subs_type type= substype();
|
||||
@ -565,7 +580,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
||||
// remove LIMIT placed by ALL/ANY subquery
|
||||
select_lex->master_unit()->global_parameters->select_limit=
|
||||
HA_POS_ERROR;
|
||||
subs= new Item_maxmin_subselect(select_lex,
|
||||
subs= new Item_maxmin_subselect(this, select_lex,
|
||||
(func == &Item_bool_func2::le_creator ||
|
||||
func == &Item_bool_func2::lt_creator));
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ typedef Item_bool_func2* (*compare_func_creator)(Item*, Item*);
|
||||
|
||||
class Item_subselect :public Item_result_field
|
||||
{
|
||||
my_bool engine_owner; /* Is this item owner of engine */
|
||||
my_bool value_assigned; /* value already assigned to subselect */
|
||||
protected:
|
||||
/* thread handler, will be assigned in fix_fields only */
|
||||
@ -90,6 +89,8 @@ public:
|
||||
virtual void fix_length_and_dec();
|
||||
table_map used_tables() const;
|
||||
bool const_item() const;
|
||||
inline table_map get_used_tables_cache() { return used_tables_cache; }
|
||||
inline bool get_const_item_cache() { return const_item_cache; }
|
||||
void update_used_tables();
|
||||
void print(String *str)
|
||||
{
|
||||
@ -144,10 +145,11 @@ public:
|
||||
};
|
||||
|
||||
/* used in static ALL/ANY optimisation */
|
||||
class Item_maxmin_subselect: public Item_singlerow_subselect
|
||||
class Item_maxmin_subselect :public Item_singlerow_subselect
|
||||
{
|
||||
public:
|
||||
Item_maxmin_subselect(st_select_lex *select_lex, bool max);
|
||||
Item_maxmin_subselect(Item_subselect *parent,
|
||||
st_select_lex *select_lex, bool max);
|
||||
};
|
||||
|
||||
/* exists subselect */
|
||||
|
@ -1822,7 +1822,7 @@ bool Item_func_group_concat::setup(THD *thd)
|
||||
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
|
||||
DBUG_RETURN(1);
|
||||
/*
|
||||
all not constant fields are push to list and create temp table
|
||||
push all not constant fields to list and create temp table
|
||||
*/
|
||||
always_null= 0;
|
||||
for (uint i= 0; i < arg_count; i++)
|
||||
|
@ -909,7 +909,12 @@ static void fix_net_retry_count(THD *thd __attribute__(unused),
|
||||
static void fix_query_cache_size(THD *thd, enum_var_type type)
|
||||
{
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
ulong requested= query_cache_size;
|
||||
query_cache.resize(query_cache_size);
|
||||
if (requested != query_cache_size)
|
||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
|
||||
requested, query_cache_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -292,4 +292,5 @@ character-set=latin2
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -286,4 +286,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -294,4 +294,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -283,4 +283,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -288,4 +288,5 @@ character-set=latin7
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -283,4 +283,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -295,4 +295,5 @@ character-set=latin1
|
||||
"Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-f<>r-Schritt-Replikation ausgef<65>hrt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet",
|
||||
"SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -283,4 +283,5 @@ character-set=greek
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -285,4 +285,5 @@ character-set=latin2
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -283,4 +283,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -285,4 +285,5 @@ character-set=ujis
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -283,4 +283,5 @@ character-set=euckr
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -285,4 +285,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -285,4 +285,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -287,4 +287,5 @@ character-set=latin2
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -284,4 +284,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -287,4 +287,5 @@ character-set=latin2
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -285,4 +285,5 @@ character-set=koi8r
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %lu, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -278,4 +278,5 @@ character-set=cp1250
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -291,4 +291,5 @@ character-set=latin2
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -285,4 +285,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -283,4 +283,5 @@ character-set=latin1
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"Query cache failed to set size %lu, new query cache size is %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -288,4 +288,5 @@ character-set=koi8u
|
||||
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
|
||||
"SQL thread is not to be started so UNTIL options are ignored"
|
||||
"Incorrect index name '%-.100s'",
|
||||
"<22><><EFBFBD> <20><><EFBFBD><EFBFBD>Ԧ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ͦ<EFBFBD> %lu, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ͦ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ԧ<EFBFBD> - %lu",
|
||||
"Column '%-.64s' cannot be part of FULLTEXT index"
|
||||
|
@ -1112,8 +1112,11 @@ void st_select_lex_unit::exclude_level()
|
||||
SELECT_LEX_UNIT *units= 0, **units_last= &units;
|
||||
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
|
||||
{
|
||||
// unlink current level from global SELECTs list
|
||||
if (sl->link_prev && (*sl->link_prev= sl->link_next))
|
||||
sl->link_next->link_prev= sl->link_prev;
|
||||
|
||||
// bring up underlay levels
|
||||
SELECT_LEX_UNIT **last= 0;
|
||||
for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit())
|
||||
{
|
||||
@ -1128,11 +1131,20 @@ void st_select_lex_unit::exclude_level()
|
||||
}
|
||||
if (units)
|
||||
{
|
||||
// include brought up levels in place of current
|
||||
(*prev)= units;
|
||||
(*units_last)= (SELECT_LEX_UNIT*)next;
|
||||
if (next)
|
||||
next->prev= (SELECT_LEX_NODE**)units_last;
|
||||
units->prev= prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
// exclude currect unit from list of nodes
|
||||
(*prev)= next;
|
||||
if (next)
|
||||
next->prev= prev;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1147,15 +1159,20 @@ void st_select_lex_unit::exclude_tree()
|
||||
SELECT_LEX_UNIT *units= 0, **units_last= &units;
|
||||
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
|
||||
{
|
||||
// unlink current level from global SELECTs list
|
||||
if (sl->link_prev && (*sl->link_prev= sl->link_next))
|
||||
sl->link_next->link_prev= sl->link_prev;
|
||||
|
||||
// unlink underlay levels
|
||||
for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit())
|
||||
{
|
||||
u->exclude_level();
|
||||
}
|
||||
}
|
||||
// exclude currect unit from list of nodes
|
||||
(*prev)= next;
|
||||
if (next)
|
||||
next->prev= prev;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ Long data handling:
|
||||
#include "sql_select.h" // for JOIN
|
||||
#include <m_ctype.h> // for isspace()
|
||||
|
||||
#define IS_PARAM_NULL(pos, param_no) pos[param_no/8] & (1 << param_no & 7)
|
||||
#define IS_PARAM_NULL(pos, param_no) (pos[param_no/8] & (1 << (param_no & 7)))
|
||||
|
||||
#define STMT_QUERY_LOG_LENGTH 8192
|
||||
|
||||
|
@ -119,13 +119,18 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
||||
SELECT_LEX *select_cursor,*sl;
|
||||
DBUG_ENTER("st_select_lex_unit::prepare");
|
||||
|
||||
/*
|
||||
result object should be reassigned even if preparing already done for
|
||||
max/min subquery (ALL/ANY optimization)
|
||||
*/
|
||||
result= sel_result;
|
||||
|
||||
if (prepared)
|
||||
DBUG_RETURN(0);
|
||||
prepared= 1;
|
||||
res= 0;
|
||||
found_rows_for_union= first_select_in_union()->options & OPTION_FOUND_ROWS;
|
||||
TMP_TABLE_PARAM tmp_table_param;
|
||||
result= sel_result;
|
||||
t_and_f= tables_and_fields_initied;
|
||||
|
||||
bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM));
|
||||
|
@ -1289,6 +1289,8 @@ static void test_double_compare()
|
||||
/* tinyint */
|
||||
bind[0].buffer_type=FIELD_TYPE_TINY;
|
||||
bind[0].buffer=(char *)&tiny_data;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
bind[0].is_null= 0; /* Can never be null */
|
||||
|
||||
/* string->float */
|
||||
@ -1302,6 +1304,8 @@ static void test_double_compare()
|
||||
/* double */
|
||||
bind[2].buffer_type=FIELD_TYPE_DOUBLE;
|
||||
bind[2].buffer= (char *)&double_data;
|
||||
bind[2].buffer_length= 0;
|
||||
bind[2].length= 0;
|
||||
bind[2].is_null= 0;
|
||||
|
||||
tiny_data = 1;
|
||||
@ -1369,6 +1373,7 @@ static void test_null()
|
||||
|
||||
bind[0].buffer_type=MYSQL_TYPE_LONG;
|
||||
bind[0].is_null= &is_null[0];
|
||||
bind[0].length= 0;
|
||||
is_null[0]= 1;
|
||||
bind[1]=bind[0];
|
||||
|
||||
@ -1742,6 +1747,8 @@ static void test_select()
|
||||
|
||||
bind[0].buffer=(char *)&nData;
|
||||
bind[0].buffer_type=FIELD_TYPE_LONG;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
bind[0].is_null= 0;
|
||||
|
||||
rc = mysql_bind_param(stmt,bind);
|
||||
@ -1848,7 +1855,6 @@ static void test_bug1180()
|
||||
MYSQL_BIND bind[1];
|
||||
ulong length[1];
|
||||
char szData[11];
|
||||
int nData=1;
|
||||
|
||||
myheader("test_select_bug");
|
||||
|
||||
@ -1917,6 +1923,110 @@ static void test_bug1180()
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
||||
/*
|
||||
test BUG#1644 (Insertion of more than 3 NULL columns with
|
||||
parameter binding fails)
|
||||
*/
|
||||
static void test_bug1644()
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_BIND bind[4];
|
||||
int num;
|
||||
my_bool isnull;
|
||||
int rc, i;
|
||||
|
||||
myheader("test_bug1644");
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS foo_dfr");
|
||||
myquery(rc);
|
||||
|
||||
rc= mysql_query(mysql,
|
||||
"CREATE TABLE foo_dfr(col1 int, col2 int, col3 int, col4 int);");
|
||||
myquery(rc);
|
||||
|
||||
strmov(query, "INSERT INTO foo_dfr VALUES (?,?,?,? )");
|
||||
stmt = mysql_prepare(mysql, query, strlen(query));
|
||||
mystmt_init(stmt);
|
||||
|
||||
verify_param_count(stmt, 4);
|
||||
|
||||
num= 22;
|
||||
isnull= 0;
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
bind[i].buffer_type= FIELD_TYPE_LONG;
|
||||
bind[i].buffer= (char *)#
|
||||
bind[i].buffer_length= 0;
|
||||
bind[i].length= 0;
|
||||
bind[i].is_null= &isnull;
|
||||
}
|
||||
|
||||
rc= mysql_bind_param(stmt, bind);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
rc= mysql_execute(stmt);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
isnull= 1;
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
bind[i].is_null= &isnull;
|
||||
|
||||
rc= mysql_bind_param(stmt, bind);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
rc= mysql_execute(stmt);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
isnull= 0;
|
||||
num= 88;
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
bind[i].is_null= &isnull;
|
||||
|
||||
rc= mysql_bind_param(stmt, bind);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
rc= mysql_execute(stmt);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
rc= mysql_query(mysql, "SELECT * FROM foo_dfr");
|
||||
myquery(rc);
|
||||
|
||||
result= mysql_store_result(mysql);
|
||||
mytest(result);
|
||||
|
||||
myassert(3 == my_process_result_set(result));
|
||||
|
||||
mysql_data_seek(result, 0);
|
||||
|
||||
row= mysql_fetch_row(result);
|
||||
mytest(row);
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
myassert(strcmp(row[i], "22") == 0);
|
||||
}
|
||||
row= mysql_fetch_row(result);
|
||||
mytest(row);
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
myassert(row[i] == 0);
|
||||
}
|
||||
row= mysql_fetch_row(result);
|
||||
mytest(row);
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
myassert(strcmp(row[i], "88") == 0);
|
||||
}
|
||||
row= mysql_fetch_row(result);
|
||||
mytest_r(row);
|
||||
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************
|
||||
* to test simple select show *
|
||||
*********************************************************/
|
||||
@ -2035,6 +2145,8 @@ static void test_simple_update()
|
||||
|
||||
bind[1].buffer=(char *) &nData;
|
||||
bind[1].buffer_type=FIELD_TYPE_LONG;
|
||||
bind[1].buffer_length= 0;
|
||||
bind[1].length= 0;
|
||||
bind[1].is_null= 0;
|
||||
|
||||
rc = mysql_bind_param(stmt,bind);
|
||||
@ -2105,6 +2217,8 @@ static void test_long_data()
|
||||
bind[0].buffer=(char *)&int_data;
|
||||
bind[0].buffer_type=FIELD_TYPE_LONG;
|
||||
bind[0].is_null=0;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
|
||||
bind[1].buffer_type=FIELD_TYPE_STRING;
|
||||
bind[1].is_null=0;
|
||||
@ -2191,6 +2305,8 @@ static void test_long_data_str()
|
||||
bind[0].buffer = (char *)&length;
|
||||
bind[0].buffer_type = FIELD_TYPE_LONG;
|
||||
bind[0].is_null= &is_null[0];
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
is_null[0]=0;
|
||||
length= 0;
|
||||
|
||||
@ -2368,6 +2484,8 @@ static void test_long_data_bin()
|
||||
|
||||
bind[0].buffer = (char *)&length;
|
||||
bind[0].buffer_type = FIELD_TYPE_LONG;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
bind[0].is_null= 0;
|
||||
length= 0;
|
||||
|
||||
@ -2470,6 +2588,8 @@ static void test_simple_delete()
|
||||
|
||||
bind[0].buffer=(char *)&nData;
|
||||
bind[0].buffer_type=FIELD_TYPE_LONG;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
bind[0].is_null= 0;
|
||||
|
||||
rc = mysql_bind_param(stmt,bind);
|
||||
@ -2547,6 +2667,8 @@ static void test_update()
|
||||
|
||||
bind[1].buffer=(char *)&nData;
|
||||
bind[1].buffer_type=FIELD_TYPE_LONG;
|
||||
bind[1].buffer_length= 0;
|
||||
bind[1].length= 0;
|
||||
bind[1].is_null= 0;
|
||||
|
||||
rc = mysql_bind_param(stmt,bind);
|
||||
@ -2573,6 +2695,8 @@ static void test_update()
|
||||
length[0]= my_sprintf(szData, (szData, "updated-data"));
|
||||
bind[1].buffer=(char *)&nData;
|
||||
bind[1].buffer_type=FIELD_TYPE_LONG;
|
||||
bind[1].buffer_length= 0;
|
||||
bind[1].length= 0;
|
||||
bind[1].is_null= 0;
|
||||
|
||||
rc = mysql_bind_param(stmt,bind);
|
||||
@ -2917,24 +3041,31 @@ static void test_bind_result_ext1()
|
||||
|
||||
bind[1].buffer_type=MYSQL_TYPE_FLOAT;
|
||||
bind[1].buffer=(char *)&s_data;
|
||||
bind[1].buffer_length= 0;
|
||||
|
||||
bind[2].buffer_type=MYSQL_TYPE_SHORT;
|
||||
bind[2].buffer=(char *)&i_data;
|
||||
bind[2].buffer_length= 0;
|
||||
|
||||
bind[3].buffer_type=MYSQL_TYPE_TINY;
|
||||
bind[3].buffer=(char *)&b_data;
|
||||
bind[3].buffer_length= 0;
|
||||
|
||||
bind[4].buffer_type=MYSQL_TYPE_LONG;
|
||||
bind[4].buffer=(char *)&f_data;
|
||||
bind[4].buffer_length= 0;
|
||||
|
||||
bind[5].buffer_type=MYSQL_TYPE_STRING;
|
||||
bind[5].buffer=(char *)d_data;
|
||||
bind[5].buffer_length= sizeof(d_data);
|
||||
|
||||
bind[6].buffer_type=MYSQL_TYPE_LONG;
|
||||
bind[6].buffer=(char *)&bData;
|
||||
bind[6].buffer_length= 0;
|
||||
|
||||
bind[7].buffer_type=MYSQL_TYPE_DOUBLE;
|
||||
bind[7].buffer=(char *)&szData;
|
||||
bind[7].buffer_length= 0;
|
||||
|
||||
for (i= 0; i < array_elements(bind); i++)
|
||||
{
|
||||
@ -3011,6 +3142,7 @@ static void bind_fetch(int row_count)
|
||||
{
|
||||
bind[i].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[i].buffer= (char *) &data[i];
|
||||
bind[i].length= 0;
|
||||
bind[i].is_null= 0;
|
||||
}
|
||||
rc = mysql_bind_param(stmt, bind);
|
||||
@ -3564,7 +3696,11 @@ static void test_prepare_ext()
|
||||
bind[5].buffer= (char *)&bData;
|
||||
|
||||
for (i= 0; i < array_elements(bind); i++)
|
||||
{
|
||||
bind[i].is_null=0;
|
||||
bind[i].buffer_length= 0;
|
||||
bind[i].length= 0;
|
||||
}
|
||||
|
||||
rc = mysql_bind_param(stmt,bind);
|
||||
mystmt(stmt, rc);
|
||||
@ -3955,6 +4091,8 @@ static void test_stmt_close()
|
||||
count= 100;
|
||||
bind[0].buffer=(char *)&count;
|
||||
bind[0].buffer_type=MYSQL_TYPE_LONG;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
bind[0].is_null=0;
|
||||
|
||||
rc = mysql_bind_param(stmt_x, bind);
|
||||
@ -4387,12 +4525,14 @@ static void test_multi_stmt()
|
||||
bind[0].buffer_type= MYSQL_TYPE_SHORT;
|
||||
bind[0].buffer= (char *)&id;
|
||||
bind[0].is_null= &is_null[0];
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= &length[0];
|
||||
is_null[0]= 0;
|
||||
length[0]= 0;
|
||||
|
||||
bind[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[1].buffer = (char *)name;
|
||||
bind[1].buffer_length= sizeof(name);
|
||||
bind[1].length = &length[1];
|
||||
bind[1].is_null= &is_null[1];
|
||||
|
||||
@ -4650,8 +4790,11 @@ static void test_prepare_alter()
|
||||
|
||||
verify_param_count(stmt,1);
|
||||
|
||||
is_null= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_SHORT;
|
||||
bind[0].buffer= (char *)&id;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].length= 0;
|
||||
bind[0].is_null= &is_null;
|
||||
|
||||
rc = mysql_bind_param(stmt, bind);
|
||||
@ -5512,6 +5655,8 @@ static void test_buffers()
|
||||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
bzero(buffer, 20); /* Avoid overruns in printf() */
|
||||
|
||||
bind[0].length= &length;
|
||||
bind[0].is_null= &is_null;
|
||||
bind[0].buffer_length= 1;
|
||||
@ -6358,8 +6503,8 @@ static void test_frm_bug()
|
||||
row= mysql_fetch_row(result);
|
||||
mytest(row);
|
||||
|
||||
fprintf(stdout,"\n Comment: %s", row[15]);
|
||||
myassert(row[15] != 0);
|
||||
fprintf(stdout,"\n Comment: %s", row[16]);
|
||||
myassert(row[16] != 0);
|
||||
|
||||
mysql_free_result(result);
|
||||
mysql_stmt_close(stmt);
|
||||
@ -6503,22 +6648,22 @@ static void test_explain_bug()
|
||||
mysql_num_fields(result));
|
||||
myassert(6 == mysql_num_fields(result));
|
||||
|
||||
verify_prepare_field(result,0,"Field","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,0,"Field","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",NAME_LEN,0);
|
||||
|
||||
verify_prepare_field(result,1,"Type","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,1,"Type","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",40,0);
|
||||
|
||||
verify_prepare_field(result,2,"Null","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,2,"Null","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",1,0);
|
||||
|
||||
verify_prepare_field(result,3,"Key","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,3,"Key","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",3,0);
|
||||
|
||||
verify_prepare_field(result,4,"Default","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,4,"Default","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",NAME_LEN,0);
|
||||
|
||||
verify_prepare_field(result,5,"Extra","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,5,"Extra","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",20,0);
|
||||
|
||||
mysql_free_result(result);
|
||||
@ -6542,31 +6687,31 @@ static void test_explain_bug()
|
||||
verify_prepare_field(result,0,"id","",MYSQL_TYPE_LONGLONG,
|
||||
"","","",3,0);
|
||||
|
||||
verify_prepare_field(result,1,"select_type","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,1,"select_type","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",19,0);
|
||||
|
||||
verify_prepare_field(result,2,"table","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,2,"table","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",NAME_LEN,0);
|
||||
|
||||
verify_prepare_field(result,3,"type","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,3,"type","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",10,0);
|
||||
|
||||
verify_prepare_field(result,4,"possible_keys","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,4,"possible_keys","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",NAME_LEN*32,0);
|
||||
|
||||
verify_prepare_field(result,5,"key","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,5,"key","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",NAME_LEN,0);
|
||||
|
||||
verify_prepare_field(result,6,"key_len","",MYSQL_TYPE_LONGLONG,
|
||||
"","","",3,0);
|
||||
|
||||
verify_prepare_field(result,7,"ref","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,7,"ref","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",NAME_LEN*16,0);
|
||||
|
||||
verify_prepare_field(result,8,"rows","",MYSQL_TYPE_LONGLONG,
|
||||
"","","",10,0);
|
||||
|
||||
verify_prepare_field(result,9,"Extra","",MYSQL_TYPE_STRING,
|
||||
verify_prepare_field(result,9,"Extra","",MYSQL_TYPE_VAR_STRING,
|
||||
"","","",255,0);
|
||||
|
||||
mysql_free_result(result);
|
||||
@ -7088,6 +7233,9 @@ static void test_fetch_offset()
|
||||
rc = mysql_fetch_column(stmt,bind,0,0);
|
||||
mystmt_r(stmt,rc);
|
||||
|
||||
rc = mysql_bind_result(stmt, bind);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_stmt_store_result(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
@ -7137,11 +7285,10 @@ static void test_fetch_offset()
|
||||
static void test_fetch_column()
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_BIND bind[1];
|
||||
char c2[20];
|
||||
ulong l1, l2;
|
||||
int rc, c1;
|
||||
|
||||
MYSQL_BIND bind[2];
|
||||
char c2[20], bc2[20];
|
||||
ulong l1, l2, bl1, bl2;
|
||||
int rc, c1, bc1;
|
||||
|
||||
myheader("test_fetch_column");
|
||||
|
||||
@ -7157,25 +7304,41 @@ static void test_fetch_column()
|
||||
stmt = mysql_prepare(mysql,"select * from test_column",50);
|
||||
mystmt_init(stmt);
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&bc1;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &bl1;
|
||||
bind[1].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[1].buffer= (char *)bc2;
|
||||
bind[1].buffer_length= 7;
|
||||
bind[1].is_null= 0;
|
||||
bind[1].length= &bl2;
|
||||
|
||||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_bind_result(stmt, bind);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_stmt_store_result(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_fetch_column(stmt,bind,1,0); /* No-op at this point */
|
||||
mystmt_r(stmt,rc);
|
||||
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
fprintf(stdout, "\n row 0: %d,%s", bc1,bc2);
|
||||
|
||||
c2[0]= '\0'; l2= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[0].buffer= (char *)c2;
|
||||
bind[0].buffer_length= 7;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &l2;
|
||||
|
||||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_stmt_store_result(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_fetch_column(stmt,bind,1,0);
|
||||
mystmt_r(stmt,rc);
|
||||
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
c2[0]= '\0'; l2= 0;
|
||||
rc = mysql_fetch_column(stmt,bind,1,0);
|
||||
mystmt(stmt,rc);
|
||||
fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
|
||||
@ -7188,7 +7351,6 @@ static void test_fetch_column()
|
||||
myassert(strcmp(c2,"venu")==0 && l2 == 4);
|
||||
|
||||
c1= 0;
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&c1;
|
||||
bind[0].buffer_length= 0;
|
||||
@ -7206,15 +7368,15 @@ static void test_fetch_column()
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
fprintf(stdout, "\n row 1: %d,%s", bc1,bc2);
|
||||
|
||||
c2[0]= '\0'; l2= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[0].buffer= (char *)c2;
|
||||
bind[0].buffer_length= 7;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &l2;
|
||||
|
||||
fprintf(stdout, "\n row 1: %d,%s", c1,c2);
|
||||
|
||||
c2[0]= '\0'; l2= 0;
|
||||
rc = mysql_fetch_column(stmt,bind,1,0);
|
||||
mystmt(stmt,rc);
|
||||
fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
|
||||
@ -7227,7 +7389,6 @@ static void test_fetch_column()
|
||||
myassert(strcmp(c2,"mysql")==0 && l2 == 5);
|
||||
|
||||
c1= 0;
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&c1;
|
||||
bind[0].buffer_length= 0;
|
||||
@ -7359,8 +7520,8 @@ static void test_free_result()
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_BIND bind[1];
|
||||
char c2[5];
|
||||
ulong length;
|
||||
int rc, c1;
|
||||
ulong bl1, l2;
|
||||
int rc, c1, bc1;
|
||||
|
||||
myheader("test_free_result");
|
||||
|
||||
@ -7376,39 +7537,47 @@ static void test_free_result()
|
||||
stmt = mysql_prepare(mysql,"select * from test_free_result",50);
|
||||
mystmt_init(stmt);
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[0].buffer= (char *)c2;
|
||||
bind[0].buffer_length= 7;
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&bc1;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &length;
|
||||
bind[0].length= &bl1;
|
||||
|
||||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_bind_result(stmt, bind);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
c2[0]= '\0'; length= 0;
|
||||
c2[0]= '\0'; l2= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[0].buffer= (char *)c2;
|
||||
bind[0].buffer_length= 7;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &l2;
|
||||
|
||||
rc = mysql_fetch_column(stmt,bind,0,0);
|
||||
mystmt(stmt,rc);
|
||||
fprintf(stdout, "\n col 1: %s(%ld)", c2, length);
|
||||
myassert(strncmp(c2,"1",1)==0 && length == 1);
|
||||
fprintf(stdout, "\n col 0: %s(%ld)", c2, l2);
|
||||
myassert(strncmp(c2,"1",1)==0 && l2 == 1);
|
||||
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
c1= 0, length= 0;
|
||||
|
||||
c1= 0, l2= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&c1;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &length;
|
||||
bind[0].length= &l2;
|
||||
|
||||
rc = mysql_fetch_column(stmt,bind,0,0);
|
||||
mystmt(stmt,rc);
|
||||
fprintf(stdout, "\n col 0: %d(%ld)", c1, length);
|
||||
myassert(c1 == 2 && length == 4);
|
||||
fprintf(stdout, "\n col 0: %d(%ld)", c1, l2);
|
||||
myassert(c1 == 2 && l2 == 4);
|
||||
|
||||
rc = mysql_query(mysql,"drop table test_free_result");
|
||||
myquery_r(rc); /* error should be, COMMANDS OUT OF SYNC */
|
||||
@ -7430,8 +7599,8 @@ static void test_free_store_result()
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_BIND bind[1];
|
||||
char c2[5];
|
||||
ulong length;
|
||||
int rc, c1;
|
||||
ulong bl1, l2;
|
||||
int rc, c1, bc1;
|
||||
|
||||
myheader("test_free_store_result");
|
||||
|
||||
@ -7447,42 +7616,50 @@ static void test_free_store_result()
|
||||
stmt = mysql_prepare(mysql,"select * from test_free_result",50);
|
||||
mystmt_init(stmt);
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[0].buffer= (char *)c2;
|
||||
bind[0].buffer_length= 7;
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&bc1;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &length;
|
||||
bind[0].length= &bl1;
|
||||
|
||||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_bind_result(stmt, bind);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_stmt_store_result(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
c2[0]= '\0'; length= 0;
|
||||
c2[0]= '\0'; l2= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[0].buffer= (char *)c2;
|
||||
bind[0].buffer_length= 7;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &l2;
|
||||
|
||||
rc = mysql_fetch_column(stmt,bind,0,0);
|
||||
mystmt(stmt,rc);
|
||||
fprintf(stdout, "\n col 1: %s(%ld)", c2, length);
|
||||
myassert(strncmp(c2,"1",1)==0 && length == 1);
|
||||
fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
|
||||
myassert(strncmp(c2,"1",1)==0 && l2 == 1);
|
||||
|
||||
rc = mysql_fetch(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
c1= 0, length= 0;
|
||||
|
||||
c1= 0, l2= 0;
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer= (char *)&c1;
|
||||
bind[0].buffer_length= 0;
|
||||
bind[0].is_null= 0;
|
||||
bind[0].length= &length;
|
||||
bind[0].length= &l2;
|
||||
|
||||
rc = mysql_fetch_column(stmt,bind,0,0);
|
||||
mystmt(stmt,rc);
|
||||
fprintf(stdout, "\n col 0: %d(%ld)", c1, length);
|
||||
myassert(c1 == 2 && length == 4);
|
||||
fprintf(stdout, "\n col 0: %d(%ld)", c1, l2);
|
||||
myassert(c1 == 2 && l2 == 4);
|
||||
|
||||
rc = mysql_stmt_free_result(stmt);
|
||||
mystmt(stmt,rc);
|
||||
@ -7866,7 +8043,6 @@ int main(int argc, char **argv)
|
||||
test_count= 1;
|
||||
|
||||
start_time= time((time_t *)0);
|
||||
|
||||
client_query(); /* simple client query test */
|
||||
#if NOT_YET_WORKING
|
||||
/* Used for internal new development debugging */
|
||||
@ -7915,7 +8091,6 @@ int main(int argc, char **argv)
|
||||
test_simple_update(); /* simple prepare with update */
|
||||
test_simple_delete(); /* prepare with delete */
|
||||
test_double_compare(); /* float comparision */
|
||||
client_query(); /* simple client query test */
|
||||
client_store_result(); /* usage of mysql_store_result() */
|
||||
client_use_result(); /* usage of mysql_use_result() */
|
||||
test_tran_bdb(); /* transaction test on BDB table type */
|
||||
@ -7959,9 +8134,6 @@ int main(int argc, char **argv)
|
||||
test_nstmts(); /* test n statements */
|
||||
test_logs(); ; /* to test logs */
|
||||
test_cuted_rows(); /* to test for WARNINGS from cuted rows */
|
||||
test_fetch_seek(); /* to test stmt seek() functions */
|
||||
test_fetch_nobuffs(); /* to fecth without prior bound buffers */
|
||||
test_open_direct(); /* direct execution in the middle of open stmts */
|
||||
test_fetch_offset(); /* to test mysql_fetch_column with offset */
|
||||
test_fetch_column(); /* to test mysql_fetch_column */
|
||||
test_mem_overun(); /* test DBD ovverun bug */
|
||||
@ -7969,14 +8141,11 @@ int main(int argc, char **argv)
|
||||
test_free_result(); /* test mysql_stmt_free_result() */
|
||||
test_free_store_result(); /* test to make sure stmt results are cleared
|
||||
during stmt_free_result() */
|
||||
test_mem_overun(); /* memory ovverun bug */
|
||||
test_list_fields(); /* list_fields test */
|
||||
test_fetch_offset(); /* to test mysql_fetch_column with offset */
|
||||
test_fetch_column(); /* to test mysql_fetch_column */
|
||||
test_sqlmode(); /* test for SQL_MODE */
|
||||
test_ts(); /* test for timestamp BR#819 */
|
||||
test_bug1115(); /* BUG#1115 */
|
||||
test_bug1180(); /* BUG#1180 */
|
||||
test_bug1644(); /* BUG#1644 */
|
||||
|
||||
end_time= time((time_t *)0);
|
||||
total_time+= difftime(end_time, start_time);
|
||||
@ -7990,4 +8159,3 @@ int main(int argc, char **argv)
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user