ReactOS  0.4.14-dev-358-gbef841c
insert.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "msi.h"
#include "msiquery.h"
#include "objbase.h"
#include "objidl.h"
#include "msipriv.h"
#include "winnls.h"
#include "query.h"
Include dependency graph for insert.c:

Go to the source code of this file.

Classes

struct  tagMSIINSERTVIEW
 

Typedefs

typedef struct tagMSIINSERTVIEW MSIINSERTVIEW
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msidb)
 
static UINT INSERT_fetch_int (struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
 
MSIRECORDmsi_query_merge_record (UINT fields, const column_info *vl, MSIRECORD *rec)
 
static BOOL msi_columns_in_order (MSIINSERTVIEW *iv, UINT col_count)
 
static UINT msi_arrange_record (MSIINSERTVIEW *iv, MSIRECORD **values)
 
static BOOL row_has_null_primary_keys (MSIINSERTVIEW *iv, MSIRECORD *row)
 
static UINT INSERT_execute (struct tagMSIVIEW *view, MSIRECORD *record)
 
static UINT INSERT_close (struct tagMSIVIEW *view)
 
static UINT INSERT_get_dimensions (struct tagMSIVIEW *view, UINT *rows, UINT *cols)
 
static UINT INSERT_get_column_info (struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
 
static UINT INSERT_modify (struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
 
static UINT INSERT_delete (struct tagMSIVIEW *view)
 
static UINT INSERT_find_matching_rows (struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle)
 
static UINT count_column_info (const column_info *ci)
 
UINT INSERT_CreateView (MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, column_info *columns, column_info *values, BOOL temp)
 

Variables

static const MSIVIEWOPS insert_ops
 

Typedef Documentation

◆ MSIINSERTVIEW

Function Documentation

◆ count_column_info()

static UINT count_column_info ( const column_info ci)
static

Definition at line 353 of file insert.c.

354 {
355  UINT n = 0;
356  for ( ; ci; ci = ci->next )
357  n++;
358  return n;
359 }
GLdouble n
Definition: glext.h:7729
struct _column_info * next
Definition: msipriv.h:216
unsigned int UINT
Definition: ndis.h:50

Referenced by INSERT_CreateView().

◆ INSERT_close()

static UINT INSERT_close ( struct tagMSIVIEW view)
static

Definition at line 253 of file insert.c.

254 {
256  MSIVIEW *sv;
257 
258  TRACE("%p\n", iv);
259 
260  sv = iv->sv;
261  if( !sv )
262  return ERROR_FUNCTION_FAILED;
263 
264  return sv->ops->close( sv );
265 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
MSIVIEW * sv
Definition: insert.c:48
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
UINT(* close)(struct tagMSIVIEW *view)
Definition: msipriv.h:273

◆ INSERT_CreateView()

UINT INSERT_CreateView ( MSIDATABASE db,
MSIVIEW **  view,
LPCWSTR  table,
column_info columns,
column_info values,
BOOL  temp 
)

Definition at line 361 of file insert.c.

363 {
364  MSIINSERTVIEW *iv = NULL;
365  UINT r;
366  MSIVIEW *tv = NULL, *sv = NULL;
367 
368  TRACE("%p\n", iv );
369 
370  /* there should be one value for each column */
371  if ( count_column_info( columns ) != count_column_info(values) )
372  return ERROR_BAD_QUERY_SYNTAX;
373 
374  r = TABLE_CreateView( db, table, &tv );
375  if( r != ERROR_SUCCESS )
376  return r;
377 
378  r = SELECT_CreateView( db, &sv, tv, columns );
379  if( r != ERROR_SUCCESS )
380  {
381  if( tv )
382  tv->ops->delete( tv );
383  return r;
384  }
385 
386  iv = msi_alloc_zero( sizeof *iv );
387  if( !iv )
388  return ERROR_FUNCTION_FAILED;
389 
390  /* fill the structure */
391  iv->view.ops = &insert_ops;
392  msiobj_addref( &db->hdr );
393  iv->table = tv;
394  iv->db = db;
395  iv->vals = values;
396  iv->bIsTemp = temp;
397  iv->sv = sv;
398  *view = (MSIVIEW*) iv;
399 
400  return ERROR_SUCCESS;
401 }
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:218
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT TABLE_CreateView(MSIDATABASE *db, LPCWSTR name, MSIVIEW **view) DECLSPEC_HIDDEN
Definition: table.c:2162
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
MSIVIEW * sv
Definition: insert.c:48
static const MSIVIEWOPS insert_ops
Definition: insert.c:330
UINT SELECT_CreateView(MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, const column_info *columns) DECLSPEC_HIDDEN
Definition: select.c:424
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
MSIVIEW view
Definition: insert.c:44
BOOL bIsTemp
Definition: insert.c:47
static UINT count_column_info(const column_info *ci)
Definition: insert.c:353
UINT(* delete)(struct tagMSIVIEW *)
Definition: msipriv.h:299
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
MSIVIEW * table
Definition: insert.c:45
column_info * vals
Definition: insert.c:49
MSIOBJECTHDR hdr
Definition: msipriv.h:97
MSIDATABASE * db
Definition: insert.c:46
#define ERROR_BAD_QUERY_SYNTAX
Definition: winerror.h:973

Referenced by yyparse().

◆ INSERT_delete()

static UINT INSERT_delete ( struct tagMSIVIEW view)
static

Definition at line 305 of file insert.c.

306 {
308  MSIVIEW *sv;
309 
310  TRACE("%p\n", iv );
311 
312  sv = iv->sv;
313  if( sv )
314  sv->ops->delete( sv );
315  msiobj_release( &iv->db->hdr );
316  msi_free( iv );
317 
318  return ERROR_SUCCESS;
319 }
#define ERROR_SUCCESS
Definition: deptool.c:10
MSIVIEW * sv
Definition: insert.c:48
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
UINT(* delete)(struct tagMSIVIEW *)
Definition: msipriv.h:299
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
MSIOBJECTHDR hdr
Definition: msipriv.h:97
MSIDATABASE * db
Definition: insert.c:46

◆ INSERT_execute()

static UINT INSERT_execute ( struct tagMSIVIEW view,
MSIRECORD record 
)
static

Definition at line 205 of file insert.c.

206 {
208  UINT r, row = -1, col_count = 0;
209  MSIVIEW *sv;
210  MSIRECORD *values = NULL;
211 
212  TRACE("%p %p\n", iv, record );
213 
214  sv = iv->sv;
215  if( !sv )
216  return ERROR_FUNCTION_FAILED;
217 
218  r = sv->ops->execute( sv, 0 );
219  TRACE("sv execute returned %x\n", r);
220  if( r )
221  return r;
222 
223  r = sv->ops->get_dimensions( sv, NULL, &col_count );
224  if( r )
225  goto err;
226 
227  /*
228  * Merge the wildcard values into the list of values provided
229  * in the query, and create a record containing both.
230  */
231  values = msi_query_merge_record( col_count, iv->vals, record );
232  if( !values )
233  goto err;
234 
235  r = msi_arrange_record( iv, &values );
236  if( r != ERROR_SUCCESS )
237  goto err;
238 
239  /* rows with NULL primary keys are inserted at the beginning of the table */
240  if( row_has_null_primary_keys( iv, values ) )
241  row = 0;
242 
243  r = iv->table->ops->insert_row( iv->table, values, row, iv->bIsTemp );
244 
245 err:
246  if( values )
247  msiobj_release( &values->hdr );
248 
249  return r;
250 }
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:281
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
UINT(* execute)(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: msipriv.h:268
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
MSIVIEW * sv
Definition: insert.c:48
smooth NULL
Definition: ftsmooth.c:416
static BOOL row_has_null_primary_keys(MSIINSERTVIEW *iv, MSIRECORD *row)
Definition: insert.c:180
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
BOOL bIsTemp
Definition: insert.c:47
static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values)
Definition: insert.c:128
MSIRECORD * msi_query_merge_record(UINT fields, const column_info *vl, MSIRECORD *rec)
Definition: insert.c:67
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
#define err(...)
unsigned int UINT
Definition: ndis.h:50
MSIVIEW * table
Definition: insert.c:45
column_info * vals
Definition: insert.c:49
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
UINT(* insert_row)(struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary)
Definition: msipriv.h:258

◆ INSERT_fetch_int()

static UINT INSERT_fetch_int ( struct tagMSIVIEW view,
UINT  row,
UINT  col,
UINT val 
)
static

Definition at line 52 of file insert.c.

53 {
55 
56  TRACE("%p %d %d %p\n", iv, row, col, val );
57 
58  return ERROR_FUNCTION_FAILED;
59 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
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

◆ INSERT_find_matching_rows()

static UINT INSERT_find_matching_rows ( struct tagMSIVIEW view,
UINT  col,
UINT  val,
UINT row,
MSIITERHANDLE handle 
)
static

Definition at line 321 of file insert.c.

323 {
324  TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
325 
326  return ERROR_FUNCTION_FAILED;
327 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4

◆ INSERT_get_column_info()

static UINT INSERT_get_column_info ( struct tagMSIVIEW view,
UINT  n,
LPCWSTR name,
UINT type,
BOOL temporary,
LPCWSTR table_name 
)
static

Definition at line 281 of file insert.c.

283 {
285  MSIVIEW *sv;
286 
287  TRACE("%p %d %p %p %p %p\n", iv, n, name, type, temporary, table_name );
288 
289  sv = iv->sv;
290  if( !sv )
291  return ERROR_FUNCTION_FAILED;
292 
293  return sv->ops->get_column_info( sv, n, name, type, temporary, table_name );
294 }
GLdouble n
Definition: glext.h:7729
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
MSIVIEW * sv
Definition: insert.c:48
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
UINT(* get_column_info)(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: msipriv.h:288
Definition: name.c:36

◆ INSERT_get_dimensions()

static UINT INSERT_get_dimensions ( struct tagMSIVIEW view,
UINT rows,
UINT cols 
)
static

Definition at line 267 of file insert.c.

268 {
270  MSIVIEW *sv;
271 
272  TRACE("%p %p %p\n", iv, rows, cols );
273 
274  sv = iv->sv;
275  if( !sv )
276  return ERROR_FUNCTION_FAILED;
277 
278  return sv->ops->get_dimensions( sv, rows, cols );
279 }
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:281
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
MSIVIEW * sv
Definition: insert.c:48
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348

◆ INSERT_modify()

static UINT INSERT_modify ( struct tagMSIVIEW view,
MSIMODIFY  eModifyMode,
MSIRECORD rec,
UINT  row 
)
static

Definition at line 296 of file insert.c.

297 {
299 
300  TRACE("%p %d %p\n", iv, eModifyMode, rec );
301 
302  return ERROR_FUNCTION_FAILED;
303 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4

◆ msi_arrange_record()

static UINT msi_arrange_record ( MSIINSERTVIEW iv,
MSIRECORD **  values 
)
static

Definition at line 128 of file insert.c.

129 {
130  MSIRECORD *padded;
131  UINT col_count, val_count;
132  UINT r, i, colidx;
133  LPCWSTR a, b;
134 
135  r = iv->table->ops->get_dimensions(iv->table, NULL, &col_count);
136  if (r != ERROR_SUCCESS)
137  return r;
138 
139  val_count = MSI_RecordGetFieldCount(*values);
140 
141  /* check to see if the columns are arranged already
142  * to avoid unnecessary copying
143  */
144  if (col_count == val_count && msi_columns_in_order(iv, col_count))
145  return ERROR_SUCCESS;
146 
147  padded = MSI_CreateRecord(col_count);
148  if (!padded)
149  return ERROR_OUTOFMEMORY;
150 
151  for (colidx = 1; colidx <= val_count; colidx++)
152  {
153  r = iv->sv->ops->get_column_info(iv->sv, colidx, &a, NULL, NULL, NULL);
154  if (r != ERROR_SUCCESS)
155  goto err;
156 
157  for (i = 1; i <= col_count; i++)
158  {
159  r = iv->table->ops->get_column_info(iv->table, i, &b, NULL,
160  NULL, NULL);
161  if (r != ERROR_SUCCESS)
162  goto err;
163 
164  if (!strcmpW( a, b ))
165  {
166  MSI_RecordCopyField(*values, colidx, padded, i);
167  break;
168  }
169  }
170  }
171  msiobj_release(&(*values)->hdr);
172  *values = padded;
173  return ERROR_SUCCESS;
174 
175 err:
176  msiobj_release(&padded->hdr);
177  return r;
178 }
UINT MSI_RecordCopyField(MSIRECORD *, UINT, MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:169
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:281
MSIOBJECTHDR hdr
Definition: msipriv.h:141
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
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
#define a
Definition: ke_i.h:78
MSIVIEW * sv
Definition: insert.c:48
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const MSIVIEWOPS * ops
Definition: msipriv.h:348
static BOOL msi_columns_in_order(MSIINSERTVIEW *iv, UINT col_count)
Definition: insert.c:110
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:79
#define err(...)
unsigned int UINT
Definition: ndis.h:50
MSIVIEW * table
Definition: insert.c:45
UINT(* get_column_info)(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: msipriv.h:288
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
UINT MSI_RecordGetFieldCount(const MSIRECORD *rec) DECLSPEC_HIDDEN
Definition: record.c:111
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by INSERT_execute().

◆ msi_columns_in_order()

static BOOL msi_columns_in_order ( MSIINSERTVIEW iv,
UINT  col_count 
)
static

Definition at line 110 of file insert.c.

111 {
112  LPCWSTR a, b;
113  UINT i;
114 
115  for (i = 1; i <= col_count; i++)
116  {
117  iv->sv->ops->get_column_info(iv->sv, i, &a, NULL, NULL, NULL);
118  iv->table->ops->get_column_info(iv->table, i, &b, NULL, NULL, NULL);
119 
120  if (strcmpW( a, b )) return FALSE;
121  }
122  return TRUE;
123 }
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
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
#define a
Definition: ke_i.h:78
MSIVIEW * sv
Definition: insert.c:48
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const MSIVIEWOPS * ops
Definition: msipriv.h:348
unsigned int UINT
Definition: ndis.h:50
MSIVIEW * table
Definition: insert.c:45
UINT(* get_column_info)(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: msipriv.h:288
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by msi_arrange_record().

◆ msi_query_merge_record()

MSIRECORD* msi_query_merge_record ( UINT  fields,
const column_info vl,
MSIRECORD rec 
)

Definition at line 67 of file insert.c.

68 {
69  MSIRECORD *merged;
70  DWORD wildcard_count = 1, i;
71 
72  merged = MSI_CreateRecord( fields );
73  for( i=1; i <= fields; i++ )
74  {
75  if( !vl )
76  {
77  TRACE("Not enough elements in the list to insert\n");
78  goto err;
79  }
80  switch( vl->val->type )
81  {
82  case EXPR_SVAL:
83  TRACE("field %d -> %s\n", i, debugstr_w(vl->val->u.sval));
84  MSI_RecordSetStringW( merged, i, vl->val->u.sval );
85  break;
86  case EXPR_IVAL:
87  MSI_RecordSetInteger( merged, i, vl->val->u.ival );
88  break;
89  case EXPR_WILDCARD:
90  if( !rec )
91  goto err;
92  MSI_RecordCopyField( rec, wildcard_count, merged, i );
93  wildcard_count++;
94  break;
95  default:
96  ERR("Unknown expression type %d\n", vl->val->type);
97  }
98  vl = vl->next;
99  }
100 
101  return merged;
102 err:
103  msiobj_release( &merged->hdr );
104  return NULL;
105 }
UINT MSI_RecordSetStringW(MSIRECORD *, UINT, LPCWSTR) DECLSPEC_HIDDEN
Definition: record.c:649
UINT MSI_RecordCopyField(MSIRECORD *, UINT, MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:169
MSIOBJECTHDR hdr
Definition: msipriv.h:141
struct _column_info * next
Definition: msipriv.h:216
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
UINT MSI_RecordSetInteger(MSIRECORD *, UINT, int) DECLSPEC_HIDDEN
Definition: record.c:328
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
#define EXPR_WILDCARD
Definition: query.h:54
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:79
#define err(...)
#define ERR(fmt,...)
Definition: debug.h:109
struct expr * val
Definition: msipriv.h:215

Referenced by INSERT_execute(), and UPDATE_execute().

◆ row_has_null_primary_keys()

static BOOL row_has_null_primary_keys ( MSIINSERTVIEW iv,
MSIRECORD row 
)
static

Definition at line 180 of file insert.c.

181 {
182  UINT r, i, col_count, type;
183 
184  r = iv->table->ops->get_dimensions( iv->table, NULL, &col_count );
185  if (r != ERROR_SUCCESS)
186  return FALSE;
187 
188  for (i = 1; i <= col_count; i++)
189  {
190  r = iv->table->ops->get_column_info(iv->table, i, NULL, &type,
191  NULL, NULL);
192  if (r != ERROR_SUCCESS)
193  return FALSE;
194 
195  if (!(type & MSITYPE_KEY))
196  continue;
197 
198  if (MSI_RecordIsNull(row, i))
199  return TRUE;
200  }
201 
202  return FALSE;
203 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:281
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
BOOL MSI_RecordIsNull(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:369
smooth NULL
Definition: ftsmooth.c:416
const MSIVIEWOPS * ops
Definition: msipriv.h:348
#define MSITYPE_KEY
Definition: msipriv.h:49
unsigned int UINT
Definition: ndis.h:50
MSIVIEW * table
Definition: insert.c:45
UINT(* get_column_info)(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: msipriv.h:288
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

Referenced by INSERT_execute().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msidb  )

Variable Documentation

◆ insert_ops

const MSIVIEWOPS insert_ops
static
Initial value:
=
{
}
static UINT INSERT_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
Definition: insert.c:296
static UINT INSERT_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: insert.c:281
static UINT INSERT_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: insert.c:205
smooth NULL
Definition: ftsmooth.c:416
static UINT INSERT_close(struct tagMSIVIEW *view)
Definition: insert.c:253
static UINT INSERT_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: insert.c:267
static UINT INSERT_find_matching_rows(struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle)
Definition: insert.c:321
static UINT INSERT_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: insert.c:52
static UINT INSERT_delete(struct tagMSIVIEW *view)
Definition: insert.c:305

Definition at line 330 of file insert.c.

Referenced by INSERT_CreateView().