ReactOS 0.4.15-dev-8222-g9164419
delete.c
Go to the documentation of this file.
1/*
2 * Implementation of the Microsoft Installer (msi.dll)
3 *
4 * Copyright 2002-2005 Mike McCormack for CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21#include <stdarg.h>
22
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"
32#include "winnls.h"
33
34#include "query.h"
35
37
38
39/*
40 * Code to delete rows from a table.
41 *
42 * We delete rows by blanking them out rather than trying to remove the row.
43 * This appears to be what the native MSI does (or tries to do). For the query:
44 *
45 * delete from Property
46 *
47 * some non-zero entries are left in the table by native MSI. I'm not sure if
48 * that's a bug in the way I'm running the query, or a just a bug.
49 */
50
51typedef struct tagMSIDELETEVIEW
52{
57
59{
61
62 TRACE("%p %d %d %p\n", dv, row, col, val );
63
65}
66
68{
70
71 TRACE("%p %d %d %p\n", dv, row, col, stm );
72
74}
75
77{
79 UINT r, i, rows = 0, cols = 0;
80
81 TRACE("%p %p\n", dv, record);
82
83 if( !dv->table )
85
86 r = dv->table->ops->execute( dv->table, record );
87 if( r != ERROR_SUCCESS )
88 return r;
89
90 r = dv->table->ops->get_dimensions( dv->table, &rows, &cols );
91 if( r != ERROR_SUCCESS )
92 return r;
93
94 TRACE("deleting %d rows\n", rows);
95
96 /* blank out all the rows that match */
97 for ( i=0; i<rows; i++ )
98 dv->table->ops->delete_row( dv->table, i );
99
100 return ERROR_SUCCESS;
101}
102
104{
106
107 TRACE("%p\n", dv );
108
109 if( !dv->table )
111
112 return dv->table->ops->close( dv->table );
113}
114
115static UINT DELETE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols )
116{
118
119 TRACE("%p %p %p\n", dv, rows, cols );
120
121 if( !dv->table )
123
124 *rows = 0;
125
126 return dv->table->ops->get_dimensions( dv->table, NULL, cols );
127}
128
130 UINT *type, BOOL *temporary, LPCWSTR *table_name )
131{
133
134 TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name );
135
136 if( !dv->table )
138
139 return dv->table->ops->get_column_info( dv->table, n, name,
140 type, temporary, table_name);
141}
142
143static UINT DELETE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
144 MSIRECORD *rec, UINT row )
145{
147
148 TRACE("%p %d %p\n", dv, eModifyMode, rec );
149
151}
152
154{
156
157 TRACE("%p\n", dv );
158
159 if( dv->table )
160 dv->table->ops->delete( dv->table );
161
162 msi_free( dv );
163
164 return ERROR_SUCCESS;
165}
166
167static const MSIVIEWOPS delete_ops =
168{
171 NULL,
172 NULL,
173 NULL,
174 NULL,
175 NULL,
176 NULL,
183 NULL,
184 NULL,
185 NULL,
186 NULL,
187 NULL,
188};
189
191{
192 MSIDELETEVIEW *dv = NULL;
193
194 TRACE("%p\n", dv );
195
196 dv = msi_alloc_zero( sizeof *dv );
197 if( !dv )
199
200 /* fill the structure */
201 dv->view.ops = &delete_ops;
202 dv->db = db;
203 dv->table = table;
204
205 *view = &dv->view;
206
207 return ERROR_SUCCESS;
208}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
static UINT DELETE_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: delete.c:76
static UINT DELETE_fetch_stream(struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
Definition: delete.c:67
static UINT DELETE_close(struct tagMSIVIEW *view)
Definition: delete.c:103
static UINT DELETE_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
Definition: delete.c:143
static UINT DELETE_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: delete.c:58
static UINT DELETE_delete(struct tagMSIVIEW *view)
Definition: delete.c:153
static const MSIVIEWOPS delete_ops
Definition: delete.c:167
static UINT DELETE_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: delete.c:115
static UINT DELETE_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: delete.c:129
struct tagMSIDELETEVIEW MSIDELETEVIEW
UINT DELETE_CreateView(MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table)
Definition: delete.c:190
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLuint GLfloat * val
Definition: glext.h:7180
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1148
static void msi_free(void *mem)
Definition: msipriv.h:1159
unsigned int UINT
Definition: ndis.h:50
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:39
MSIDATABASE * db
Definition: delete.c:54
MSIVIEW view
Definition: delete.c:53
MSIVIEW * table
Definition: delete.c:55
UINT(* close)(struct tagMSIVIEW *view)
Definition: msipriv.h:298
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:306
UINT(* execute)(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: msipriv.h:293
UINT(* get_column_info)(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: msipriv.h:313
UINT(* delete_row)(struct tagMSIVIEW *view, UINT row)
Definition: msipriv.h:288
UINT(* delete)(struct tagMSIVIEW *)
Definition: msipriv.h:324
const MSIVIEWOPS * ops
Definition: msipriv.h:355
int MSIMODIFY
Definition: winemsi.idl:33
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185