Bernhard Loos : msi: The underlying tables might have changed, so it' s not possible to cache the result of the execute.

Alexandre Julliard julliard at winehq.org
Mon Sep 12 11:43:01 CDT 2011


Module: wine
Branch: master
Commit: dc16dd135191bd68ea21130bd5e62d4a844f7ce0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dc16dd135191bd68ea21130bd5e62d4a844f7ce0

Author: Bernhard Loos <bernhardloos at googlemail.com>
Date:   Fri Sep  9 11:25:51 2011 +0200

msi: The underlying tables might have changed, so it's not possible to cache the result of the execute.

---

 dlls/msi/tests/db.c |   24 +++++++++++++++++++++++-
 dlls/msi/where.c    |   35 ++++++++++++++---------------------
 2 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index b581633..b915fa0 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -297,7 +297,7 @@ make_add_entry(binary,
 
 static void test_msiinsert(void)
 {
-    MSIHANDLE hdb = 0, hview = 0, hrec = 0;
+    MSIHANDLE hdb = 0, hview = 0, hview2 = 0, hrec = 0;
     UINT r;
     const char *query;
     char buf[80];
@@ -322,6 +322,14 @@ static void test_msiinsert(void)
     r = MsiCloseHandle(hview);
     ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
 
+    query = "SELECT * FROM phone WHERE number = '8675309'";
+    r = MsiDatabaseOpenView(hdb, query, &hview2);
+    ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
+    r = MsiViewExecute(hview2, 0);
+    ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
+    r = MsiViewFetch(hview2, &hrec);
+    ok(r == ERROR_NO_MORE_ITEMS, "MsiViewFetch produced items\n");
+
     /* insert a value into it */
     query = "INSERT INTO `phone` ( `id`, `name`, `number` )"
         "VALUES('1', 'Abe', '8675309')";
@@ -334,6 +342,20 @@ static void test_msiinsert(void)
     r = MsiCloseHandle(hview);
     ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
 
+    r = MsiViewFetch(hview2, &hrec);
+    ok(r == ERROR_NO_MORE_ITEMS, "MsiViewFetch produced items\n");
+    r = MsiViewExecute(hview2, 0);
+    ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
+    r = MsiViewFetch(hview2, &hrec);
+    ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %u\n", r);
+
+    r = MsiCloseHandle(hrec);
+    ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
+    r = MsiViewClose(hview2);
+    ok(r == ERROR_SUCCESS, "MsiViewClose failed\n");
+    r = MsiCloseHandle(hview2);
+    ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
+
     query = "SELECT * FROM `phone` WHERE `id` = 1";
     r = do_query(hdb, query, &hrec);
     ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
diff --git a/dlls/msi/where.c b/dlls/msi/where.c
index 0e346d6..17b655b 100644
--- a/dlls/msi/where.c
+++ b/dlls/msi/where.c
@@ -73,27 +73,10 @@ typedef struct tagMSIWHEREVIEW
     struct expr   *cond;
     UINT           rec_index;
     MSIORDERINFO  *order_info;
-    UINT           error;
 } MSIWHEREVIEW;
 
 #define INITIAL_REORDER_SIZE 16
 
-static UINT init_reorder(MSIWHEREVIEW *wv)
-{
-    MSIROWENTRY **new = msi_alloc_zero(sizeof(MSIROWENTRY *) * INITIAL_REORDER_SIZE);
-    if (!new)
-        return ERROR_OUTOFMEMORY;
-
-    if (wv->reorder)
-        msi_free(wv->reorder);
-
-    wv->reorder = new;
-    wv->reorder_size = INITIAL_REORDER_SIZE;
-    wv->row_count = 0;
-
-    return ERROR_SUCCESS;
-}
-
 static void free_reorder(MSIWHEREVIEW *wv)
 {
     UINT i;
@@ -110,6 +93,20 @@ static void free_reorder(MSIWHEREVIEW *wv)
     wv->row_count = 0;
 }
 
+static UINT init_reorder(MSIWHEREVIEW *wv)
+{
+    MSIROWENTRY **new = msi_alloc_zero(sizeof(MSIROWENTRY *) * INITIAL_REORDER_SIZE);
+    if (!new)
+        return ERROR_OUTOFMEMORY;
+
+    free_reorder(wv);
+
+    wv->reorder = new;
+    wv->reorder_size = INITIAL_REORDER_SIZE;
+
+    return ERROR_SUCCESS;
+}
+
 static inline UINT find_row(MSIWHEREVIEW *wv, UINT row, UINT *(values[]))
 {
     if (row >= wv->row_count)
@@ -618,9 +615,6 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
     if( !table )
          return ERROR_FUNCTION_FAILED;
 
-    if (wv->reorder)
-        return wv->error;
-
     r = init_reorder(wv);
     if (r != ERROR_SUCCESS)
         return r;
@@ -654,7 +648,6 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
         r = wv->order_info->error;
 
     msi_free( rows );
-    wv->error = r;
     return r;
 }
 




More information about the wine-cvs mailing list