James Hawkins : msi: Add tests for the WHERE SQL clause.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 25 05:09:46 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 8144e171697bc3543c4c0b2ddd743ca3827db669
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=8144e171697bc3543c4c0b2ddd743ca3827db669

Author: James Hawkins <truiken at gmail.com>
Date:   Mon Jul 24 17:10:23 2006 -0700

msi: Add tests for the WHERE SQL clause.

---

 dlls/msi/tests/db.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index fe2b8cf..5d03ca4 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -987,6 +987,58 @@ static void test_streamtable(void)
     DeleteFile(msifile);
 }
 
+static void test_where(void)
+{
+    MSIHANDLE hdb = 0, rec;
+    LPSTR query;
+    UINT r;
+
+    hdb = create_db();
+    ok( hdb, "failed to create db\n");
+
+    r = run_query( hdb,
+            "CREATE TABLE `Media` ("
+            "`DiskId` SHORT NOT NULL, "
+            "`LastSequence` LONG, "
+            "`DiskPrompt` CHAR(64) LOCALIZABLE, "
+            "`Cabinet` CHAR(255), "
+            "`VolumeLabel` CHAR(32), "
+            "`Source` CHAR(72) "
+            "PRIMARY KEY `DiskId`)" );
+    ok( r == S_OK, "cannot create Media table: %d\n", r );
+
+    r = run_query( hdb, "INSERT INTO `Media` "
+            "( `DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source` ) "
+            "VALUES ( 1, 0, '', 'zero.cab', '', '' )" );
+    ok( r == S_OK, "cannot add file to the Media table: %d\n", r );
+
+    r = run_query( hdb, "INSERT INTO `Media` "
+            "( `DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source` ) "
+            "VALUES ( 2, 1, '', 'one.cab', '', '' )" );
+    ok( r == S_OK, "cannot add file to the Media table: %d\n", r );
+
+    r = run_query( hdb, "INSERT INTO `Media` "
+            "( `DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source` ) "
+            "VALUES ( 3, 2, '', 'two.cab', '', '' )" );
+    ok( r == S_OK, "cannot add file to the Media table: %d\n", r );
+
+    query = "SELECT * FROM `Media`";
+    r = do_query(hdb, query, &rec);
+    ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r);
+    ok( check_record( rec, 4, "zero.cab"), "wrong cabinet\n");
+
+    query = "SELECT * FROM `Media` WHERE `LastSequence` >= 1";
+    r = do_query(hdb, query, &rec);
+    todo_wine
+    {
+        ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r);
+        ok( check_record( rec, 4, "one.cab"), "wrong cabinet\n");
+    }
+
+    MsiCloseHandle( hdb );
+    DeleteFile(msifile);
+}
+
 START_TEST(db)
 {
     test_msidatabase();
@@ -999,4 +1051,5 @@ START_TEST(db)
     test_msiexport();
     test_longstrings();
     test_streamtable();
+    test_where();
 }




More information about the wine-cvs mailing list