wininet: Handle proxy entries of the form <proto>=<proxy>, and allow multiple proxies.
[wine] / dlls / msi / create.c
index ed8713c..2e13d59 100644 (file)
@@ -42,8 +42,9 @@ typedef struct tagMSICREATEVIEW
 {
     MSIVIEW          view;
     MSIDATABASE     *db;
-    LPWSTR           name;
+    LPCWSTR          name;
     BOOL             bIsTemp;
+    BOOL             hold;
     column_info     *col_info;
 } MSICREATEVIEW;
 
@@ -60,11 +61,15 @@ 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), 
+    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 )
@@ -86,11 +91,12 @@ static UINT CREATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co
 }
 
 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;
 }
@@ -137,11 +143,12 @@ static const MSIVIEWOPS create_ops =
     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 )
@@ -152,13 +159,14 @@ static UINT check_columns( column_info *col_info )
     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 );
 
@@ -171,11 +179,21 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
         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;
@@ -184,6 +202,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
     cv->name = table;
     cv->col_info = col_info;
     cv->bIsTemp = temp;
+    cv->hold = hold;
     *view = (MSIVIEW*) cv;
 
     return ERROR_SUCCESS;