msi: Handle sorting an empty table.
This commit is contained in:
parent
9cd9023db6
commit
bed661aef4
|
@ -2054,6 +2054,9 @@ static UINT TABLE_sort(struct tagMSIVIEW *view, column_info *columns)
|
|||
if (r != ERROR_SUCCESS)
|
||||
return r;
|
||||
|
||||
if (rows == 0)
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
order = msi_alloc_zero(sizeof(MSIORDERINFO) + sizeof(UINT) * cols);
|
||||
if (!order)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
|
|
@ -4777,6 +4777,10 @@ static void test_order(void)
|
|||
hdb = create_db();
|
||||
ok(hdb, "failed to create db\n");
|
||||
|
||||
query = "CREATE TABLE `Empty` ( `A` SHORT NOT NULL PRIMARY KEY `A`)";
|
||||
r = run_query(hdb, 0, query);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
query = "CREATE TABLE `Mesa` ( `A` SHORT NOT NULL, `B` SHORT, `C` SHORT PRIMARY KEY `A`)";
|
||||
r = run_query(hdb, 0, query);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
@ -4962,6 +4966,18 @@ 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 = "SELECT * FROM `Empty` ORDER BY `A`";
|
||||
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_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
|
||||
|
||||
MsiViewClose(hview);
|
||||
MsiCloseHandle(hview);
|
||||
MsiCloseHandle(hdb);
|
||||
|
|
Loading…
Reference in New Issue