From 49a58fc64ee811fd71a974f493540c19d98ada73 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Thu, 21 Oct 2004 18:33:53 +0400 Subject: A fix and test case for bug#6059 "mysql_stmt_field_count returns positive numbers when no resultset is available": when sending result set metadata we need to use virtual select_result::send_fields, and not address protocol directly, because select_result descendents may intercept result set (it's the case for example for SELECT INTO OUTFILE). --- tests/client_test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/client_test.c') diff --git a/tests/client_test.c b/tests/client_test.c index 0b30cc3386d..1d2a85e54f4 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10541,6 +10541,22 @@ static void test_bug5315() } +static void test_bug6059() +{ + MYSQL_STMT *stmt; + const char *stmt_text; + int rc; + + myheader("test_bug6059"); + + stmt_text= "SELECT 'foo' INTO OUTFILE 'x.3'"; + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 0); + mysql_stmt_close(stmt); +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -10851,6 +10867,7 @@ int main(int argc, char **argv) test_bug5194(); /* bulk inserts in prepared mode */ test_bug5315(); /* check that mysql_change_user closes all prepared statements */ + test_bug6059(); /* correct metadata for SELECT ... INTO OUTFILE */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. -- cgit v1.2.1