msi: Don't reorder the table when matching rows as the results are already ordered.

This commit is contained in:
James Hawkins 2008-04-05 02:17:57 -05:00 committed by Alexandre Julliard
parent 82517d6d67
commit 85866317c5
2 changed files with 43 additions and 4 deletions

View File

@ -1796,9 +1796,6 @@ static UINT TABLE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
*row = entry->row;
if (tv->order)
*row = tv->order->reorder[*row];
return ERROR_SUCCESS;
}

View File

@ -4775,8 +4775,9 @@ static void test_defaultdatabase(void)
static void test_order(void)
{
MSIHANDLE hdb, hview, hrec;
CHAR buffer[MAX_PATH];
LPCSTR query;
UINT r;
UINT r, sz;
int val;
hdb = create_db();
@ -4983,6 +4984,47 @@ static void test_order(void)
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "CREATE TABLE `Buffet` ( `One` CHAR(72), `Two` SHORT PRIMARY KEY `One`)";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `Buffet` ( `One`, `Two` ) VALUES ( 'uno', 2)";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `Buffet` ( `One`, `Two` ) VALUES ( 'dos', 3)";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `Buffet` ( `One`, `Two` ) VALUES ( 'tres', 1)";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `Buffet` WHERE `One` = 'dos' ORDER BY `Two`";
r = MsiDatabaseOpenView(hdb, query, &hview);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiViewExecute(hview, 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sz = sizeof(buffer);
r = MsiRecordGetString(hrec, 1, buffer, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmp(buffer, "dos"), "Expected \"dos\", got \"%s\"\n", buffer);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 3, "Expected 3, got %d\n", r);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
MsiCloseHandle(hdb);