diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-10-22 00:02:06 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-10-22 00:02:06 +0400 |
commit | 8ec23470f14323bb85220bae42d154681a4be7f3 (patch) | |
tree | 5a3482665c78a3698f529755e2407524f79327d9 /tests | |
parent | f0ccd917cc2643f1f3b4ede4f742f735dfa50552 (diff) | |
download | mariadb-git-8ec23470f14323bb85220bae42d154681a4be7f3.tar.gz |
Backport of revno 2630.28.10, 2630.28.31, 2630.28.26, 2630.33.1,
2630.39.1, 2630.28.29, 2630.34.3, 2630.34.2, 2630.34.1, 2630.29.29,
2630.29.28, 2630.31.1, 2630.28.13, 2630.28.10, 2617.23.14 and
some other minor revisions.
This patch implements:
WL#4264 "Backup: Stabilize Service Interface" -- all the
server prerequisites except si_objects.{h,cc} themselves (they can
be just copied over, when needed).
WL#4435: Support OUT-parameters in prepared statements.
(and all issues in the initial patches for these two
tasks, that were discovered in pushbuild and during testing).
Bug#39519: mysql_stmt_close() should flush all data
associated with the statement.
After execution of a prepared statement, send OUT parameters of the invoked
stored procedure, if any, to the client.
When using the binary protocol, send the parameters in an additional result
set over the wire. When using the text protocol, assign out parameters to
the user variables from the CALL(@var1, @var2, ...) specification.
The following refactoring has been made:
- Protocol::send_fields() was renamed to Protocol::send_result_set_metadata();
- A new Protocol::send_result_set_row() was introduced to incapsulate
common functionality for sending row data.
- Signature of Protocol::prepare_for_send() was changed: this operation
does not need a list of items, the number of items is fully sufficient.
The following backward incompatible changes have been made:
- CLIENT_MULTI_RESULTS is now enabled by default in the client;
- CLIENT_PS_MULTI_RESUTLS is now enabled by default in the client.
include/mysql.h:
Add a new flag to MYSQL_METHODS::flush_use_result
function pointer. This flag determines if all results
should be flushed or only the first one:
- if flush_all_results is TRUE, then cli_flush_use_result()
will read/flush all pending results. I.e. it will read
all packets while server status attribute indicates that
there are more results. This is a new semantic, required
to fix the bug.
- if flush_all_results is FALSE, the old sematic
is preserved -- i.e. cli_flush_use_result() reads data
until first EOF-packet.
include/mysql.h.pp:
Update the ABI with new calls (compatible changes).
include/mysql_com.h:
Add CLIENT_PS_OUT_PARAMS -- a client capability indicating that the client supportsю
libmysql/libmysql.c:
Add mysql_stmt_next_result() -- analogue of mysql_next_result() for binary protocol.
Fix a minor bug in alloc_fields() -- not all members were copied over,
and some only shallow-copied (catalog).
Flush all results in mysql_stmt_close() (Bug#39519).
libmysqld/lib_sql.cc:
Rename send_fields() -> send_result_set_metadata().
Refactoring: change prepare_for_send() so that it accepts only
what it really needs -- a number of elements in the list.
mysql-test/r/ps.result:
Update results: WL#4435.
mysql-test/t/ps.test:
WL#4435: A test case for an SQL-part of the problem.
sql-common/client.c:
Bug#39519.
Implement new functionality in cli_flush_use_result():
if flush_all_delete is TRUE, then it should read/flush
all pending results.
sql/Makefile.am:
Add a new header sql_prepare.h to the list
of build headers.
sql/events.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/handler.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/mysql_priv.h:
Move sql_prepare.cc-specific declarations to a new
header - sql_prepare.h.
sql/procedure.h:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/protocol.cc:
Move the logic responsible for sending of one result
set row to the Protocol class. Define a template
for end-of-statement action.
Refactoring: change prepare_for_send() so that it accepts
only what it really needs -- a number of elements in the list.
Rename send_fields() to send_result_set_metadata().
sql/protocol.h:
Update with new declarations (WL#4435).
Rename send_fields() -> send_result_set_metadata().
prepare_for_send() only needs the number of columns to send,
and doesn't use the item list - update signature to require
only what's needed.
Add a new protocol type -- Protocol_local.
sql/repl_failsafe.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/slave.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_acl.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_base.cc:
Include sql_prepare.h (for Reprepare_observer).
sql/sql_cache.cc:
Extend the query cache flags block to be able
to store a numeric id for the result format,
not just a flag binary/non-binary.
sql/sql_class.cc:
Update to use the rename of Protocol::send_fields()
to Protocol::send_result_set_metadata().
Use Protocol::send_one_result_set_row().
sql/sql_class.h:
Move the declaration of Reprepare_observer to the
new header - sql_prepare.h.
Update to the new signature of class Protocol::send_fields().
sql/sql_connect.cc:
Use a protocol template method instead of
raw NET layer API at the end of a statement.
sql/sql_cursor.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_error.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_handler.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
Use new method Protocol::send_one_result_set_row().
sql/sql_help.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_lex.cc:
Initialize multi_statements variable.
Add a handy constant for empty lex
string.
sql/sql_lex.h:
Add a separate member for a standalone
parsing option - multi-statements support.
sql/sql_list.cc:
sql_list.h is a standalone header now,
no need to include mysql_priv.h.
sql/sql_list.h:
Make sql_list.h a stand-alone header.
sql/sql_parse.cc:
Include sql_prepare.h for prepared
statements- related declarations.
Use a new Protocol template method to end
each statement (send OK, EOF or ERROR to
the client).
sql/sql_prepare.cc:
Implement Execute Direct API (WL#4264),
currently unused. It will be used by the service
interface (Backup).
Use a new header - sql_prepare.h.
Add support for OUT parameters in the
binary and text protocol (prepared statements
only).
sql/sql_prepare.h:
Add a new header to contain (for now)
all prepared statement- external
related declarations.
sql/sql_profile.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_repl.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_select.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_show.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_string.h:
Add a way to convert a String to LEX_STRING.
sql/sql_table.cc:
Rename: Protocol::send_fields() ->
Protocol::send_result_set_metadata().
sql/sql_update.cc:
Remove an extraneous my_error(). The error
is already reported in update_non_unique_table_error().
sql/sql_yacc.yy:
Support for multi-statements is an independent
property of parsing, not derived from
the protocol type.
tests/mysql_client_test.c:
Add tests for WL#4435 (binary protocol).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 571 |
1 files changed, 567 insertions, 4 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 5be0fe18824..39df4c7e89c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -1516,6 +1516,568 @@ static void test_prepare_simple() myquery(rc); } +/************************************************************************/ + +#define FILE_PATH_SIZE 4096 + +char mct_log_file_path[FILE_PATH_SIZE]; +FILE *mct_log_file= NULL; + +void mct_start_logging(const char *test_case_name) +{ + const char *tmp_dir= getenv("MYSQL_TMP_DIR"); + + if (!tmp_dir) + { + printf("Warning: MYSQL_TMP_DIR is not set. Logging is disabled.\n"); + return; + } + + if (mct_log_file) + { + printf("Warning: can not start logging for test case '%s' " + "because log is already open\n", + (const char *) test_case_name); + return; + } + + /* + Path is: <tmp_dir>/<test_case_name>.out.log + 10 is length of '/' + '.out.log' + \0 + */ + + if (strlen(tmp_dir) + strlen(test_case_name) + 10 > FILE_PATH_SIZE) + { + printf("Warning: MYSQL_TMP_DIR is too long. Logging is disabled.\n"); + return; + } + + my_snprintf(mct_log_file_path, FILE_PATH_SIZE, + "%s/%s.out.log", + (const char *) tmp_dir, + (const char *) test_case_name); + + mct_log_file= my_fopen(mct_log_file_path, O_WRONLY | O_BINARY, MYF(MY_WME)); + + if (!mct_log_file) + { + printf("Warning: can not open log file (%s): %s. Logging is disabled.\n", + (const char *) mct_log_file_path, + (const char *) strerror(errno)); + return; + } +} + +void mct_log(const char *format, ...) +{ + va_list args; + va_start(args, format); + vprintf(format, args); + va_end(args); + + if (mct_log_file) + { + va_list args; + va_start(args, format); + vfprintf(mct_log_file, format, args); + va_end(args); + } +} + +void mct_close_log() +{ + if (!mct_log_file) + return; + + my_fclose(mct_log_file, MYF(0)); + mct_log_file= NULL; +} + +#define WL4435_NUM_PARAMS 10 +#define WL4435_STRING_SIZE 30 + +static void test_wl4435() +{ + MYSQL_STMT *stmt; + int rc; + char query[MAX_TEST_QUERY_LENGTH]; + + char str_data[20][WL4435_STRING_SIZE]; + double dbl_data[20]; + char dec_data[20][WL4435_STRING_SIZE]; + int int_data[20]; + ulong str_length= WL4435_STRING_SIZE; + my_bool is_null; + MYSQL_BIND ps_params[WL4435_NUM_PARAMS]; + + int exec_counter; + + myheader("test_wl4435"); + mct_start_logging("test_wl4435"); + + rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1"); + myquery(rc); + + rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p2"); + myquery(rc); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t2"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t1(a1 INT, a2 CHAR(32), " + " a3 DOUBLE(4, 2), a4 DECIMAL(3, 1))"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t2(b0 INT, b1 INT, b2 CHAR(32), " + " b3 DOUBLE(4, 2), b4 DECIMAL(3, 1))"); + myquery(rc); + + rc= mysql_query(mysql, "INSERT INTO t1 VALUES" + "(1, '11', 12.34, 56.7), " + "(2, '12', 56.78, 90.1), " + "(3, '13', 23.45, 67.8)"); + myquery(rc); + + rc= mysql_query(mysql, "INSERT INTO t2 VALUES" + "(100, 10, '110', 70.70, 10.1), " + "(200, 20, '120', 80.80, 20.2), " + "(300, 30, '130', 90.90, 30.3)"); + myquery(rc); + + rc= mysql_query(mysql, + "CREATE PROCEDURE p1(" + " IN v0 INT, " + " OUT v_str_1 CHAR(32), " + " OUT v_dbl_1 DOUBLE(4, 2), " + " OUT v_dec_1 DECIMAL(6, 3), " + " OUT v_int_1 INT, " + " IN v1 INT, " + " INOUT v_str_2 CHAR(64), " + " INOUT v_dbl_2 DOUBLE(5, 3), " + " INOUT v_dec_2 DECIMAL(7, 4), " + " INOUT v_int_2 INT)" + "BEGIN " + " SET v0 = -1; " + " SET v1 = -1; " + " SET v_str_1 = 'test_1'; " + " SET v_dbl_1 = 12.34; " + " SET v_dec_1 = 567.891; " + " SET v_int_1 = 2345; " + " SET v_str_2 = 'test_2'; " + " SET v_dbl_2 = 67.891; " + " SET v_dec_2 = 234.6789; " + " SET v_int_2 = 6789; " + " SELECT * FROM t1; " + " SELECT * FROM t2; " + "END"); + myquery(rc); + + rc= mysql_query(mysql, + "CREATE PROCEDURE p2(" + " IN i1 VARCHAR(255) CHARACTER SET koi8r, " + " OUT o1 VARCHAR(255) CHARACTER SET cp1251, " + " OUT o2 VARBINARY(255)) " + "BEGIN " + " SET o1 = i1; " + " SET o2 = i1; " + "END"); + myquery(rc); + + strmov(query, "CALL p1(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + /* Init PS-parameters. */ + + bzero((char *) ps_params, sizeof (ps_params)); + + /* - v0 -- INT */ + + ps_params[0].buffer_type= MYSQL_TYPE_LONG; + ps_params[0].buffer= (char *) &int_data[0]; + ps_params[0].length= 0; + ps_params[0].is_null= 0; + + /* - v_str_1 -- CHAR(32) */ + + ps_params[1].buffer_type= MYSQL_TYPE_STRING; + ps_params[1].buffer= (char *) str_data[0]; + ps_params[1].buffer_length= WL4435_STRING_SIZE; + ps_params[1].length= &str_length; + ps_params[1].is_null= 0; + + /* - v_dbl_1 -- DOUBLE */ + + ps_params[2].buffer_type= MYSQL_TYPE_DOUBLE; + ps_params[2].buffer= (char *) &dbl_data[0]; + ps_params[2].length= 0; + ps_params[2].is_null= 0; + + /* - v_dec_1 -- DECIMAL */ + + ps_params[3].buffer_type= MYSQL_TYPE_NEWDECIMAL; + ps_params[3].buffer= (char *) dec_data[0]; + ps_params[3].buffer_length= WL4435_STRING_SIZE; + ps_params[3].length= 0; + ps_params[3].is_null= 0; + + /* - v_int_1 -- INT */ + + ps_params[4].buffer_type= MYSQL_TYPE_LONG; + ps_params[4].buffer= (char *) &int_data[0]; + ps_params[4].length= 0; + ps_params[4].is_null= 0; + + /* - v1 -- INT */ + + ps_params[5].buffer_type= MYSQL_TYPE_LONG; + ps_params[5].buffer= (char *) &int_data[0]; + ps_params[5].length= 0; + ps_params[5].is_null= 0; + + /* - v_str_2 -- CHAR(32) */ + + ps_params[6].buffer_type= MYSQL_TYPE_STRING; + ps_params[6].buffer= (char *) str_data[0]; + ps_params[6].buffer_length= WL4435_STRING_SIZE; + ps_params[6].length= &str_length; + ps_params[6].is_null= 0; + + /* - v_dbl_2 -- DOUBLE */ + + ps_params[7].buffer_type= MYSQL_TYPE_DOUBLE; + ps_params[7].buffer= (char *) &dbl_data[0]; + ps_params[7].length= 0; + ps_params[7].is_null= 0; + + /* - v_dec_2 -- DECIMAL */ + + ps_params[8].buffer_type= MYSQL_TYPE_DECIMAL; + ps_params[8].buffer= (char *) dec_data[0]; + ps_params[8].buffer_length= WL4435_STRING_SIZE; + ps_params[8].length= 0; + ps_params[8].is_null= 0; + + /* - v_int_2 -- INT */ + + ps_params[9].buffer_type= MYSQL_TYPE_LONG; + ps_params[9].buffer= (char *) &int_data[0]; + ps_params[9].length= 0; + ps_params[9].is_null= 0; + + /* Bind parameters. */ + + rc= mysql_stmt_bind_param(stmt, ps_params); + + /* Execute! */ + + for (exec_counter= 0; exec_counter < 3; ++exec_counter) + { + int i; + int num_fields; + MYSQL_BIND *rs_bind; + + mct_log("\nexec_counter: %d\n", (int) exec_counter); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + while (1) + { + MYSQL_FIELD *fields; + + MYSQL_RES *rs_metadata= mysql_stmt_result_metadata(stmt); + + num_fields= mysql_stmt_field_count(stmt); + fields= mysql_fetch_fields(rs_metadata); + + rs_bind= (MYSQL_BIND *) malloc(sizeof (MYSQL_BIND) * num_fields); + bzero(rs_bind, sizeof (MYSQL_BIND) * num_fields); + + mct_log("num_fields: %d\n", (int) num_fields); + + for (i = 0; i < num_fields; ++i) + { + mct_log(" - %d: name: '%s'/'%s'; table: '%s'/'%s'; " + "db: '%s'; catalog: '%s'; length: %d; max_length: %d; " + "type: %d; decimals: %d\n", + (int) i, + (const char *) fields[i].name, + (const char *) fields[i].org_name, + (const char *) fields[i].table, + (const char *) fields[i].org_table, + (const char *) fields[i].db, + (const char *) fields[i].catalog, + (int) fields[i].length, + (int) fields[i].max_length, + (int) fields[i].type, + (int) fields[i].decimals); + + rs_bind[i].buffer_type= fields[i].type; + rs_bind[i].is_null= &is_null; + + switch (fields[i].type) + { + case MYSQL_TYPE_LONG: + rs_bind[i].buffer= (char *) &(int_data[i]); + rs_bind[i].buffer_length= sizeof (int_data); + break; + + case MYSQL_TYPE_STRING: + rs_bind[i].buffer= (char *) str_data[i]; + rs_bind[i].buffer_length= WL4435_STRING_SIZE; + rs_bind[i].length= &str_length; + break; + + case MYSQL_TYPE_DOUBLE: + rs_bind[i].buffer= (char *) &dbl_data[i]; + rs_bind[i].buffer_length= sizeof (dbl_data); + break; + + case MYSQL_TYPE_NEWDECIMAL: + rs_bind[i].buffer= (char *) dec_data[i]; + rs_bind[i].buffer_length= WL4435_STRING_SIZE; + rs_bind[i].length= &str_length; + break; + + default: + fprintf(stderr, "ERROR: unexpected type: %d.\n", fields[i].type); + exit(1); + } + } + + rc= mysql_stmt_bind_result(stmt, rs_bind); + check_execute(stmt, rc); + + mct_log("Data:\n"); + + while (1) + { + int rc= mysql_stmt_fetch(stmt); + + if (rc == 1 || rc == MYSQL_NO_DATA) + break; + + mct_log(" "); + + for (i = 0; i < num_fields; ++i) + { + switch (rs_bind[i].buffer_type) + { + case MYSQL_TYPE_LONG: + mct_log(" int: %ld;", + (long) *((int *) rs_bind[i].buffer)); + break; + + case MYSQL_TYPE_STRING: + mct_log(" str: '%s';", + (char *) rs_bind[i].buffer); + break; + + case MYSQL_TYPE_DOUBLE: + mct_log(" dbl: %lf;", + (double) *((double *) rs_bind[i].buffer)); + break; + + case MYSQL_TYPE_NEWDECIMAL: + mct_log(" dec: '%s';", + (char *) rs_bind[i].buffer); + break; + + default: + printf(" unexpected type (%d)\n", + rs_bind[i].buffer_type); + } + } + mct_log("\n"); + } + + mct_log("EOF\n"); + + rc= mysql_stmt_next_result(stmt); + mct_log("mysql_stmt_next_result(): %d; field_count: %d\n", + (int) rc, (int) mysql->field_count); + + free(rs_bind); + mysql_free_result(rs_metadata); + + if (rc > 0) + { + printf("Error: %s (errno: %d)\n", + mysql_stmt_error(stmt), mysql_stmt_errno(stmt)); + DIE(rc > 0); + } + + if (rc) + break; + + if (!mysql->field_count) + { + /* This is the last OK-packet. No more resultsets. */ + break; + } + } + + } + + mysql_stmt_close(stmt); + + mct_close_log(); + + rc= mysql_commit(mysql); + myquery(rc); + + /* i18n part of test case. */ + + { + const char *str_koi8r= "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5"; + const char *str_cp1251= "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3"; + char o1_buffer[255]; + ulong o1_length; + char o2_buffer[255]; + ulong o2_length; + + MYSQL_BIND rs_bind[2]; + + strmov(query, "CALL p2(?, ?, ?)"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + /* Init PS-parameters. */ + + bzero((char *) ps_params, sizeof (ps_params)); + + ps_params[0].buffer_type= MYSQL_TYPE_STRING; + ps_params[0].buffer= (char *) str_koi8r; + ps_params[0].buffer_length= strlen(str_koi8r); + + ps_params[1].buffer_type= MYSQL_TYPE_STRING; + ps_params[1].buffer= o1_buffer; + ps_params[1].buffer_length= 0; + + ps_params[2].buffer_type= MYSQL_TYPE_STRING; + ps_params[2].buffer= o2_buffer; + ps_params[2].buffer_length= 0; + + /* Bind parameters. */ + + rc= mysql_stmt_bind_param(stmt, ps_params); + check_execute(stmt, rc); + + /* Prevent converting to character_set_results. */ + + rc= mysql_query(mysql, "SET NAMES binary"); + myquery(rc); + + /* Execute statement. */ + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + /* Bind result. */ + + bzero(rs_bind, sizeof (rs_bind)); + + rs_bind[0].buffer_type= MYSQL_TYPE_STRING; + rs_bind[0].buffer= o1_buffer; + rs_bind[0].buffer_length= sizeof (o1_buffer); + rs_bind[0].length= &o1_length; + + rs_bind[1].buffer_type= MYSQL_TYPE_BLOB; + rs_bind[1].buffer= o2_buffer; + rs_bind[1].buffer_length= sizeof (o2_buffer); + rs_bind[1].length= &o2_length; + + rc= mysql_stmt_bind_result(stmt, rs_bind); + check_execute(stmt, rc); + + /* Fetch result. */ + + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + + /* Check result. */ + + DIE_UNLESS(o1_length == strlen(str_cp1251)); + DIE_UNLESS(o2_length == strlen(str_koi8r)); + DIE_UNLESS(!memcmp(o1_buffer, str_cp1251, o1_length)); + DIE_UNLESS(!memcmp(o2_buffer, str_koi8r, o2_length)); + + rc= mysql_stmt_fetch(stmt); + DIE_UNLESS(rc == MYSQL_NO_DATA); + + rc= mysql_stmt_next_result(stmt); + DIE_UNLESS(rc == 0 && mysql->field_count == 0); + + mysql_stmt_close(stmt); + + rc= mysql_commit(mysql); + myquery(rc); + } +} + +static void test_wl4435_2() +{ + MYSQL_STMT *stmt; + int i; + int rc; + char query[MAX_TEST_QUERY_LENGTH]; + + myheader("test_wl4435_2"); + mct_start_logging("test_wl4435_2"); + + /* + Do a few iterations so that we catch any problem with incorrect + handling/flushing prepared statement results. + */ + + for (i= 0; i < 10; ++i) + { + /* + Prepare a procedure. That can be moved out of the loop, but it was + left in the loop for the sake of having as many statements as + possible. + */ + + rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1"); + myquery(rc); + + rc= mysql_query(mysql, + "CREATE PROCEDURE p1()" + "BEGIN " + " SELECT 1; " + " SELECT 2, 3 UNION SELECT 4, 5; " + " SELECT 6, 7, 8; " + "END"); + myquery(rc); + + /* Invoke a procedure, that returns several result sets. */ + + strmov(query, "CALL p1()"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + /* Execute! */ + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + /* Flush all the results. */ + + mysql_stmt_close(stmt); + + /* Clean up. */ + rc= mysql_commit(mysql); + myquery(rc); + + rc= mysql_query(mysql, "DROP PROCEDURE p1"); + myquery(rc); + } +} + /* Test simple prepare field results */ @@ -14476,9 +15038,8 @@ static void test_bug12001() /* Create connection that supports multi statements */ if (!mysql_real_connect(mysql_local, opt_host, opt_user, - opt_password, current_db, opt_port, - opt_unix_socket, CLIENT_MULTI_STATEMENTS | - CLIENT_MULTI_RESULTS)) + opt_password, current_db, opt_port, + opt_unix_socket, CLIENT_MULTI_STATEMENTS)) { fprintf(stdout, "\n mysql_real_connect() failed"); exit(1); @@ -15846,7 +16407,7 @@ static void test_bug15752() if (! mysql_real_connect(&mysql_local, opt_host, opt_user, opt_password, current_db, opt_port, opt_unix_socket, - CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS)) + CLIENT_MULTI_STATEMENTS)) { printf("Unable connect to MySQL server: %s\n", mysql_error(&mysql_local)); DIE_UNLESS(0); @@ -18565,6 +19126,8 @@ static struct my_tests_st my_tests[]= { { "test_wl4166_2", test_wl4166_2 }, { "test_wl4166_3", test_wl4166_3 }, { "test_wl4166_4", test_wl4166_4 }, + { "test_wl4435", test_wl4435 }, + { "test_wl4435_2", test_wl4435_2 }, { "test_bug38486", test_bug38486 }, { "test_bug33831", test_bug33831 }, { "test_bug40365", test_bug40365 }, |