mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Use an API instead of looking into stmt internals to fetch fields
(Test for Bug#32265) tests/mysql_client_test.c: Use an API instead of looking into stmt internals to fetch fields.
This commit is contained in:
parent
98e7d709bb
commit
2967e4e104
1 changed files with 17 additions and 5 deletions
|
@ -16120,6 +16120,7 @@ static void test_bug32265()
|
|||
int rc;
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_FIELD *field;
|
||||
MYSQL_RES *metadata;
|
||||
|
||||
DBUG_ENTER("test_bug32265");
|
||||
myheader("test_bug32265");
|
||||
|
@ -16137,50 +16138,61 @@ static void test_bug32265()
|
|||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
field= stmt->mysql->fields;
|
||||
metadata= mysql_stmt_result_metadata(stmt);
|
||||
field= mysql_fetch_field(metadata);
|
||||
DIE_UNLESS(field);
|
||||
DIE_UNLESS(strcmp(field->table, "t1") == 0);
|
||||
DIE_UNLESS(strcmp(field->org_table, "t1") == 0);
|
||||
DIE_UNLESS(strcmp(field->db, "client_test_db") == 0);
|
||||
mysql_free_result(metadata);
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
stmt= open_cursor("SELECT a '' FROM t1 ``");
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
field= stmt->mysql->fields;
|
||||
metadata= mysql_stmt_result_metadata(stmt);
|
||||
field= mysql_fetch_field(metadata);
|
||||
DIE_UNLESS(strcmp(field->table, "") == 0);
|
||||
DIE_UNLESS(strcmp(field->org_table, "t1") == 0);
|
||||
DIE_UNLESS(strcmp(field->db, "client_test_db") == 0);
|
||||
mysql_free_result(metadata);
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
stmt= open_cursor("SELECT a '' FROM t1 ``");
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
field= stmt->mysql->fields;
|
||||
metadata= mysql_stmt_result_metadata(stmt);
|
||||
field= mysql_fetch_field(metadata);
|
||||
DIE_UNLESS(strcmp(field->table, "") == 0);
|
||||
DIE_UNLESS(strcmp(field->org_table, "t1") == 0);
|
||||
DIE_UNLESS(strcmp(field->db, "client_test_db") == 0);
|
||||
mysql_free_result(metadata);
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
stmt= open_cursor("SELECT * FROM v1");
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
field= stmt->mysql->fields;
|
||||
metadata= mysql_stmt_result_metadata(stmt);
|
||||
field= mysql_fetch_field(metadata);
|
||||
DIE_UNLESS(strcmp(field->table, "v1") == 0);
|
||||
DIE_UNLESS(strcmp(field->org_table, "t1") == 0);
|
||||
DIE_UNLESS(strcmp(field->db, "client_test_db") == 0);
|
||||
mysql_free_result(metadata);
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
stmt= open_cursor("SELECT * FROM v1 /* SIC */ GROUP BY 1");
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
field= stmt->mysql->fields;
|
||||
metadata= mysql_stmt_result_metadata(stmt);
|
||||
field= mysql_fetch_field(metadata);
|
||||
DIE_UNLESS(strcmp(field->table, "v1") == 0);
|
||||
DIE_UNLESS(strcmp(field->org_table, "t1") == 0);
|
||||
DIE_UNLESS(strcmp(field->db, "client_test_db") == 0);
|
||||
mysql_free_result(metadata);
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
rc= mysql_query(mysql, "DROP VIEW v1");
|
||||
|
|
Loading…
Reference in a new issue