Commit 1a159dfd authored by Matijn Woudt's avatar Matijn Woudt Committed by Alexandre Julliard

msi/tests: Testcases for CREATE TABLE.

parent d5e0a2ed
......@@ -8845,6 +8845,112 @@ static void test_columnorder(void)
DeleteFileA(msifile);
}
static void test_createtable(void)
{
MSIHANDLE hdb, htab = 0, hrec = 0;
LPCSTR query;
UINT res;
DWORD size;
char buffer[0x20];
hdb = create_db();
ok(hdb, "failed to create db\n");
query = "CREATE TABLE `blah` (`foo` CHAR(72) NOT NULL PRIMARY KEY `foo`)";
res = MsiDatabaseOpenView( hdb, query, &htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
if(res == ERROR_SUCCESS )
{
res = MsiViewExecute( htab, hrec );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiViewGetColumnInfo( htab, MSICOLINFO_NAMES, &hrec );
todo_wine ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = sizeof(buffer);
res = MsiRecordGetString(hrec, 1, buffer, &size );
todo_wine ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiViewClose( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiCloseHandle( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
}
query = "CREATE TABLE `a` (`b` INT PRIMARY KEY `b`)";
res = MsiDatabaseOpenView( hdb, query, &htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
if(res == ERROR_SUCCESS )
{
res = MsiViewExecute( htab, 0 );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiViewClose( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiCloseHandle( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
query = "SELECT * FROM `a`";
res = MsiDatabaseOpenView( hdb, query, &htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiViewGetColumnInfo( htab, MSICOLINFO_NAMES, &hrec );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = sizeof(buffer);
res = MsiRecordGetString(hrec, 1, buffer, &size );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!strcmp(buffer,"b"), "b != %s\n", buffer);
res = MsiViewClose( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiCloseHandle( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiDatabaseCommit(hdb);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiCloseHandle(hdb);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiOpenDatabase(msifile, MSIDBOPEN_TRANSACT, &hdb );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
query = "SELECT * FROM `a`";
res = MsiDatabaseOpenView( hdb, query, &htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiViewGetColumnInfo( htab, MSICOLINFO_NAMES, &hrec );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = sizeof(buffer);
res = MsiRecordGetString(hrec, 1, buffer, &size );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
todo_wine ok(!strcmp(buffer,"b"), "b != %s\n", buffer);
res = MsiCloseHandle( hrec );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiViewClose( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiCloseHandle( htab );
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
}
res = MsiDatabaseCommit(hdb);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = MsiCloseHandle(hdb);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
DeleteFileA(msifile);
}
START_TEST(db)
{
test_msidatabase();
......@@ -8896,4 +9002,5 @@ START_TEST(db)
test_insertorder();
test_columnorder();
test_suminfo_import();
test_createtable();
}
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