msi: Don't create a temporary table that is not held.

This commit is contained in:
James Hawkins 2009-02-25 19:45:28 -08:00 committed by Alexandre Julliard
parent 241933e13c
commit ea28915133
3 changed files with 20 additions and 11 deletions

View File

@ -44,6 +44,7 @@ typedef struct tagMSICREATEVIEW
MSIDATABASE *db; MSIDATABASE *db;
LPWSTR name; LPWSTR name;
BOOL bIsTemp; BOOL bIsTemp;
BOOL hold;
column_info *col_info; column_info *col_info;
} MSICREATEVIEW; } MSICREATEVIEW;
@ -62,9 +63,12 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
MSITABLE *table; MSITABLE *table;
BOOL persist = (cv->bIsTemp) ? MSICONDITION_FALSE : MSICONDITION_TRUE; BOOL persist = (cv->bIsTemp) ? MSICONDITION_FALSE : MSICONDITION_TRUE;
TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name), TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name),
cv->bIsTemp?"temporary":"permanent"); cv->bIsTemp?"temporary":"permanent");
if (cv->bIsTemp && !cv->hold)
return ERROR_SUCCESS;
return msi_create_table( cv->db, cv->name, cv->col_info, persist, &table); return msi_create_table( cv->db, cv->name, cv->col_info, persist, &table);
} }
@ -197,6 +201,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
cv->name = table; cv->name = table;
cv->col_info = col_info; cv->col_info = col_info;
cv->bIsTemp = temp; cv->bIsTemp = temp;
cv->hold = hold;
*view = (MSIVIEW*) cv; *view = (MSIVIEW*) cv;
return ERROR_SUCCESS; return ERROR_SUCCESS;

View File

@ -66,14 +66,15 @@ static UINT create_temp_property_table(MSIPACKAGE *package)
UINT rc; UINT rc;
static const WCHAR CreateSql[] = { static const WCHAR CreateSql[] = {
'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','_','P','r','o', 'C','R','E','A','T','E',' ','T','A','B','L','E',' ',
'p','e','r','t','y','`',' ','(',' ','`','_','P','r','o','p','e','r','t', '`','_','P','r','o','p','e','r','t','y','`',' ','(',' ',
'y','`',' ','C','H','A','R','(','5','6',')',' ','N','O','T',' ','N','U', '`','_','P','r','o','p','e','r','t','y','`',' ',
'L','L',' ','T','E','M','P','O','R','A','R','Y',',',' ','`','V','a','l', 'C','H','A','R','(','5','6',')',' ','N','O','T',' ','N','U','L','L',' ',
'u','e','`',' ','C','H','A','R','(','9','8',')',' ','N','O','T',' ','N', 'T','E','M','P','O','R','A','R','Y',',',' ',
'U','L','L',' ','T','E','M','P','O','R','A','R','Y',' ','P','R','I','M', '`','V','a','l','u','e','`',' ','C','H','A','R','(','9','8',')',' ',
'A','R','Y',' ','K','E','Y',' ','`','_','P','r','o','p','e','r','t','y', 'N','O','T',' ','N','U','L','L',' ','T','E','M','P','O','R','A','R','Y',
'`',')',0}; ' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ',
'`','_','P','r','o','p','e','r','t','y','`',')',' ','H','O','L','D',0};
rc = MSI_DatabaseOpenViewW(package->db, CreateSql, &view); rc = MSI_DatabaseOpenViewW(package->db, CreateSql, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)

View File

@ -3274,10 +3274,13 @@ static void test_temporary_table(void)
r = run_query(hdb, 0, query); r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "failed to add table\n"); ok(r == ERROR_SUCCESS, "failed to add table\n");
todo_wine { query = "SELECT * FROM `T2`";
r = MsiDatabaseOpenView(hdb, query, &view);
ok(r == ERROR_BAD_QUERY_SYNTAX,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
cond = MsiDatabaseIsTablePersistent(hdb, "T2"); cond = MsiDatabaseIsTablePersistent(hdb, "T2");
ok( cond == MSICONDITION_NONE, "wrong return condition\n"); ok( cond == MSICONDITION_NONE, "wrong return condition\n");
}
query = "CREATE TABLE `T3` ( `B` SHORT NOT NULL TEMPORARY, `C` CHAR(255) PRIMARY KEY `C`)"; query = "CREATE TABLE `T3` ( `B` SHORT NOT NULL TEMPORARY, `C` CHAR(255) PRIMARY KEY `C`)";
r = run_query(hdb, 0, query); r = run_query(hdb, 0, query);