@@ -1814,11 +1814,17 @@ static bool mysql_test_create_table(Prepared_statement *stmt)
1814
1814
}
1815
1815
1816
1816
1817
- static bool send_stmt_metadata (THD *thd, Prepared_statement *stmt, List<Item> *fields)
1817
+ static int send_stmt_metadata (THD *thd, Prepared_statement *stmt, List<Item> *fields)
1818
1818
{
1819
- return send_prep_stmt (stmt, fields->elements ) ||
1820
- thd->protocol ->send_result_set_metadata (fields, Protocol::SEND_EOF) ||
1821
- thd->protocol ->flush ();
1819
+ if (stmt->is_sql_prepare ())
1820
+ return 0 ;
1821
+
1822
+ if (send_prep_stmt (stmt, fields->elements ) ||
1823
+ thd->protocol ->send_result_set_metadata (fields, Protocol::SEND_EOF) ||
1824
+ thd->protocol ->flush ())
1825
+ return 1 ;
1826
+
1827
+ return 2 ;
1822
1828
}
1823
1829
1824
1830
@@ -1834,7 +1840,7 @@ static bool send_stmt_metadata(THD *thd, Prepared_statement *stmt, List<Item> *f
1834
1840
TRUE error, error message is set in THD
1835
1841
*/
1836
1842
1837
- static bool mysql_test_show_create_table (Prepared_statement *stmt,
1843
+ static int mysql_test_show_create_table (Prepared_statement *stmt,
1838
1844
TABLE_LIST *tables)
1839
1845
{
1840
1846
DBUG_ENTER (" mysql_test_show_create_table" );
@@ -1843,8 +1849,10 @@ static bool mysql_test_show_create_table(Prepared_statement *stmt,
1843
1849
char buff[2048 ];
1844
1850
String buffer (buff, sizeof (buff), system_charset_info);
1845
1851
1846
- DBUG_RETURN (mysqld_show_create_get_fields (thd, tables, &fields, &buffer) ||
1847
- send_stmt_metadata (thd, stmt, &fields));
1852
+ if (mysqld_show_create_get_fields (thd, tables, &fields, &buffer))
1853
+ DBUG_RETURN (1 );
1854
+
1855
+ DBUG_RETURN (send_stmt_metadata (thd, stmt, &fields));
1848
1856
}
1849
1857
1850
1858
@@ -1859,7 +1867,7 @@ static bool mysql_test_show_create_table(Prepared_statement *stmt,
1859
1867
TRUE error, error message is set in THD
1860
1868
*/
1861
1869
1862
- static bool mysql_test_show_create_db (Prepared_statement *stmt)
1870
+ static int mysql_test_show_create_db (Prepared_statement *stmt)
1863
1871
{
1864
1872
DBUG_ENTER (" mysql_test_show_create_db" );
1865
1873
THD *thd= stmt->thd ;
@@ -1883,7 +1891,7 @@ static bool mysql_test_show_create_db(Prepared_statement *stmt)
1883
1891
TRUE error, error message is set in THD
1884
1892
*/
1885
1893
1886
- static bool mysql_test_show_grants (Prepared_statement *stmt)
1894
+ static int mysql_test_show_grants (Prepared_statement *stmt)
1887
1895
{
1888
1896
DBUG_ENTER (" mysql_test_show_grants" );
1889
1897
THD *thd= stmt->thd ;
@@ -1908,7 +1916,7 @@ static bool mysql_test_show_grants(Prepared_statement *stmt)
1908
1916
TRUE error, error message is set in THD
1909
1917
*/
1910
1918
1911
- static bool mysql_test_show_slave_status (Prepared_statement *stmt)
1919
+ static int mysql_test_show_slave_status (Prepared_statement *stmt)
1912
1920
{
1913
1921
DBUG_ENTER (" mysql_test_show_slave_status" );
1914
1922
THD *thd= stmt->thd ;
@@ -1931,7 +1939,7 @@ static bool mysql_test_show_slave_status(Prepared_statement *stmt)
1931
1939
TRUE error, error message is set in THD
1932
1940
*/
1933
1941
1934
- static bool mysql_test_show_master_status (Prepared_statement *stmt)
1942
+ static int mysql_test_show_master_status (Prepared_statement *stmt)
1935
1943
{
1936
1944
DBUG_ENTER (" mysql_test_show_master_status" );
1937
1945
THD *thd= stmt->thd ;
@@ -1954,7 +1962,7 @@ static bool mysql_test_show_master_status(Prepared_statement *stmt)
1954
1962
TRUE error, error message is set in THD
1955
1963
*/
1956
1964
1957
- static bool mysql_test_show_binlogs (Prepared_statement *stmt)
1965
+ static int mysql_test_show_binlogs (Prepared_statement *stmt)
1958
1966
{
1959
1967
DBUG_ENTER (" mysql_test_show_binlogs" );
1960
1968
THD *thd= stmt->thd ;
@@ -1979,7 +1987,7 @@ static bool mysql_test_show_binlogs(Prepared_statement *stmt)
1979
1987
TRUE error, error message is set in THD
1980
1988
*/
1981
1989
1982
- static bool mysql_test_show_create_routine (Prepared_statement *stmt, int type)
1990
+ static int mysql_test_show_create_routine (Prepared_statement *stmt, int type)
1983
1991
{
1984
1992
DBUG_ENTER (" mysql_test_show_binlogs" );
1985
1993
THD *thd= stmt->thd ;
@@ -2325,22 +2333,22 @@ static bool check_prepared_statement(Prepared_statement *stmt)
2325
2333
res= mysql_test_create_table (stmt);
2326
2334
break ;
2327
2335
case SQLCOM_SHOW_CREATE:
2328
- if (! (res= mysql_test_show_create_table (stmt, tables)))
2336
+ if ((res= mysql_test_show_create_table (stmt, tables)) == 2 )
2329
2337
{
2330
2338
/* Statement and field info has already been sent */
2331
2339
DBUG_RETURN (FALSE );
2332
2340
}
2333
2341
break ;
2334
2342
case SQLCOM_SHOW_CREATE_DB:
2335
- if (! (res= mysql_test_show_create_db (stmt)))
2343
+ if ((res= mysql_test_show_create_db (stmt)) == 2 )
2336
2344
{
2337
2345
/* Statement and field info has already been sent */
2338
2346
DBUG_RETURN (FALSE );
2339
2347
}
2340
2348
break ;
2341
2349
#ifndef NO_EMBEDDED_ACCESS_CHECKS
2342
2350
case SQLCOM_SHOW_GRANTS:
2343
- if (! (res= mysql_test_show_grants (stmt)))
2351
+ if ((res= mysql_test_show_grants (stmt)) == 2 )
2344
2352
{
2345
2353
/* Statement and field info has already been sent */
2346
2354
DBUG_RETURN (FALSE );
@@ -2349,36 +2357,36 @@ static bool check_prepared_statement(Prepared_statement *stmt)
2349
2357
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
2350
2358
#ifndef EMBEDDED_LIBRARY
2351
2359
case SQLCOM_SHOW_SLAVE_STAT:
2352
- if (! (res= mysql_test_show_slave_status (stmt)))
2360
+ if ((res= mysql_test_show_slave_status (stmt)) == 2 )
2353
2361
{
2354
2362
/* Statement and field info has already been sent */
2355
2363
DBUG_RETURN (FALSE );
2356
2364
}
2357
2365
break ;
2358
2366
case SQLCOM_SHOW_MASTER_STAT:
2359
- if (! (res= mysql_test_show_master_status (stmt)))
2367
+ if ((res= mysql_test_show_master_status (stmt)) == 2 )
2360
2368
{
2361
2369
/* Statement and field info has already been sent */
2362
2370
DBUG_RETURN (FALSE );
2363
2371
}
2364
2372
break ;
2365
2373
case SQLCOM_SHOW_BINLOGS:
2366
- if (! (res= mysql_test_show_binlogs (stmt)))
2374
+ if ((res= mysql_test_show_binlogs (stmt)) == 2 )
2367
2375
{
2368
2376
/* Statement and field info has already been sent */
2369
2377
DBUG_RETURN (FALSE );
2370
2378
}
2371
2379
break ;
2372
2380
#endif /* EMBEDDED_LIBRARY */
2373
2381
case SQLCOM_SHOW_CREATE_PROC:
2374
- if (! (res= mysql_test_show_create_routine (stmt, TYPE_ENUM_PROCEDURE)))
2382
+ if ((res= mysql_test_show_create_routine (stmt, TYPE_ENUM_PROCEDURE)) == 2 )
2375
2383
{
2376
2384
/* Statement and field info has already been sent */
2377
2385
DBUG_RETURN (FALSE );
2378
2386
}
2379
2387
break ;
2380
2388
case SQLCOM_SHOW_CREATE_FUNC:
2381
- if (! (res= mysql_test_show_create_routine (stmt, TYPE_ENUM_FUNCTION)))
2389
+ if ((res= mysql_test_show_create_routine (stmt, TYPE_ENUM_FUNCTION)) == 2 )
2382
2390
{
2383
2391
/* Statement and field info has already been sent */
2384
2392
DBUG_RETURN (FALSE );
0 commit comments