Commit 44f7cb88 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

msi: Add a persistent flag to tables.

Implement MSI_DatabaseIsTablePersistent.
parent a33cc3d8
......@@ -69,6 +69,7 @@ struct tagMSITABLE
struct list entry;
MSICOLUMNINFO *colinfo;
UINT col_count;
BOOL persistent;
WCHAR name[1];
};
......@@ -626,6 +627,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
table->nonpersistent_data = NULL;
table->colinfo = NULL;
table->col_count = 0;
table->persistent = persistent;
lstrcpyW( table->name, name );
for( col = col_info; col; col = col->next )
......@@ -771,6 +773,7 @@ static UINT get_table( MSIDATABASE *db, LPCWSTR name, MSITABLE **table_ret )
table->nonpersistent_data = NULL;
table->colinfo = NULL;
table->col_count = 0;
table->persistent = TRUE;
lstrcpyW( table->name, name );
/* these two tables are special - we know the column types already */
......@@ -811,6 +814,10 @@ static UINT save_table( MSIDATABASE *db, MSITABLE *t )
USHORT *rawdata = NULL, *p;
UINT rawsize, r, i, j, row_size;
/* Nothing to do for non-persistent tables */
if( !t->persistent )
return ERROR_SUCCESS;
TRACE("Saving %s\n", debugstr_w( t->name ) );
row_size = msi_table_get_row_size( t->colinfo, t->col_count );
......@@ -1694,13 +1701,22 @@ UINT MSI_CommitTables( MSIDATABASE *db )
MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table )
{
MSITABLE *t;
UINT r;
TRACE("%p %s\n", db, debugstr_w(table));
if (!table)
return MSICONDITION_ERROR;
if (!TABLE_Exists( db, table ))
r = get_table( db, table, &t );
if (r != ERROR_SUCCESS)
return MSICONDITION_NONE;
return MSICONDITION_FALSE;
if (t->persistent)
return MSICONDITION_TRUE;
else
return MSICONDITION_FALSE;
}
static MSIRECORD *msi_get_transform_record( MSITABLEVIEW *tv, string_table *st, USHORT *rawdata )
......
......@@ -2658,14 +2658,14 @@ static void test_temporary_table(void)
ok(r == ERROR_SUCCESS, "failed to add table\n");
cond = MsiDatabaseIsTablePersistent(hdb, "P");
todo_wine ok( cond == MSICONDITION_TRUE, "wrong return condition\n");
ok( cond == MSICONDITION_TRUE, "wrong return condition\n");
query = "CREATE TABLE `P2` ( `B` SHORT NOT NULL, `C` CHAR(255) PRIMARY KEY `C`) HOLD";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "failed to add table\n");
todo_wine {
cond = MsiDatabaseIsTablePersistent(hdb, "P");
cond = MsiDatabaseIsTablePersistent(hdb, "P2");
ok( cond == MSICONDITION_TRUE, "wrong return condition\n");
}
......@@ -2689,10 +2689,10 @@ static void test_temporary_table(void)
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "failed to add table\n");
todo_wine {
cond = MsiDatabaseIsTablePersistent(hdb, "T3");
ok( cond == MSICONDITION_TRUE, "wrong return condition\n");
todo_wine {
query = "CREATE TABLE `T4` ( `B` SHORT NOT NULL, `C` CHAR(255) TEMPORARY PRIMARY KEY `C`)";
r = run_query(hdb, 0, query);
ok(r == ERROR_FUNCTION_FAILED, "failed to add table\n");
......
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