{
MSIVIEW view;
MSIDATABASE *db;
- LPWSTR name;
+ LPCWSTR name;
BOOL bIsTemp;
+ BOOL hold;
column_info *col_info;
} MSICREATEVIEW;
{
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),
+ 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);
+ if (cv->bIsTemp && !cv->hold)
+ return ERROR_SUCCESS;
+
+ return msi_create_table( cv->db, cv->name, cv->col_info, persist, &table);
}
static UINT CREATE_close( struct tagMSIVIEW *view )
}
static UINT CREATE_get_column_info( struct tagMSIVIEW *view,
- UINT n, LPWSTR *name, UINT *type )
+ UINT n, LPWSTR *name, UINT *type, BOOL *temporary,
+ LPWSTR *table_name)
{
MSICREATEVIEW *cv = (MSICREATEVIEW*)view;
- TRACE("%p %d %p %p\n", cv, n, name, type );
+ TRACE("%p %d %p %p %p %p\n", cv, n, name, type, temporary, table_name );
return ERROR_FUNCTION_FAILED;
}
NULL,
NULL,
NULL,
+ NULL,
};
-static UINT check_columns( column_info *col_info )
+static UINT check_columns( const column_info *col_info )
{
- column_info *c1, *c2;
+ const column_info *c1, *c2;
/* check for two columns with the same name */
for( c1 = col_info; c1; c1 = c1->next )
return ERROR_SUCCESS;
}
-UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
+UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
column_info *col_info, BOOL hold )
{
MSICREATEVIEW *cv = NULL;
UINT r;
- const column_info *col;
+ column_info *col;
BOOL temp = TRUE;
+ BOOL tempprim = FALSE;
TRACE("%p\n", cv );
return ERROR_FUNCTION_FAILED;
for( col = col_info; col; col = col->next )
+ {
+ if (!col->table)
+ col->table = table;
+
if( !col->temporary )
- {
temp = FALSE;
- break;
- }
+ else if ( col->type & MSITYPE_KEY )
+ tempprim = TRUE;
+ }
+
+ if ( !temp && tempprim )
+ {
+ msi_free( cv );
+ return ERROR_FUNCTION_FAILED;
+ }
/* fill the structure */
cv->view.ops = &create_ops;
cv->name = table;
cv->col_info = col_info;
cv->bIsTemp = temp;
+ cv->hold = hold;
*view = (MSIVIEW*) cv;
return ERROR_SUCCESS;