[PATCH 11/13] msi: Add a persistent flag to tables.
Robert Shearman
rob at codeweavers.com
Mon Apr 23 02:25:55 CDT 2007
Implement MSI_DatabaseIsTablePersistent.
---
dlls/msi/table.c | 21 ++++++++++++++++++++-
dlls/msi/tests/db.c | 8 ++++----
2 files changed, 24 insertions(+), 5 deletions(-)
-------------- next part --------------
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 5a42f5f..c641b46 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -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,
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,
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,
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,10 +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;
- return MSICONDITION_FALSE;
+ r = get_table( db, table, &t );
+ if (r != ERROR_SUCCESS)
+ return MSICONDITION_NONE;
+
+ if (t->persistent)
+ return MSICONDITION_TRUE;
+ else
+ return MSICONDITION_FALSE;
}
static MSIRECORD *msi_get_transform_record( MSITABLEVIEW *tv, string_table *st, USHORT *rawdata )
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 927ef56..9ebcd02 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -2648,24 +2648,24 @@ static void test_temporary_table(void)
cond = MsiDatabaseIsTablePersistent(hdb, "_Columns");
ok( cond == MSICONDITION_NONE, "wrong return condition\n");
+ }
cond = MsiDatabaseIsTablePersistent(hdb, "_Streams");
ok( cond == MSICONDITION_NONE, "wrong return condition\n");
- }
query = "CREATE TABLE `P` ( `B` SHORT NOT NULL, `C` CHAR(255) PRIMARY KEY `C`)";
r = run_query(hdb, 0, query);
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");
More information about the wine-patches
mailing list