Rob Shearman : msi: Add a persistent flag to tables.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 24 07:24:05 CDT 2007


Module: wine
Branch: master
Commit: 44f7cb8858f9cb316b939edb0ded65d7fcb0433b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=44f7cb8858f9cb316b939edb0ded65d7fcb0433b

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Apr 24 11:00:44 2007 +0100

msi: Add a persistent flag to tables.

Implement MSI_DatabaseIsTablePersistent.

---

 dlls/msi/table.c    |   20 ++++++++++++++++++--
 dlls/msi/tests/db.c |    6 +++---
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 09abe1a..b6ede40 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, 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 )
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 422bba3..9ebcd02 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -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");




More information about the wine-cvs mailing list