mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-select-4.1 mysql-test/r/subselect.result: Auto merged mysql-test/t/subselect.test: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged
This commit is contained in:
commit
b343de721e
6 changed files with 76 additions and 52 deletions
|
@ -32,7 +32,7 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
|
||||
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL };
|
||||
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY };
|
||||
|
||||
#ifndef __WIN__
|
||||
#define HANDLE void *
|
||||
|
|
|
@ -5299,14 +5299,11 @@ static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
|
|||
int4store(buff, stmt->stmt_id);
|
||||
error= simple_command(stmt->mysql, COM_CLOSE_STMT, buff, 4, 1);
|
||||
}
|
||||
if (!error)
|
||||
{
|
||||
mysql_free_result(stmt->result);
|
||||
free_root(&stmt->mem_root, MYF(0));
|
||||
if (!skip_list)
|
||||
stmt->mysql->stmts= list_delete(stmt->mysql->stmts, &stmt->list);
|
||||
my_free((gptr) stmt, MYF(MY_WME));
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -3193,7 +3193,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
|
|||
}
|
||||
|
||||
/* storing the key in the buffer. */
|
||||
memcpy (ft_buf->buf, a+val_off, val_len);
|
||||
memcpy (ft_buf->buf, (char *)a+val_off, val_len);
|
||||
ft_buf->buf+=val_len;
|
||||
if (ft_buf->buf < ft_buf->end)
|
||||
return 0;
|
||||
|
|
|
@ -469,11 +469,13 @@ int THD::send_explain_fields(select_result *result)
|
|||
void THD::close_active_vio()
|
||||
{
|
||||
safe_mutex_assert_owner(&LOCK_delete);
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (active_vio)
|
||||
{
|
||||
vio_close(active_vio);
|
||||
active_vio = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ int compare_prep_stmt(void *not_used, PREP_STMT *stmt, ulong *key)
|
|||
|
||||
void free_prep_stmt(PREP_STMT *stmt, TREE_FREE mode, void *not_used)
|
||||
{
|
||||
my_free((char *)stmt->param, MYF(MY_ALLOW_ZERO_PTR));
|
||||
free_items(stmt->free_list);
|
||||
free_root(&stmt->mem_root, MYF(0));
|
||||
}
|
||||
|
@ -689,12 +690,17 @@ static bool init_param_items(PREP_STMT *stmt)
|
|||
List<Item> ¶ms= stmt->thd->lex.param_list;
|
||||
Item_param **to;
|
||||
|
||||
if (!stmt->param_count)
|
||||
stmt->param= (Item_param **)0;
|
||||
else
|
||||
{
|
||||
if (!(stmt->param= to= (Item_param **)
|
||||
my_malloc(sizeof(Item_param *)*(stmt->param_count+1),
|
||||
MYF(MY_WME))))
|
||||
return 1;
|
||||
List_iterator<Item> param_iterator(params);
|
||||
while ((*(to++)= (Item_param *)param_iterator++));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -884,9 +890,8 @@ void mysql_stmt_free(THD *thd, char *packet)
|
|||
send_error(thd); // Not seen by the client
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
my_free((char *)stmt->param, MYF(MY_ALLOW_ZERO_PTR));
|
||||
tree_delete(&thd->prepared_statements, (void*) &stmt, (void *)0);
|
||||
thd->last_prepared_stmt=0;
|
||||
tree_delete(&thd->prepared_statements, (void*) &stmt_id, (void *)0);
|
||||
thd->last_prepared_stmt= (PREP_STMT *)0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
@ -284,6 +284,7 @@ static void my_print_result_metadata(MYSQL_RES *result)
|
|||
|
||||
mysql_field_seek(result,0);
|
||||
fputc('\n', stdout);
|
||||
fputc('\n', stdout);
|
||||
|
||||
field_count = mysql_num_fields(result);
|
||||
for(i=0; i< field_count; i++)
|
||||
|
@ -702,6 +703,7 @@ static void test_tran_bdb()
|
|||
mytest(result);
|
||||
|
||||
my_process_result_set(result);
|
||||
mysql_free_result(result);
|
||||
|
||||
/* test the results now, only one row should exists */
|
||||
rc = mysql_query(mysql,"SELECT * FROM my_demo_transaction");
|
||||
|
@ -779,6 +781,7 @@ static void test_tran_innodb()
|
|||
mytest(result);
|
||||
|
||||
my_process_result_set(result);
|
||||
mysql_free_result(result);
|
||||
|
||||
/* test the results now, only one row should exists */
|
||||
rc = mysql_query(mysql,"SELECT * FROM my_demo_transaction");
|
||||
|
@ -930,6 +933,7 @@ static void test_prepare_field_result()
|
|||
param_count= mysql_num_fields(result);
|
||||
fprintf(stdout,"\n\n total fields: `%d` (expected: `5`)", param_count);
|
||||
myassert(param_count == 5);
|
||||
mysql_free_result(result);
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
||||
|
@ -1478,7 +1482,7 @@ static void test_select_direct()
|
|||
*********************************************************/
|
||||
static void test_select_prepare()
|
||||
{
|
||||
int rc, count;
|
||||
int rc;
|
||||
MYSQL_STMT *stmt;
|
||||
|
||||
myheader("test_select_prepare");
|
||||
|
@ -1511,7 +1515,8 @@ static void test_select_prepare()
|
|||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
count= my_process_stmt_result(stmt);
|
||||
myassert(1 == my_process_stmt_result(stmt));
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
rc = mysql_query(mysql,"DROP TABLE test_select");
|
||||
myquery(rc);
|
||||
|
@ -1540,8 +1545,7 @@ static void test_select_prepare()
|
|||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt,rc);
|
||||
|
||||
my_process_stmt_result(stmt);
|
||||
|
||||
myassert(1 == my_process_stmt_result(stmt));
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
||||
|
@ -1615,7 +1619,7 @@ static void test_select()
|
|||
rc = mysql_execute(stmt);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
myassert(my_process_stmt_result(stmt) != 0);
|
||||
myassert(my_process_stmt_result(stmt) == 1);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
@ -1817,6 +1821,7 @@ static void test_long_data()
|
|||
verify_col_data("test_long_data","col1","999");
|
||||
verify_col_data("test_long_data","col2","Michael 'Monty' Widenius");
|
||||
verify_col_data("test_long_data","col3","Venu");
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3608,8 +3613,9 @@ static void test_stmt_close()
|
|||
fprintf(stdout,"\n mysql_close_stmt(1) returned: %d", rc);
|
||||
myassert(rc == 0);
|
||||
|
||||
mysql_close(lmysql); /* it should free all open stmts(stmt3, stmt2) */
|
||||
mysql_close(lmysql); /* it should free all open stmts(stmt3, 2 and 1) */
|
||||
|
||||
#if NOT_VALID
|
||||
rc= mysql_stmt_close(stmt3);
|
||||
fprintf(stdout,"\n mysql_close_stmt(3) returned: %d", rc);
|
||||
myassert( rc == 1);
|
||||
|
@ -3617,6 +3623,7 @@ static void test_stmt_close()
|
|||
rc= mysql_stmt_close(stmt2);
|
||||
fprintf(stdout,"\n mysql_close_stmt(2) returned: %d", rc);
|
||||
myassert( rc == 1);
|
||||
#endif
|
||||
|
||||
count= 100;
|
||||
bind[0].buffer=(char *)&count;
|
||||
|
@ -3625,6 +3632,7 @@ static void test_stmt_close()
|
|||
|
||||
rc = mysql_bind_param(stmt_x, bind);
|
||||
mystmt(stmt_x, rc);
|
||||
|
||||
rc = mysql_execute(stmt_x);
|
||||
mystmt(stmt_x, rc);
|
||||
|
||||
|
@ -3673,7 +3681,6 @@ static void test_set_variable()
|
|||
result= mysql_param_result(stmt);
|
||||
mytest_r(result);
|
||||
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_LONG;
|
||||
bind[0].buffer=(char *)&select_limit;
|
||||
bind[0].is_null=0;
|
||||
|
@ -3745,6 +3752,8 @@ static void test_insert_meta()
|
|||
result= mysql_param_result(stmt);
|
||||
mytest_r(result);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
strmov(query,"INSERT INTO test_prep_insert VALUES(?,'venu',?)");
|
||||
stmt = mysql_prepare(mysql, query, strlen(query));
|
||||
mystmt_init(stmt);
|
||||
|
@ -3807,6 +3816,8 @@ static void test_update_meta()
|
|||
result= mysql_param_result(stmt);
|
||||
mytest_r(result);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
strmov(query,"UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?");
|
||||
stmt = mysql_prepare(mysql, query, strlen(query));
|
||||
mystmt_init(stmt);
|
||||
|
@ -3901,7 +3912,7 @@ static void test_select_meta()
|
|||
|
||||
field= mysql_fetch_field(result);
|
||||
mytest_r(field);
|
||||
n
|
||||
|
||||
mysql_free_result(result);
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
@ -4023,7 +4034,6 @@ static void test_multi_stmt()
|
|||
bind[1].length = &length[1];
|
||||
bind[1].is_null= &is_null[0];
|
||||
|
||||
|
||||
rc = mysql_bind_param(stmt, bind);
|
||||
mystmt(stmt, rc);
|
||||
|
||||
|
@ -4626,7 +4636,6 @@ static void test_store_result2()
|
|||
|
||||
rc = mysql_fetch(stmt);
|
||||
myassert(rc == MYSQL_NO_DATA);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
||||
|
@ -5237,6 +5246,9 @@ static void get_options(int argc, char **argv)
|
|||
*********************************************************/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
time_t start_time, end_time;
|
||||
double total_time= 0;
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
get_options(argc,argv);
|
||||
|
||||
|
@ -5245,7 +5257,9 @@ int main(int argc, char **argv)
|
|||
for (iter_count=1; iter_count <= opt_count; iter_count++)
|
||||
{
|
||||
/* Start of tests */
|
||||
test_count= 0;
|
||||
test_count= 1;
|
||||
|
||||
start_time= time((time_t *)0);
|
||||
|
||||
test_fetch_null(); /* to fetch null data */
|
||||
test_fetch_date(); /* to fetch date,time and timestamp */
|
||||
|
@ -5319,14 +5333,20 @@ int main(int argc, char **argv)
|
|||
test_manual_sample(); /* sample in the manual */
|
||||
test_pure_coverage(); /* keep pure coverage happy */
|
||||
test_buffers(); /* misc buffer handling */
|
||||
|
||||
end_time= time((time_t *)0);
|
||||
total_time+= difftime(end_time, start_time);
|
||||
/* End of tests */
|
||||
}
|
||||
|
||||
client_disconnect(); /* disconnect from server */
|
||||
fprintf(stdout,"\n\nAll '%d' tests were successful (in '%d' iterations)",
|
||||
test_count-1, opt_count);
|
||||
fprintf(stdout,"\n Total execution time: %g SECS", total_time);
|
||||
if (opt_count > 1)
|
||||
fprintf(stdout," (Avg: %g SECS)", total_time/opt_count);
|
||||
|
||||
fprintf(stdout,"\nSUCCESS !!!\n");
|
||||
fprintf(stdout,"\n\nSUCCESS !!!\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue