James Hawkins : msi: The _Tables and _Columns tables have no persistence attribute.

Alexandre Julliard julliard at winehq.org
Thu Feb 26 09:05:00 CST 2009


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

Author: James Hawkins <truiken at gmail.com>
Date:   Wed Feb 25 19:45:15 2009 -0800

msi: The _Tables and _Columns tables have no persistence attribute.

---

 dlls/msi/create.c   |    3 ++-
 dlls/msi/query.h    |    2 +-
 dlls/msi/table.c    |   23 ++++++++++++-----------
 dlls/msi/tests/db.c |    2 --
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/dlls/msi/create.c b/dlls/msi/create.c
index 0c61c76..571d006 100644
--- a/dlls/msi/create.c
+++ b/dlls/msi/create.c
@@ -60,11 +60,12 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
 {
     MSICREATEVIEW *cv = (MSICREATEVIEW*)view;
     MSITABLE *table;
+    BOOL persist = (cv->bIsTemp) ? MSICONDITION_FALSE : MSICONDITION_TRUE;
 
     TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name), 
           cv->bIsTemp?"temporary":"permanent");
 
-    return msi_create_table( cv->db, cv->name, cv->col_info, !cv->bIsTemp, &table);
+    return msi_create_table( cv->db, cv->name, cv->col_info, persist, &table);
 }
 
 static UINT CREATE_close( struct tagMSIVIEW *view )
diff --git a/dlls/msi/query.h b/dlls/msi/query.h
index 25bb500..93b13fd 100644
--- a/dlls/msi/query.h
+++ b/dlls/msi/query.h
@@ -124,6 +124,6 @@ int sqliteGetToken(const WCHAR *z, int *tokenType);
 MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec );
 
 UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
-                       BOOL persistent, MSITABLE **table_ret);
+                       MSICONDITION persistent, MSITABLE **table_ret);
 
 #endif /* __WINE_MSI_QUERY_H */
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index e9c2196..369dde4 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -78,7 +78,7 @@ struct tagMSITABLE
     struct list entry;
     MSICOLUMNINFO *colinfo;
     UINT col_count;
-    BOOL persistent;
+    MSICONDITION persistent;
     INT ref_count;
     WCHAR name[1];
 };
@@ -610,7 +610,7 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
 }
 
 UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
-                       BOOL persistent, MSITABLE **table_ret)
+                       MSICONDITION persistent, MSITABLE **table_ret)
 {
     UINT r, nField;
     MSIVIEW *tv = NULL;
@@ -683,7 +683,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
     if( r )
         goto err;
 
-    r = tv->ops->insert_row( tv, rec, !persistent );
+    r = tv->ops->insert_row( tv, rec, persistent == MSICONDITION_FALSE );
     TRACE("insert_row returned %x\n", r);
     if( r )
         goto err;
@@ -694,7 +694,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
     msiobj_release( &rec->hdr );
     rec = NULL;
 
-    if( persistent )
+    if( persistent != MSICONDITION_FALSE )
     {
         /* add each column to the _Columns table */
         r = TABLE_CreateView( db, szColumns, &tv );
@@ -785,9 +785,12 @@ 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;
+    table->persistent = MSICONDITION_TRUE;
     lstrcpyW( table->name, name );
 
+    if ( !lstrcmpW(name, szTables) || !lstrcmpW(name, szColumns) )
+        table->persistent = MSICONDITION_NONE;
+
     r = table_get_column_info( db, name, &table->colinfo, &table->col_count);
     if (r != ERROR_SUCCESS)
     {
@@ -813,7 +816,7 @@ static UINT save_table( MSIDATABASE *db, const MSITABLE *t )
     UINT rawsize, r, i, j, row_size;
 
     /* Nothing to do for non-persistent tables */
-    if( !t->persistent )
+    if( t->persistent == MSICONDITION_FALSE )
         return ERROR_SUCCESS;
 
     TRACE("Saving %s\n", debugstr_w( t->name ) );
@@ -1298,7 +1301,8 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
             continue;
 
         /* if row >= tv->table->row_count then it is a non-persistent row */
-        persistent = tv->table->persistent && (row < tv->table->row_count);
+        persistent = (tv->table->persistent != MSICONDITION_FALSE) &&
+                     (row < tv->table->row_count);
         /* FIXME: should we allow updating keys? */
 
         val = 0;
@@ -2214,10 +2218,7 @@ MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table )
     if (r != ERROR_SUCCESS)
         return MSICONDITION_NONE;
 
-    if (t->persistent)
-        return MSICONDITION_TRUE;
-    else
-        return MSICONDITION_FALSE;
+    return t->persistent;
 }
 
 static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index bc7e513..91426ca 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -3237,13 +3237,11 @@ static void test_temporary_table(void)
     cond = MsiDatabaseIsTablePersistent(hdb, NULL);
     ok( cond == MSICONDITION_ERROR, "wrong return condition\n");
 
-    todo_wine {
     cond = MsiDatabaseIsTablePersistent(hdb, "_Tables");
     ok( cond == MSICONDITION_NONE, "wrong return condition\n");
 
     cond = MsiDatabaseIsTablePersistent(hdb, "_Columns");
     ok( cond == MSICONDITION_NONE, "wrong return condition\n");
-    }
 
     cond = MsiDatabaseIsTablePersistent(hdb, "_Storages");
     ok( cond == MSICONDITION_NONE, "wrong return condition\n");




More information about the wine-cvs mailing list