Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
None
Description
Just now PREPARE for EXPLAIN SELECT return no metadata at all.
it should work for SELECT/UPDATE/DELETE/INSERT.
static void test_explain_meta()
|
{
|
MYSQL_STMT *stmt;
|
int num_fields;
|
char query[MAX_TEST_QUERY_LENGTH];
|
MYSQL_FIELD *fields;
|
MYSQL_RES *rs_metadata;
|
|
myheader("test_explain_meta");
|
mct_start_logging("test_explain_meta");
|
|
strmov(query, "SELECT 1");
|
stmt= mysql_simple_prepare(mysql, query);
|
check_stmt(stmt);
|
|
rs_metadata= mysql_stmt_result_metadata(stmt);
|
|
num_fields= mysql_stmt_field_count(stmt);
|
mct_log("SELECT num_fields: %d\n", (int) num_fields);
|
if (num_fields != 1)
|
{
|
mct_close_log();
|
DIE("num_fields != 1");
|
}
|
mysql_stmt_close(stmt);
|
|
strmov(query, "EXPLAIN SELECT 1");
|
stmt= mysql_simple_prepare(mysql, query);
|
check_stmt(stmt);
|
|
rs_metadata= mysql_stmt_result_metadata(stmt);
|
|
num_fields= mysql_stmt_field_count(stmt);
|
mct_log("EXPALIN num_fields: %d\n", (int) num_fields);
|
if (num_fields != 10)
|
{
|
mct_close_log();
|
DIE("num_fields != 10");
|
}
|
|
fields= mysql_fetch_fields(rs_metadata);
|
|
for (int 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);
|
|
}
|
|
mysql_stmt_close(stmt);
|
|
mct_close_log();
|
}
|
Attachments
Issue Links
- relates to
-
MDEV-11966 Impossible to execute prepared ANALYZE SELECT
- Closed