Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/db.c | 264 ++++++++++++-------------------------------- 1 file changed, 73 insertions(+), 191 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 2b927b78f2..111f809b8d 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -36,6 +36,31 @@ static const char *mstfile = "winetst-db.mst"; static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','-','d','b','.','m','s','i',0}; static const WCHAR msifile2W[] = {'w','i','n','e','t','s','t','2','-','d','b','.','m','s','i',0};
+static void check_record_(int line, MSIHANDLE rec, UINT count, ...) +{ + va_list args; + UINT i; + + ok_(__FILE__, line)(count == MsiRecordGetFieldCount(rec), + "expected %u fields, got %u\n", count, MsiRecordGetFieldCount(rec)); + + va_start(args, count); + + for (i = 1; i <= count; ++i) + { + const char *expect = va_arg(args, const char *); + char buffer[200] = "x"; + DWORD sz = sizeof(buffer); + UINT r = MsiRecordGetStringA(rec, i, buffer, &sz); + ok_(__FILE__, line)(r == ERROR_SUCCESS, "field %u: got unexpected error %u\n", i, r); + ok_(__FILE__, line)(!strcmp(buffer, expect), + "field %u: expected "%s", got "%s"\n", i, expect, buffer); + } + + va_end(args); +} +#define check_record(rec, ...) check_record_(__LINE__, rec, __VA_ARGS__) + static void test_msidatabase(void) { MSIHANDLE hdb = 0, hdb2 = 0; @@ -1299,17 +1324,6 @@ static UINT get_columns_table_type(MSIHANDLE hdb, const char *table, UINT field) return type; }
-static BOOL check_record( MSIHANDLE rec, UINT field, LPCSTR val ) -{ - CHAR buffer[0x20]; - UINT r; - DWORD sz; - - sz = sizeof buffer; - r = MsiRecordGetStringA( rec, field, buffer, &sz ); - return (r == ERROR_SUCCESS ) && !strcmp(val, buffer); -} - static void test_viewgetcolumninfo(void) { MSIHANDLE hdb = 0, rec; @@ -1335,17 +1349,7 @@ static void test_viewgetcolumninfo(void) /* check the column types */ rec = get_column_info( hdb, "select * from `Properties`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "S255"), "wrong record type\n"); - ok( check_record( rec, 2, "S1"), "wrong record type\n"); - ok( check_record( rec, 3, "I2"), "wrong record type\n"); - ok( check_record( rec, 4, "I2"), "wrong record type\n"); - ok( check_record( rec, 5, "I2"), "wrong record type\n"); - ok( check_record( rec, 6, "I4"), "wrong record type\n"); - ok( check_record( rec, 7, "S0"), "wrong record type\n"); - ok( check_record( rec, 8, "S0"), "wrong record type\n"); - ok( check_record( rec, 9, "L0"), "wrong record type\n"); - + check_record(rec, 9, "S255", "S1", "I2", "I2", "I2", "I4", "S0", "S0", "L0"); MsiCloseHandle( rec );
/* check the type in _Columns */ @@ -1362,17 +1366,8 @@ static void test_viewgetcolumninfo(void) /* now try the names */ rec = get_column_info( hdb, "select * from `Properties`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "Property"), "wrong record type\n"); - ok( check_record( rec, 2, "Value"), "wrong record type\n"); - ok( check_record( rec, 3, "Intvalue"), "wrong record type\n"); - ok( check_record( rec, 4, "Integervalue"), "wrong record type\n"); - ok( check_record( rec, 5, "Shortvalue"), "wrong record type\n"); - ok( check_record( rec, 6, "Longvalue"), "wrong record type\n"); - ok( check_record( rec, 7, "Longcharvalue"), "wrong record type\n"); - ok( check_record( rec, 8, "Charvalue"), "wrong record type\n"); - ok( check_record( rec, 9, "Localizablevalue"), "wrong record type\n"); - + check_record(rec, 9, "Property", "Value", "Intvalue", "Integervalue", "Shortvalue", + "Longvalue", "Longcharvalue", "Charvalue", "Localizablevalue"); MsiCloseHandle( rec );
r = run_query( hdb, 0, @@ -1383,10 +1378,7 @@ static void test_viewgetcolumninfo(void) /* check the column types */ rec = get_column_info( hdb, "select * from `Binary`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "S255"), "wrong record type\n"); - ok( check_record( rec, 2, "V0"), "wrong record type\n"); - + check_record(rec, 2, "S255", "V0"); MsiCloseHandle( rec );
/* check the type in _Columns */ @@ -1396,9 +1388,7 @@ static void test_viewgetcolumninfo(void) /* now try the names */ rec = get_column_info( hdb, "select * from `Binary`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "Name"), "wrong record type\n"); - ok( check_record( rec, 2, "Data"), "wrong record type\n"); + check_record(rec, 2, "Name", "Data"); MsiCloseHandle( rec );
r = run_query( hdb, 0, @@ -1411,14 +1401,12 @@ static void test_viewgetcolumninfo(void)
rec = get_column_info( hdb, "select * from `UIText`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - ok( check_record( rec, 1, "Key"), "wrong record type\n"); - ok( check_record( rec, 2, "Text"), "wrong record type\n"); + check_record(rec, 2, "Key", "Text"); MsiCloseHandle( rec );
rec = get_column_info( hdb, "select * from `UIText`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - ok( check_record( rec, 1, "s72"), "wrong record type\n"); - ok( check_record( rec, 2, "L255"), "wrong record type\n"); + check_record(rec, 2, "s72", "L255"); MsiCloseHandle( rec );
MsiCloseHandle( hdb ); @@ -1613,19 +1601,13 @@ static void test_streamtable(void) /* check the column types */ rec = get_column_info( hdb, "select * from `_Streams`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "s62"), "wrong record type\n"); - ok( check_record( rec, 2, "V0"), "wrong record type\n"); - + check_record(rec, 2, "s62", "V0"); MsiCloseHandle( rec );
/* now try the names */ rec = get_column_info( hdb, "select * from `_Streams`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "Name"), "wrong record type\n"); - ok( check_record( rec, 2, "Data"), "wrong record type\n"); - + check_record(rec, 2, "Name", "Data"); MsiCloseHandle( rec );
r = MsiDatabaseOpenViewA( hdb, @@ -2022,16 +2004,14 @@ static void test_where_not_in_selected(void)
r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); - - ok( check_record( rec, 1, "cond2"), "wrong condition\n"); - + check_record(rec, 1, "cond2"); MsiCloseHandle( rec ); + r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); - - ok( check_record( rec, 1, "cond3"), "wrong condition\n"); - + check_record(rec, 1, "cond3"); MsiCloseHandle( rec ); + MsiViewClose(view); MsiCloseHandle(view);
@@ -2081,13 +2061,13 @@ static void test_where(void) query = "SELECT * FROM `Media`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r); - ok( check_record( rec, 4, "zero.cab"), "wrong cabinet\n"); + check_record(rec, 6, "1", "0", "", "zero.cab", "", ""); MsiCloseHandle( rec );
query = "SELECT * FROM `Media` WHERE `LastSequence` >= 1"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r); - ok( check_record( rec, 4, "one.cab"), "wrong cabinet\n"); + check_record(rec, 6, "2", "1", "", "one.cab", "", "");
r = MsiRecordGetInteger(rec, 1); ok( 2 == r, "field wrong\n"); @@ -2373,8 +2353,7 @@ static void test_msiimport(void) { MSIHANDLE hdb, view, rec; LPCSTR query; - UINT r, count; - signed int i; + UINT r;
GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
@@ -2405,58 +2384,23 @@ static void test_msiimport(void)
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 9, "Expected 9, got %d\n", count); - ok(check_record(rec, 1, "FirstPrimaryColumn"), "Expected FirstPrimaryColumn\n"); - ok(check_record(rec, 2, "SecondPrimaryColumn"), "Expected SecondPrimaryColumn\n"); - ok(check_record(rec, 3, "ShortInt"), "Expected ShortInt\n"); - ok(check_record(rec, 4, "ShortIntNullable"), "Expected ShortIntNullalble\n"); - ok(check_record(rec, 5, "LongInt"), "Expected LongInt\n"); - ok(check_record(rec, 6, "LongIntNullable"), "Expected LongIntNullalble\n"); - ok(check_record(rec, 7, "String"), "Expected String\n"); - ok(check_record(rec, 8, "LocalizableString"), "Expected LocalizableString\n"); - ok(check_record(rec, 9, "LocalizableStringNullable"), "Expected LocalizableStringNullable\n"); + check_record(rec, 9, "FirstPrimaryColumn", "SecondPrimaryColumn", "ShortInt", + "ShortIntNullable", "LongInt", "LongIntNullable", "String", + "LocalizableString", "LocalizableStringNullable"); MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 9, "Expected 9, got %d\n", count); - ok(check_record(rec, 1, "s255"), "Expected s255\n"); - ok(check_record(rec, 2, "i2"), "Expected i2\n"); - ok(check_record(rec, 3, "i2"), "Expected i2\n"); - ok(check_record(rec, 4, "I2"), "Expected I2\n"); - ok(check_record(rec, 5, "i4"), "Expected i4\n"); - ok(check_record(rec, 6, "I4"), "Expected I4\n"); - ok(check_record(rec, 7, "S255"), "Expected S255\n"); - ok(check_record(rec, 8, "S0"), "Expected S0\n"); - ok(check_record(rec, 9, "s0"), "Expected s0\n"); + check_record(rec, 9, "s255", "i2", "i2", "I2", "i4", "I4", "S255", "S0", "s0"); MsiCloseHandle(rec);
query = "SELECT * FROM `TestTable`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(check_record(rec, 1, "stringage"), "Expected 'stringage'\n"); - ok(check_record(rec, 7, "another string"), "Expected 'another string'\n"); - ok(check_record(rec, 8, "localizable"), "Expected 'localizable'\n"); - ok(check_record(rec, 9, "duh"), "Expected 'duh'\n"); - - i = MsiRecordGetInteger(rec, 2); - ok(i == 5, "Expected 5, got %d\n", i); - - i = MsiRecordGetInteger(rec, 3); - ok(i == 2, "Expected 2, got %d\n", i); - - i = MsiRecordGetInteger(rec, 4); - ok(i == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", i); - - i = MsiRecordGetInteger(rec, 5); - ok(i == 2147483640, "Expected 2147483640, got %d\n", i); - - i = MsiRecordGetInteger(rec, 6); - ok(i == -2147483640, "Expected -2147483640, got %d\n", i); - + check_record(rec, 9, "stringage", "5", "2", "", "2147483640", "-2147483640", + "another string", "localizable", "duh"); MsiCloseHandle(rec); + MsiViewClose(view); MsiCloseHandle(view);
@@ -2466,19 +2410,12 @@ static void test_msiimport(void)
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 2, "Expected 2, got %d\n", count); - ok(check_record(rec, 1, "PrimaryOne"), "Expected PrimaryOne\n"); - ok(check_record(rec, 2, "PrimaryTwo"), "Expected PrimaryTwo\n"); - + check_record(rec, 2, "PrimaryOne", "PrimaryTwo"); MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 2, "Expected 2, got %d\n", count); - ok(check_record(rec, 1, "s255"), "Expected s255\n"); - ok(check_record(rec, 2, "s255"), "Expected s255\n"); + check_record(rec, 2, "s255", "s255"); MsiCloseHandle(rec);
r = MsiViewExecute(view, 0); @@ -2486,18 +2423,12 @@ static void test_msiimport(void)
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - ok(check_record(rec, 1, "papaya"), "Expected 'papaya'\n"); - ok(check_record(rec, 2, "leaf"), "Expected 'leaf'\n"); - + check_record(rec, 2, "papaya", "leaf"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - ok(check_record(rec, 1, "papaya"), "Expected 'papaya'\n"); - ok(check_record(rec, 2, "flower"), "Expected 'flower'\n"); - + check_record(rec, 2, "papaya", "flower"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); @@ -2515,26 +2446,12 @@ static void test_msiimport(void)
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 6, "Expected 6, got %d\n", count); - ok(check_record(rec, 1, "A"), "Expected A\n"); - ok(check_record(rec, 2, "B"), "Expected B\n"); - ok(check_record(rec, 3, "C"), "Expected C\n"); - ok(check_record(rec, 4, "D"), "Expected D\n"); - ok(check_record(rec, 5, "E"), "Expected E\n"); - ok(check_record(rec, 6, "F"), "Expected F\n"); + check_record(rec, 6, "A", "B", "C", "D", "E", "F"); MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 6, "Expected 6, got %d\n", count); - ok(check_record(rec, 1, "s72"), "Expected s72\n"); - ok(check_record(rec, 2, "s72"), "Expected s72\n"); - ok(check_record(rec, 3, "s72"), "Expected s72\n"); - ok(check_record(rec, 4, "s72"), "Expected s72\n"); - ok(check_record(rec, 5, "s72"), "Expected s72\n"); - ok(check_record(rec, 6, "s72"), "Expected s72\n"); + check_record(rec, 6, "s72", "s72", "s72", "s72", "s72", "s72"); MsiCloseHandle(rec);
MsiViewClose(view); @@ -2549,24 +2466,12 @@ static void test_msiimport(void)
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(check_record(rec, 1, "a"), "Expected 'a'\n"); - ok(check_record(rec, 2, "b"), "Expected 'b'\n"); - ok(check_record(rec, 3, "c"), "Expected 'c'\n"); - ok(check_record(rec, 4, "d"), "Expected 'd'\n"); - ok(check_record(rec, 5, "e"), "Expected 'e'\n"); - ok(check_record(rec, 6, "f"), "Expected 'f'\n"); - + check_record(rec, 6, "a", "b", "c", "d", "e", "f"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(check_record(rec, 1, "g"), "Expected 'g'\n"); - ok(check_record(rec, 2, "h"), "Expected 'h'\n"); - ok(check_record(rec, 3, "i"), "Expected 'i'\n"); - ok(check_record(rec, 4, "j"), "Expected 'j'\n"); - ok(check_record(rec, 5, "k"), "Expected 'k'\n"); - ok(check_record(rec, 6, "l"), "Expected 'l'\n"); - + check_record(rec, 6, "g", "h", "i", "j", "k", "l"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); @@ -4358,7 +4263,7 @@ static void test_alter(void) static void test_integers(void) { MSIHANDLE hdb = 0, view = 0, rec = 0; - DWORD count, i; + DWORD i; const char *query; UINT r;
@@ -4387,30 +4292,12 @@ static void test_integers(void)
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 8, "Expected 8, got %d\n", count); - ok(check_record(rec, 1, "one"), "Expected one\n"); - ok(check_record(rec, 2, "two"), "Expected two\n"); - ok(check_record(rec, 3, "three"), "Expected three\n"); - ok(check_record(rec, 4, "four"), "Expected four\n"); - ok(check_record(rec, 5, "five"), "Expected five\n"); - ok(check_record(rec, 6, "six"), "Expected six\n"); - ok(check_record(rec, 7, "seven"), "Expected seven\n"); - ok(check_record(rec, 8, "eight"), "Expected eight\n"); + check_record(rec, 8, "one", "two", "three", "four", "five", "six", "seven", "eight"); MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 8, "Expected 8, got %d\n", count); - ok(check_record(rec, 1, "I2"), "Expected I2\n"); - ok(check_record(rec, 2, "I2"), "Expected I2\n"); - ok(check_record(rec, 3, "I2"), "Expected I2\n"); - ok(check_record(rec, 4, "I4"), "Expected I4\n"); - ok(check_record(rec, 5, "i2"), "Expected i2\n"); - ok(check_record(rec, 6, "i2"), "Expected i2\n"); - ok(check_record(rec, 7, "i2"), "Expected i2\n"); - ok(check_record(rec, 8, "i4"), "Expected i4\n"); + check_record(rec, 8, "I2", "I2", "I2", "I4", "i2", "i2", "i2", "i4"); MsiCloseHandle(rec);
MsiViewClose(view); @@ -7533,17 +7420,13 @@ static void test_storages_table(void) /* check the column types */ hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_TYPES); ok(hrec, "failed to get column info hrecord\n"); - ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n"); - ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n"); - + check_record(hrec, 2, "s62", "V0"); MsiCloseHandle(hrec);
/* now try the names */ hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_NAMES); ok(hrec, "failed to get column info hrecord\n"); - ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n"); - ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n"); - + check_record(hrec, 2, "Name", "Data"); MsiCloseHandle(hrec);
create_storage("storage.bin"); @@ -9702,6 +9585,8 @@ static void test_select_column_names(void) static void test_primary_keys(void) { MSIHANDLE hdb, keys; + char buffer[5]; + DWORD size; UINT r;
hdb = create_db(); @@ -9714,12 +9599,11 @@ static void test_primary_keys(void)
r = MsiDatabaseGetPrimaryKeysA(hdb, "T", &keys); ok(!r, "got %u\n", r); - - r = MsiRecordGetFieldCount(keys); - ok(r == 1, "got %d\n", r); - ok(check_record(keys, 0, "T"), "expected 'T'\n"); - ok(check_record(keys, 1, "A"), "expected 'A'\n"); - + check_record(keys, 1, "A"); + size = sizeof(buffer); + r = MsiRecordGetStringA(keys, 0, buffer, &size); + ok(!r, "got %u\n", r); + ok(!strcmp(buffer, "T"), "got "%s"\n", buffer); MsiCloseHandle(keys);
r = run_query(hdb, 0, "CREATE TABLE `U` (`A` SHORT, `B` SHORT, `C` SHORT PRIMARY KEY `B`, `C`)"); @@ -9727,13 +9611,11 @@ static void test_primary_keys(void)
r = MsiDatabaseGetPrimaryKeysA(hdb, "U", &keys); ok(!r, "got %u\n", r); - - r = MsiRecordGetFieldCount(keys); - ok(r == 2, "got %d\n", r); - ok(check_record(keys, 0, "U"), "expected 'U'\n"); - ok(check_record(keys, 1, "B"), "expected 'B'\n"); - ok(check_record(keys, 2, "C"), "expected 'C'\n"); - + check_record(keys, 2, "B", "C"); + size = sizeof(buffer); + r = MsiRecordGetStringA(keys, 0, buffer, &size); + ok(!r, "got %u\n", r); + ok(!strcmp(buffer, "U"), "got "%s"\n", buffer); MsiCloseHandle(keys); MsiCloseHandle(hdb); DeleteFileA(msifile);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/db.c | 352 +++----------------------------------------- 1 file changed, 20 insertions(+), 332 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 111f809b8d..04b1a926db 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -8706,9 +8706,7 @@ static void test_insertorder(void) static void test_columnorder(void) { MSIHANDLE hdb, view, rec; - char buf[MAX_PATH]; LPCSTR query; - DWORD sz; UINT r;
hdb = create_db(); @@ -8746,73 +8744,14 @@ static void test_columnorder(void)
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("s255", buf), "Expected "s255", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("I2", buf), "Expected "I2", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("S255", buf), "Expected "S255", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected "i2", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected "i2", got "%s"\n", buf); - + check_record(rec, 5, "s255", "I2", "S255", "i2", "i2"); MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected "D", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected "E", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected "A", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected "C", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected "B", got "%s"\n", buf); - + check_record(rec, 5, "D", "E", "A", "C", "B"); MsiCloseHandle(rec); + MsiViewClose(view); MsiCloseHandle(view);
@@ -8824,31 +8763,10 @@ static void test_columnorder(void) query = "SELECT * FROM `T`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("bc", buf), "Expected "bc", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("a", buf), "Expected "a", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 4); - ok(r == 2, "Expected 2, got %d\n", r); - - r = MsiRecordGetInteger(rec, 5); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(rec, 5, "bc", "3", "a", "2", "1"); MsiCloseHandle(rec);
- query = "SELECT * FROM `_Columns` WHERE `Table` = 'T'"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns` WHERE `Table` = 'T'"; r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(view, 0); @@ -8856,102 +8774,27 @@ static void test_columnorder(void)
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected "D", got "%s"\n", buf); - + check_record(rec, 3, "T", "1", "D"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected "E", got "%s"\n", buf); - + check_record(rec, 3, "T", "2", "E"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected "A", got "%s"\n", buf); - + check_record(rec, 3, "T", "3", "A"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 4, "Expected 4, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected "C", got "%s"\n", buf); - + check_record(rec, 3, "T", "4", "C"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 5, "Expected 5, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected "B", got "%s"\n", buf); - + check_record(rec, 3, "T", "5", "B"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); @@ -8972,73 +8815,14 @@ static void test_columnorder(void)
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected "i2", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("S255", buf), "Expected "S255", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("s255", buf), "Expected "s255", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("I2", buf), "Expected "I2", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected "i2", got "%s"\n", buf); - + check_record(rec, 5, "i2", "S255", "s255", "I2", "i2"); MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected "C", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected "A", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected "D", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected "E", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected "B", got "%s"\n", buf); - + check_record(rec, 5, "C", "A", "D", "E", "B"); MsiCloseHandle(rec); + MsiViewClose(view); MsiCloseHandle(view);
@@ -9050,31 +8834,10 @@ static void test_columnorder(void) query = "SELECT * FROM `Z`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(rec, 1); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("a", buf), "Expected "a", got "%s"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("bc", buf), "Expected "bc", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 4); - ok(r == 3, "Expected 3, got %d\n", r); - - r = MsiRecordGetInteger(rec, 5); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(rec, 5, "2", "a", "bc", "3", "1"); MsiCloseHandle(rec);
- query = "SELECT * FROM `_Columns` WHERE `Table` = 'T'"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns` WHERE `Table` = 'T'"; r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(view, 0); @@ -9082,102 +8845,27 @@ static void test_columnorder(void)
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected "D", got "%s"\n", buf); - + check_record(rec, 3, "T", "1", "D"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected "E", got "%s"\n", buf); - + check_record(rec, 3, "T", "2", "E"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected "A", got "%s"\n", buf); - + check_record(rec, 3, "T", "3", "A"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 4, "Expected 4, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected "C", got "%s"\n", buf); - + check_record(rec, 3, "T", "4", "C"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected "T", got "%s"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 5, "Expected 5, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected "B", got "%s"\n", buf); - + check_record(rec, 3, "T", "5", "B"); MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec);
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/db.c | 86 +++++---------------------------------------- 1 file changed, 9 insertions(+), 77 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 04b1a926db..4cdc14cc29 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -8170,15 +8170,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `MergeErrors`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected "One", got "%s"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - + check_record(hrec, 2, "One", "2"); MsiCloseHandle(hrec);
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `MergeErrors`", &hview); @@ -8186,34 +8178,14 @@ static void test_dbmerge(void)
r = MsiViewGetColumnInfo(hview, MSICOLINFO_NAMES, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table"), "Expected "Table", got "%s"\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "NumRowMergeConflicts"), - "Expected "NumRowMergeConflicts", got "%s"\n", buf); - + check_record(hrec, 2, "Table", "NumRowMergeConflicts"); MsiCloseHandle(hrec);
r = MsiViewGetColumnInfo(hview, MSICOLINFO_TYPES, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "s255"), "Expected "s255", got "%s"\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "i2"), "Expected "i2", got "%s"\n", buf); - + check_record(hrec, 2, "s255", "i2"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview);
@@ -8244,15 +8216,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `One`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected "hi", got "%s"\n", buf); - + check_record(hrec, 2, "1", "hi"); MsiCloseHandle(hrec);
/* nothing in MergeErrors */ @@ -8290,15 +8254,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `One`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected "hi", got "%s"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(hrec, 2, "hi", "1"); MsiCloseHandle(hrec);
/* nothing in MergeErrors */ @@ -8342,15 +8298,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `One`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected "hi", got "%s"\n", buf); - + check_record(hrec, 2, "1", "hi"); MsiCloseHandle(hrec);
/* nothing in MergeErrors */ @@ -8444,28 +8392,12 @@ static void test_dbmerge(void)
r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "foo"), "Expected "foo", got "%s"\n", buf); - + check_record(hrec, 2, "1", "foo"); MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 2, "Expected 2, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "bar"), "Expected "bar", got "%s"\n", buf); - + check_record(hrec, 2, "2", "bar"); MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/db.c | 120 +++++++------------------------------------- 1 file changed, 19 insertions(+), 101 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 4cdc14cc29..f63fb10b48 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -8955,9 +8955,8 @@ static void test_embedded_nulls(void)
static void test_select_column_names(void) { - MSIHANDLE hdb = 0, rec, rec2, view; - char buffer[32]; - UINT r, size; + MSIHANDLE hdb = 0, rec, view; + UINT r;
DeleteFileA(msifile);
@@ -9008,43 +9007,22 @@ static void test_select_column_names(void)
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 1, "got %u\n", r ); - r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec2 ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec2 ); - ok( r == 1, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec2, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); - MsiCloseHandle( rec2 ); - r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec2 ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec2 ); - ok( r == 1, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec2, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "f0" ), "got "%s"\n", buffer ); - MsiCloseHandle( rec2 ); + check_record(rec, 1, ""); + MsiCloseHandle(rec);
- size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); + r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); - MsiCloseHandle( rec ); + check_record(rec, 1, ""); + MsiCloseHandle(rec); + + r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); + ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); + check_record(rec, 1, "f0"); + MsiCloseHandle(rec);
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); + check_record(rec, 1, ""); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec ); @@ -9062,22 +9040,12 @@ static void test_select_column_names(void)
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 2, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "1" ), "got "%s"\n", buffer ); + check_record(rec, 2, "1", ""); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); + check_record(rec, 2, "3", ""); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec ); @@ -9095,32 +9063,12 @@ static void test_select_column_names(void)
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 2, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "1" ), "got "%s"\n", buffer ); + check_record(rec, 2, "", "1"); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "3" ), "got "%s"\n", buffer ); + check_record(rec, 2, "", "3"); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec ); @@ -9138,42 +9086,12 @@ static void test_select_column_names(void)
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 3, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "1" ), "got "%s"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 3, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "2" ), "got "%s"\n", buffer ); + check_record(rec, 3, "1", "", "2"); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "3" ), "got "%s"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got "%s"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 3, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "4" ), "got "%s"\n", buffer ); + check_record(rec, 3, "3", "", "4"); MsiCloseHandle( rec );
r = MsiViewFetch( view, &rec );
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/db.c | 284 +++++--------------------------------------- 1 file changed, 32 insertions(+), 252 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index f63fb10b48..d97c350219 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -3267,31 +3267,7 @@ error: DeleteFileA(mstfile); }
-struct join_res -{ - const CHAR one[MAX_PATH]; - const CHAR two[MAX_PATH]; -}; - -struct join_res_4col -{ - const CHAR one[MAX_PATH]; - const CHAR two[MAX_PATH]; - const CHAR three[MAX_PATH]; - const CHAR four[MAX_PATH]; -}; - -struct join_res_uint -{ - UINT one; - UINT two; - UINT three; - UINT four; - UINT five; - UINT six; -}; - -static const struct join_res join_res_first[] = +static const char *join_res_first[][2] = { { "alveolar", "procerus" }, { "septum", "procerus" }, @@ -3300,29 +3276,29 @@ static const struct join_res join_res_first[] = { "malar", "mentalis" }, };
-static const struct join_res join_res_second[] = +static const char *join_res_second[][2] = { { "nasal", "septum" }, { "mandible", "ramus" }, };
-static const struct join_res join_res_third[] = +static const char *join_res_third[][2] = { { "msvcp.dll", "abcdefgh" }, { "msvcr.dll", "ijklmnop" }, };
-static const struct join_res join_res_fourth[] = +static const char *join_res_fourth[][2] = { { "msvcp.dll.01234", "single.dll.31415" }, };
-static const struct join_res join_res_fifth[] = +static const char *join_res_fifth[][2] = { { "malar", "procerus" }, };
-static const struct join_res join_res_sixth[] = +static const char *join_res_sixth[][2] = { { "malar", "procerus" }, { "malar", "procerus" }, @@ -3332,14 +3308,14 @@ static const struct join_res join_res_sixth[] = { "malar", "mentalis" }, };
-static const struct join_res join_res_seventh[] = +static const char *join_res_seventh[][2] = { { "malar", "nasalis" }, { "malar", "nasalis" }, { "malar", "nasalis" }, };
-static const struct join_res_4col join_res_eighth[] = +static const char *join_res_eighth[][4] = { { "msvcp.dll", "msvcp.dll.01234", "msvcp.dll.01234", "abcdefgh" }, { "msvcr.dll", "msvcr.dll.56789", "msvcp.dll.01234", "abcdefgh" }, @@ -3349,24 +3325,22 @@ static const struct join_res_4col join_res_eighth[] = { "msvcr.dll", "msvcr.dll.56789", "single.dll.31415", "msvcp.dll" }, };
-static const struct join_res_uint join_res_ninth[] = +static const char *join_res_ninth[][6] = { - { 1, 2, 3, 4, 7, 8 }, - { 1, 2, 5, 6, 7, 8 }, - { 1, 2, 3, 4, 9, 10 }, - { 1, 2, 5, 6, 9, 10 }, - { 1, 2, 3, 4, 11, 12 }, - { 1, 2, 5, 6, 11, 12 }, + { "1", "2", "3", "4", "7", "8" }, + { "1", "2", "5", "6", "7", "8" }, + { "1", "2", "3", "4", "9", "10" }, + { "1", "2", "5", "6", "9", "10" }, + { "1", "2", "3", "4", "11", "12" }, + { "1", "2", "5", "6", "11", "12" }, };
static void test_join(void) { MSIHANDLE hdb, hview, hrec; LPCSTR query; - CHAR buf[MAX_PATH]; - UINT r, count; - DWORD size, i; - BOOL data_correct; + UINT r; + DWORD i;
hdb = create_db(); ok( hdb, "failed to create db\n"); @@ -3459,25 +3433,10 @@ static void test_join(void) i = 0; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, join_res_first[i].one ), - "For (row %d, column 1) expected '%s', got %s\n", i, join_res_first[i].one, buf ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, join_res_first[i].two ), - "For (row %d, column 2) expected '%s', got %s\n", i, join_res_first[i].two, buf ); - + check_record(hrec, 2, join_res_first[i][0], join_res_first[i][1]); i++; MsiCloseHandle(hrec); } - ok( i == 5, "Expected 5 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3514,30 +3473,13 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_second[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_second[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_second[i][0], join_res_second[i][1]); i++; MsiCloseHandle(hrec); }
- ok( data_correct, "data returned in the wrong order\n"); - ok( i == 2, "Expected 2 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3555,31 +3497,13 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_third[i].one ) ) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_third[i].two ) ) - data_correct = FALSE; - + check_record(hrec, 2, join_res_third[i][0], join_res_third[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 2, "Expected 2 rows, got %d\n", i ); - ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
MsiViewClose(hview); @@ -3596,29 +3520,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fourth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fourth[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_fourth[i][0], join_res_fourth[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 1, "Expected 1 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3637,29 +3544,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fifth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fifth[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_fifth[i][0], join_res_fifth[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 1, "Expected 1 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3677,29 +3567,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_sixth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_sixth[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_sixth[i][0], join_res_sixth[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3718,29 +3591,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_seventh[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_seventh[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_seventh[i][0], join_res_seventh[i][1]); i++; MsiCloseHandle(hrec); } - - ok( data_correct, "data returned in the wrong order\n"); ok( i == 3, "Expected 3 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3756,29 +3612,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].four )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_eighth[i][0], join_res_eighth[i][3]); i++; MsiCloseHandle(hrec); } - - ok( data_correct, "data returned in the wrong order\n"); ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3793,41 +3632,13 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 4, "Expected 4 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].two )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 3, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].three )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 4, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].four )) - data_correct = FALSE; - + check_record(hrec, 4, join_res_eighth[i][0], join_res_eighth[i][1], + join_res_eighth[i][2], join_res_eighth[i][3]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3842,41 +3653,14 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 6, "Expected 6 record fields, got %d\n", count ); - - r = MsiRecordGetInteger( hrec, 1 ); - if( r != join_res_ninth[i].one ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 2 ); - if( r != join_res_ninth[i].two ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 3 ); - if( r != join_res_ninth[i].three ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 4 ); - if( r != join_res_ninth[i].four ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 5 ); - if( r != join_res_ninth[i].five ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 6); - if( r != join_res_ninth[i].six ) - data_correct = FALSE; - + check_record(hrec, 6, join_res_ninth[i][0], join_res_ninth[i][1], + join_res_ninth[i][2], join_res_ninth[i][3], + join_res_ninth[i][4], join_res_ninth[i][5]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
@@ -3948,13 +3732,9 @@ static void test_join(void)
r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, "epicranius" ), "expected 'epicranius', got %s\n", buf ); - + check_record(hrec, 2, "epicranius", "procerus"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview);
Signed-off-by: Hans Leidekker hans@codeweavers.com