summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-10-21 18:33:53 +0400
committerunknown <konstantin@mysql.com>2004-10-21 18:33:53 +0400
commit506f648b3a104bf107ebe7a49bcf6b044682a7b8 (patch)
tree7058ab30d1d358a25767f8022ee18348b8f22709 /tests
parentf945555c178b71a252251ef51bdfff7808ea8149 (diff)
downloadmariadb-git-506f648b3a104bf107ebe7a49bcf6b044682a7b8.tar.gz
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). sql/sql_class.h: A fix for bug#6059 "mysql_stmt_field_count returns positive numbers when no resultset is available": introducing select_result::field_count() method to report actual number of fields in a result set, if any result set is sent to client. sql/sql_prepare.cc: A fix 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). Now we need to always have lex->result set if we're in prepared statements. tests/client_test.c: A test case for Bug#6059 "mysql_stmt_field_count returns positive numbers when no resultset is available"
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c17
1 files changed, 17 insertions, 0 deletions
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.