Commit dc16dd13 authored by Bernhard Loos's avatar Bernhard Loos Committed by Alexandre Julliard

msi: The underlying tables might have changed, so it's not possible to cache the…

msi: The underlying tables might have changed, so it's not possible to cache the result of the execute.
parent 09f134cb
......@@ -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");
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment