From ef1af6ada76f0a33b37a3a27d14fcb284bfb9e60 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 4 Dec 2006 16:52:05 +0900 Subject: [PATCH] msi: Add tests for quoting in queries. --- dlls/msi/tests/db.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 441d6f58a0d..fd11e40af86 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -656,6 +656,39 @@ static void test_msibadqueries(void) r = try_query( hdb, "CREATE TABLE `c` (`b` CHAR NOT NULL PRIMARY KEY `b`)"); ok(r == ERROR_SUCCESS , "query 8 failed\n"); + r = try_query( hdb, "select * from c"); + ok(r == ERROR_SUCCESS , "query failed\n"); + + r = try_query( hdb, "select * from c where b = 'x"); + todo_wine ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + + r = try_query( hdb, "select * from 'c'"); + ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + + r = try_query( hdb, "select * from ''"); + ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + + r = try_query( hdb, "select * from c where b = x"); + ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + + r = try_query( hdb, "select * from c where b = \"x\""); + todo_wine ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + + r = try_query( hdb, "select * from c where b = 'x'"); + ok(r == ERROR_SUCCESS, "query failed\n"); + + r = try_query( hdb, "select * from c where b = '\"x'"); + ok(r == ERROR_SUCCESS, "query failed\n"); + + if (0) /* FIXME: this query causes trouble with other tests */ + { + r = try_query( hdb, "select * from c where b = '\\\'x'"); + ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + } + + r = try_query( hdb, "select * from 'c'"); + ok(r == ERROR_BAD_QUERY_SYNTAX, "query failed\n"); + r = MsiCloseHandle( hdb ); ok(r == ERROR_SUCCESS , "Failed to close database transact\n");