push 3fbe09a897e9df6e6f0eb06b20d156a830394152
[wine/hacks.git] / dlls / msi / drop.c
blob20ab4417b52437a6a66a3fc501128c507255743a
1 /*
2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2008 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "wine/debug.h"
27 #include "msi.h"
28 #include "msiquery.h"
29 #include "objbase.h"
30 #include "objidl.h"
31 #include "msipriv.h"
33 #include "query.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(msidb);
37 typedef struct tagMSIDROPVIEW
39 MSIVIEW view;
40 MSIDATABASE *db;
41 MSIVIEW *table;
42 column_info *colinfo;
43 INT hold;
44 } MSIDROPVIEW;
46 static UINT DROP_execute(struct tagMSIVIEW *view, MSIRECORD *record)
48 MSIDROPVIEW *dv = (MSIDROPVIEW*)view;
49 UINT r;
51 TRACE("%p %p\n", dv, record);
53 if( !dv->table )
54 return ERROR_FUNCTION_FAILED;
56 r = dv->table->ops->execute(dv->table, record);
57 if (r != ERROR_SUCCESS)
58 return r;
60 return dv->table->ops->drop(dv->table);
63 static UINT DROP_close(struct tagMSIVIEW *view)
65 MSIDROPVIEW *dv = (MSIDROPVIEW*)view;
67 TRACE("%p\n", dv);
69 return ERROR_SUCCESS;
72 static UINT DROP_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
74 MSIDROPVIEW *dv = (MSIDROPVIEW*)view;
76 TRACE("%p %p %p\n", dv, rows, cols);
78 return ERROR_FUNCTION_FAILED;
81 static const MSIVIEWOPS drop_ops =
83 NULL,
84 NULL,
85 NULL,
86 NULL,
87 NULL,
88 NULL,
89 DROP_execute,
90 DROP_close,
91 DROP_get_dimensions,
92 NULL,
93 NULL,
94 NULL,
95 NULL,
96 NULL,
97 NULL,
98 NULL,
99 NULL,
100 NULL,
101 NULL,
104 UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name)
106 MSIDROPVIEW *dv;
107 UINT r;
109 TRACE("%p %s\n", view, debugstr_w(name));
111 dv = msi_alloc_zero(sizeof *dv);
112 if(!dv)
113 return ERROR_FUNCTION_FAILED;
115 r = TABLE_CreateView(db, name, &dv->table);
116 if (r != ERROR_SUCCESS || !dv->table)
117 return r;
119 dv->view.ops = &drop_ops;
120 dv->db = db;
122 *view = (MSIVIEW *)dv;
124 return ERROR_SUCCESS;