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 )
{
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 )
......
......@@ -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 */
......@@ -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)
......
......@@ -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");
......
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