mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
client_test.c:
Modification to new API test sql_prepare.cc: Fix for lock_types
This commit is contained in:
@ -276,8 +276,9 @@ static void setup_param_functions(Item_param *param, uchar read_pos)
|
|||||||
from client ..
|
from client ..
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool setup_params_data(THD *thd, PREP_STMT *stmt)
|
static bool setup_params_data(PREP_STMT *stmt)
|
||||||
{
|
{
|
||||||
|
THD *thd= stmt->thd;
|
||||||
List<Item> ¶ms= thd->lex.param_list;
|
List<Item> ¶ms= thd->lex.param_list;
|
||||||
List_iterator<Item> param_iterator(params);
|
List_iterator<Item> param_iterator(params);
|
||||||
Item_param *param;
|
Item_param *param;
|
||||||
@ -375,8 +376,7 @@ static int check_prepare_fields(THD *thd,TABLE *table, List<Item> &fields,
|
|||||||
static bool mysql_test_insert_fields(PREP_STMT *stmt,
|
static bool mysql_test_insert_fields(PREP_STMT *stmt,
|
||||||
TABLE_LIST *table_list,
|
TABLE_LIST *table_list,
|
||||||
List<Item> &fields,
|
List<Item> &fields,
|
||||||
List<List_item> &values_list,
|
List<List_item> &values_list)
|
||||||
thr_lock_type lock_type)
|
|
||||||
{
|
{
|
||||||
THD *thd= stmt->thd;
|
THD *thd= stmt->thd;
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
@ -384,7 +384,7 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
|
|||||||
List_item *values;
|
List_item *values;
|
||||||
DBUG_ENTER("mysql_test_insert_fields");
|
DBUG_ENTER("mysql_test_insert_fields");
|
||||||
|
|
||||||
if (!(table = open_ltable(thd,table_list,lock_type)))
|
if (!(table = open_ltable(thd,table_list,table_list->lock_type)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
if ((values= its++))
|
if ((values= its++))
|
||||||
@ -427,13 +427,13 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
|
|||||||
|
|
||||||
static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
|
static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
|
||||||
List<Item> &fields, List<Item> &values,
|
List<Item> &fields, List<Item> &values,
|
||||||
COND *conds, thr_lock_type lock_type)
|
COND *conds)
|
||||||
{
|
{
|
||||||
THD *thd= stmt->thd;
|
THD *thd= stmt->thd;
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
DBUG_ENTER("mysql_test_upd_fields");
|
DBUG_ENTER("mysql_test_upd_fields");
|
||||||
|
|
||||||
if (!(table = open_ltable(thd,table_list,lock_type)))
|
if (!(table = open_ltable(thd,table_list,table_list->lock_type)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
if (setup_tables(table_list) || setup_fields(thd,table_list,fields,1,0,0) ||
|
if (setup_tables(table_list) || setup_fields(thd,table_list,fields,1,0,0) ||
|
||||||
@ -465,7 +465,7 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
|
|||||||
static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
||||||
List<Item> &fields, List<Item> &values,
|
List<Item> &fields, List<Item> &values,
|
||||||
COND *conds, ORDER *order, ORDER *group,
|
COND *conds, ORDER *order, ORDER *group,
|
||||||
Item *having, thr_lock_type lock_type)
|
Item *having)
|
||||||
{
|
{
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
bool hidden_group_fields;
|
bool hidden_group_fields;
|
||||||
@ -473,7 +473,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
|||||||
List<Item> all_fields(fields);
|
List<Item> all_fields(fields);
|
||||||
DBUG_ENTER("mysql_test_select_fields");
|
DBUG_ENTER("mysql_test_select_fields");
|
||||||
|
|
||||||
if (!(table = open_ltable(thd,tables,lock_type)))
|
if (!(table = open_ltable(thd,tables,tables->lock_type)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
thd->used_tables=0; // Updated by setup_fields
|
thd->used_tables=0; // Updated by setup_fields
|
||||||
@ -546,21 +546,19 @@ static bool send_prepare_results(PREP_STMT *stmt)
|
|||||||
|
|
||||||
case SQLCOM_INSERT:
|
case SQLCOM_INSERT:
|
||||||
if (mysql_test_insert_fields(stmt, tables, lex->field_list,
|
if (mysql_test_insert_fields(stmt, tables, lex->field_list,
|
||||||
lex->many_values, lex->lock_option))
|
lex->many_values))
|
||||||
goto abort;
|
goto abort;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQLCOM_UPDATE:
|
case SQLCOM_UPDATE:
|
||||||
if (mysql_test_upd_fields(stmt, tables, select_lex->item_list,
|
if (mysql_test_upd_fields(stmt, tables, select_lex->item_list,
|
||||||
lex->value_list, select_lex->where,
|
lex->value_list, select_lex->where))
|
||||||
lex->lock_option))
|
|
||||||
goto abort;
|
goto abort;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQLCOM_DELETE:
|
case SQLCOM_DELETE:
|
||||||
if (mysql_test_upd_fields(stmt, tables, select_lex->item_list,
|
if (mysql_test_upd_fields(stmt, tables, select_lex->item_list,
|
||||||
lex->value_list, select_lex->where,
|
lex->value_list, select_lex->where))
|
||||||
lex->lock_option))
|
|
||||||
goto abort;
|
goto abort;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -568,8 +566,7 @@ static bool send_prepare_results(PREP_STMT *stmt)
|
|||||||
if (mysql_test_select_fields(stmt, tables, select_lex->item_list,
|
if (mysql_test_select_fields(stmt, tables, select_lex->item_list,
|
||||||
lex->value_list, select_lex->where,
|
lex->value_list, select_lex->where,
|
||||||
(ORDER*) select_lex->order_list.first,
|
(ORDER*) select_lex->order_list.first,
|
||||||
(ORDER*) select_lex->group_list.first,
|
(ORDER*) select_lex->group_list.first, select_lex->having))
|
||||||
select_lex->having, lex->lock_option))
|
|
||||||
goto abort;
|
goto abort;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -712,11 +709,9 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stmt->param_count && setup_params_data(thd, stmt))
|
if (stmt->param_count && setup_params_data(stmt))
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
MEM_ROOT thd_root= thd->mem_root;
|
|
||||||
thd->mem_root = thd->con_root;
|
|
||||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||||
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
|
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
|
||||||
|
|
||||||
@ -726,14 +721,12 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
|||||||
mysql_delete(), mysql_update() and mysql_select() to not to
|
mysql_delete(), mysql_update() and mysql_select() to not to
|
||||||
have re-check on setup_* and other things ..
|
have re-check on setup_* and other things ..
|
||||||
*/
|
*/
|
||||||
mysql_execute_command(thd);
|
mysql_execute_command(stmt->thd);
|
||||||
|
|
||||||
thd->last_prepared_stmt= stmt;
|
thd->last_prepared_stmt= stmt;
|
||||||
|
|
||||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||||
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
||||||
|
|
||||||
thd->mem_root= thd_root;
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1358
tests/client_test.c
1358
tests/client_test.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user