Commit 74aa0534 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

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

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