ReactOS  0.4.15-dev-4934-gfd1e799
select.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.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 select.c:

Go to the source code of this file.

Classes

struct  tagMSISELECTVIEW
 

Typedefs

typedef struct tagMSISELECTVIEW MSISELECTVIEW
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msidb)
 
static UINT translate_record (MSISELECTVIEW *sv, MSIRECORD *in, MSIRECORD **out)
 
static UINT SELECT_fetch_int (struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
 
static UINT SELECT_fetch_stream (struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
 
static UINT SELECT_set_row (struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
 
static UINT SELECT_insert_row (struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary)
 
static UINT SELECT_execute (struct tagMSIVIEW *view, MSIRECORD *record)
 
static UINT SELECT_close (struct tagMSIVIEW *view)
 
static UINT SELECT_get_dimensions (struct tagMSIVIEW *view, UINT *rows, UINT *cols)
 
static UINT SELECT_get_column_info (struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
 
UINT msi_select_update (MSIVIEW *view, MSIRECORD *rec, UINT row)
 
static UINT SELECT_modify (struct tagMSIVIEW *view, MSIMODIFY mode, MSIRECORD *rec, UINT row)
 
static UINT SELECT_delete (struct tagMSIVIEW *view)
 
static UINT SELECT_AddColumn (MSISELECTVIEW *sv, LPCWSTR name, LPCWSTR table_name)
 
static int select_count_columns (const column_info *col)
 
UINT SELECT_CreateView (MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, const column_info *columns)
 

Variables

static const MSIVIEWOPS select_ops
 

Typedef Documentation

◆ MSISELECTVIEW

Function Documentation

◆ msi_select_update()

UINT msi_select_update ( MSIVIEW view,
MSIRECORD rec,
UINT  row 
)

Definition at line 249 of file select.c.

250 {
252  UINT r, i, col, type, val;
253  IStream *stream;
254  LPCWSTR str;
255 
256  for (i = 0; i < sv->num_cols; i++)
257  {
258  col = sv->cols[i];
259 
261  if (r != ERROR_SUCCESS)
262  {
263  ERR("Failed to get column information: %d\n", r);
264  return r;
265  }
266 
267  if (MSITYPE_IS_BINARY(type))
268  {
269  if (MSI_RecordGetIStream(rec, i + 1, &stream))
270  return ERROR_FUNCTION_FAILED;
271  r = sv->table->ops->set_stream(sv->table, row, col, stream);
272  }
273  else if (type & MSITYPE_STRING)
274  {
275  int len;
276  str = msi_record_get_string(rec, i + 1, &len);
277  r = sv->table->ops->set_string(sv->table, row, col, str, len);
278  }
279  else
280  {
281  val = MSI_RecordGetInteger(rec, i + 1);
282  r = sv->table->ops->set_int(sv->table, row, col, val);
283  }
284 
285  if (r != ERROR_SUCCESS)
286  {
287  ERR("Failed to modify record: %d\n", r);
288  return r;
289  }
290  }
291 
292  return ERROR_SUCCESS;
293 }
UINT(* set_stream)(struct tagMSIVIEW *view, UINT row, UINT col, IStream *stream)
Definition: msipriv.h:271
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT MSI_RecordGetIStream(MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN
Definition: record.c:852
#define MSITYPE_IS_BINARY(type)
Definition: msipriv.h:62
#define MSITYPE_STRING
Definition: msipriv.h:50
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT cols[1]
Definition: select.c:48
UINT(* set_string)(struct tagMSIVIEW *view, UINT row, UINT col, const WCHAR *val, int len)
Definition: msipriv.h:264
const WCHAR * str
GLuint GLfloat * val
Definition: glext.h:7180
UINT num_cols
Definition: select.c:46
const MSIVIEWOPS * ops
Definition: msipriv.h:355
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
static UINT SELECT_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: select.c:223
GLenum GLsizei len
Definition: glext.h:6722
MSIVIEW * table
Definition: select.c:45
int MSI_RecordGetInteger(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:213
const WCHAR * msi_record_get_string(const MSIRECORD *, UINT, int *) DECLSPEC_HIDDEN
Definition: record.c:420
#define ERR(fmt,...)
Definition: debug.h:110
UINT(* set_int)(struct tagMSIVIEW *view, UINT row, UINT col, int val)
Definition: msipriv.h:257
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
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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 SELECT_modify(), and UPDATE_execute().

◆ SELECT_AddColumn()

static UINT SELECT_AddColumn ( MSISELECTVIEW sv,
LPCWSTR  name,
LPCWSTR  table_name 
)
static

Definition at line 375 of file select.c.

377 {
378  UINT r, n;
379  MSIVIEW *table;
380 
381  TRACE("%p adding %s.%s\n", sv, debugstr_w( table_name ),
382  debugstr_w( name ));
383 
384  if( sv->view.ops != &select_ops )
385  return ERROR_FUNCTION_FAILED;
386 
387  table = sv->table;
388  if( !table )
389  return ERROR_FUNCTION_FAILED;
390  if( !table->ops->get_dimensions )
391  return ERROR_FUNCTION_FAILED;
392  if( !table->ops->get_column_info )
393  return ERROR_FUNCTION_FAILED;
394 
395  if( sv->num_cols >= sv->max_cols )
396  return ERROR_FUNCTION_FAILED;
397 
398  if ( !name[0] ) n = 0;
399  else
400  {
401  r = VIEW_find_column( table, name, table_name, &n );
402  if( r != ERROR_SUCCESS )
403  return r;
404  }
405 
406  sv->cols[sv->num_cols] = n;
407  TRACE("Translating column %s from %d -> %d\n",
408  debugstr_w( name ), sv->num_cols, n);
409 
410  sv->num_cols++;
411 
412  return ERROR_SUCCESS;
413 }
UINT max_cols
Definition: select.c:47
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT cols[1]
Definition: select.c:48
#define debugstr_w
Definition: kernel32.h:32
static const MSIVIEWOPS select_ops
Definition: select.c:352
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW view
Definition: select.c:43
MSIVIEW * table
Definition: select.c:45
UINT VIEW_find_column(MSIVIEW *, LPCWSTR, LPCWSTR, UINT *) DECLSPEC_HIDDEN
Definition: msiquery.c:59
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38

Referenced by SELECT_CreateView().

◆ SELECT_close()

static UINT SELECT_close ( struct tagMSIVIEW view)
static

Definition at line 196 of file select.c.

197 {
199 
200  TRACE("%p\n", sv );
201 
202  if( !sv->table )
203  return ERROR_FUNCTION_FAILED;
204 
205  return sv->table->ops->close( sv->table );
206 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
UINT(* close)(struct tagMSIVIEW *view)
Definition: msipriv.h:298
MSIVIEW * table
Definition: select.c:45

◆ select_count_columns()

static int select_count_columns ( const column_info col)
static

Definition at line 415 of file select.c.

416 {
417  int n;
418  for (n = 0; col; col = col->next)
419  n++;
420  return n;
421 }
GLdouble n
Definition: glext.h:7729
struct _column_info * next
Definition: msipriv.h:226

Referenced by SELECT_CreateView().

◆ SELECT_CreateView()

UINT SELECT_CreateView ( MSIDATABASE db,
MSIVIEW **  view,
MSIVIEW table,
const column_info columns 
)

Definition at line 423 of file select.c.

425 {
426  MSISELECTVIEW *sv = NULL;
427  UINT count = 0, r = ERROR_SUCCESS;
428 
429  TRACE("%p\n", sv );
430 
431  count = select_count_columns( columns );
432 
434  if( !sv )
435  return ERROR_FUNCTION_FAILED;
436 
437  /* fill the structure */
438  sv->view.ops = &select_ops;
439  sv->db = db;
440  sv->table = table;
441  sv->num_cols = 0;
442  sv->max_cols = count;
443 
444  while( columns )
445  {
446  r = SELECT_AddColumn( sv, columns->column, columns->table );
447  if( r )
448  break;
449  columns = columns->next;
450  }
451 
452  if( r == ERROR_SUCCESS )
453  *view = &sv->view;
454  else
455  msi_free( sv );
456 
457  return r;
458 }
UINT max_cols
Definition: select.c:47
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
struct _column_info * next
Definition: msipriv.h:226
static void msi_free(void *mem)
Definition: msipriv.h:1159
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1148
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static const MSIVIEWOPS select_ops
Definition: select.c:352
LPCWSTR column
Definition: msipriv.h:223
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW view
Definition: select.c:43
MSIVIEW * table
Definition: select.c:45
static int select_count_columns(const column_info *col)
Definition: select.c:415
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
LPCWSTR table
Definition: msipriv.h:222
MSIDATABASE * db
Definition: select.c:44
static UINT SELECT_AddColumn(MSISELECTVIEW *sv, LPCWSTR name, LPCWSTR table_name)
Definition: select.c:375

Referenced by INSERT_CreateView(), and UPDATE_CreateView().

◆ SELECT_delete()

static UINT SELECT_delete ( struct tagMSIVIEW view)
static

Definition at line 337 of file select.c.

338 {
340 
341  TRACE("%p\n", sv );
342 
343  if( sv->table )
344  sv->table->ops->delete( sv->table );
345  sv->table = NULL;
346 
347  msi_free( sv );
348 
349  return ERROR_SUCCESS;
350 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW * table
Definition: select.c:45
UINT(* delete)(struct tagMSIVIEW *)
Definition: msipriv.h:324
#define NULL
Definition: types.h:112

◆ SELECT_execute()

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

Definition at line 184 of file select.c.

185 {
187 
188  TRACE("%p %p\n", sv, record);
189 
190  if( !sv->table )
191  return ERROR_FUNCTION_FAILED;
192 
193  return sv->table->ops->execute( sv->table, record );
194 }
UINT(* execute)(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: msipriv.h:293
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW * table
Definition: select.c:45

◆ SELECT_fetch_int()

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

Definition at line 75 of file select.c.

76 {
78 
79  TRACE("%p %d %d %p\n", sv, row, col, val );
80 
81  if( !sv->table )
82  return ERROR_FUNCTION_FAILED;
83 
84  if( !col || col > sv->num_cols )
85  return ERROR_FUNCTION_FAILED;
86 
87  col = sv->cols[ col - 1 ];
88  if( !col )
89  {
90  *val = 0;
91  return ERROR_SUCCESS;
92  }
93  return sv->table->ops->fetch_int( sv->table, row, col, val );
94 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT cols[1]
Definition: select.c:48
GLuint GLfloat * val
Definition: glext.h:7180
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW * table
Definition: select.c:45
UINT(* fetch_int)(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: msipriv.h:242
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

◆ SELECT_fetch_stream()

static UINT SELECT_fetch_stream ( struct tagMSIVIEW view,
UINT  row,
UINT  col,
IStream **  stm 
)
static

Definition at line 96 of file select.c.

97 {
99 
100  TRACE("%p %d %d %p\n", sv, row, col, stm );
101 
102  if( !sv->table )
103  return ERROR_FUNCTION_FAILED;
104 
105  if( !col || col > sv->num_cols )
106  return ERROR_FUNCTION_FAILED;
107 
108  col = sv->cols[ col - 1 ];
109  if( !col )
110  {
111  *stm = NULL;
112  return ERROR_SUCCESS;
113  }
114  return sv->table->ops->fetch_stream( sv->table, row, col, stm );
115 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT cols[1]
Definition: select.c:48
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW * table
Definition: select.c:45
#define NULL
Definition: types.h:112
UINT(* fetch_stream)(struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
Definition: msipriv.h:250
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

◆ SELECT_get_column_info()

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

Definition at line 223 of file select.c.

225 {
227 
228  TRACE("%p %d %p %p %p %p\n", sv, n, name, type, temporary, table_name );
229 
230  if( !sv->table )
231  return ERROR_FUNCTION_FAILED;
232 
233  if( !n || n > sv->num_cols )
234  return ERROR_FUNCTION_FAILED;
235 
236  n = sv->cols[ n - 1 ];
237  if( !n )
238  {
239  if (name) *name = L"";
241  if (temporary) *temporary = FALSE;
242  if (table_name) *table_name = L"";
243  return ERROR_SUCCESS;
244  }
245  return sv->table->ops->get_column_info( sv->table, n, name,
246  type, temporary, table_name );
247 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble n
Definition: glext.h:7729
#define MSITYPE_UNKNOWN
Definition: msipriv.h:54
#define L(x)
Definition: ntvdm.h:50
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define FALSE
Definition: types.h:117
UINT cols[1]
Definition: select.c:48
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW * table
Definition: select.c:45
#define MSITYPE_VALID
Definition: msipriv.h:48
UINT(* get_column_info)(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: msipriv.h:313
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by msi_select_update().

◆ SELECT_get_dimensions()

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

Definition at line 208 of file select.c.

209 {
211 
212  TRACE("%p %p %p\n", sv, rows, cols );
213 
214  if( !sv->table )
215  return ERROR_FUNCTION_FAILED;
216 
217  if( cols )
218  *cols = sv->num_cols;
219 
220  return sv->table->ops->get_dimensions( sv->table, rows, NULL );
221 }
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:306
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
MSIVIEW * table
Definition: select.c:45
#define NULL
Definition: types.h:112

◆ SELECT_insert_row()

static UINT SELECT_insert_row ( struct tagMSIVIEW view,
MSIRECORD record,
UINT  row,
BOOL  temporary 
)
static

Definition at line 159 of file select.c.

160 {
162  UINT table_cols, r;
163  MSIRECORD *outrec;
164 
165  TRACE("%p %p\n", sv, record );
166 
167  if ( !sv->table )
168  return ERROR_FUNCTION_FAILED;
169 
170  /* rearrange the record to suit the table */
171  r = sv->table->ops->get_dimensions( sv->table, NULL, &table_cols );
172  if (r != ERROR_SUCCESS)
173  return r;
174 
175  if ((r = translate_record( sv, record, &outrec )))
176  return r;
177 
178  r = sv->table->ops->insert_row( sv->table, outrec, row, temporary );
179 
180  msiobj_release( &outrec->hdr );
181  return r;
182 }
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:306
MSIOBJECTHDR hdr
Definition: msipriv.h:151
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
MSIVIEW * table
Definition: select.c:45
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static UINT translate_record(MSISELECTVIEW *sv, MSIRECORD *in, MSIRECORD **out)
Definition: select.c:51
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:283

◆ SELECT_modify()

static UINT SELECT_modify ( struct tagMSIVIEW view,
MSIMODIFY  mode,
MSIRECORD rec,
UINT  row 
)
static

Definition at line 295 of file select.c.

297 {
299  MSIRECORD *table_rec;
300  UINT r;
301 
302  TRACE("view %p, mode %d, rec %p, row %u.\n", view, mode, rec, row);
303 
304  if( !sv->table )
305  return ERROR_FUNCTION_FAILED;
306 
307  /* Tests demonstrate that UPDATE only affects the columns selected and that
308  * others are left unchanged; however, ASSIGN overwrites unselected columns
309  * to NULL. Similarly, MERGE matches all unselected columns as NULL rather
310  * than just ignoring them. */
311 
312  switch (mode)
313  {
314  case MSIMODIFY_REFRESH:
315  return msi_view_refresh_row(sv->db, view, row, rec);
316  case MSIMODIFY_UPDATE:
317  return msi_select_update(view, rec, row);
318  case MSIMODIFY_INSERT:
319  case MSIMODIFY_ASSIGN:
320  case MSIMODIFY_MERGE:
323  if ((r = translate_record( sv, rec, &table_rec )))
324  return r;
325 
326  r = sv->table->ops->modify( sv->table, mode, table_rec, row );
327  msiobj_release( &table_rec->hdr );
328  return r;
329  case MSIMODIFY_DELETE:
330  return sv->table->ops->modify( sv->table, mode, rec, row );
331  default:
332  FIXME("unhandled mode %d\n", mode);
333  return ERROR_FUNCTION_FAILED;
334  }
335 }
MSIOBJECTHDR hdr
Definition: msipriv.h:151
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define FIXME(fmt,...)
Definition: debug.h:111
UINT msi_view_refresh_row(MSIDATABASE *db, MSIVIEW *view, UINT row, MSIRECORD *rec)
Definition: msiquery.c:287
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
MSIVIEW * table
Definition: select.c:45
GLenum mode
Definition: glext.h:6217
UINT msi_select_update(MSIVIEW *view, MSIRECORD *rec, UINT row)
Definition: select.c:249
unsigned int UINT
Definition: ndis.h:50
static UINT translate_record(MSISELECTVIEW *sv, MSIRECORD *in, MSIRECORD **out)
Definition: select.c:51
UINT(* modify)(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *record, UINT row)
Definition: msipriv.h:319
MSIDATABASE * db
Definition: select.c:44
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

◆ SELECT_set_row()

static UINT SELECT_set_row ( struct tagMSIVIEW view,
UINT  row,
MSIRECORD rec,
UINT  mask 
)
static

Definition at line 117 of file select.c.

118 {
120  UINT i, expanded_mask = 0, r = ERROR_SUCCESS, col_count = 0;
121  MSIRECORD *expanded;
122 
123  TRACE("%p %d %p %08x\n", sv, row, rec, mask );
124 
125  if ( !sv->table )
126  return ERROR_FUNCTION_FAILED;
127 
128  /* test if any of the mask bits are invalid */
129  if ( mask >= (1<<sv->num_cols) )
131 
132  /* find the number of columns in the table below */
133  r = sv->table->ops->get_dimensions( sv->table, NULL, &col_count );
134  if( r )
135  return r;
136 
137  /* expand the record to the right size for the underlying table */
138  expanded = MSI_CreateRecord( col_count );
139  if ( !expanded )
140  return ERROR_FUNCTION_FAILED;
141 
142  /* move the right fields across */
143  for ( i=0; i<sv->num_cols; i++ )
144  {
145  r = MSI_RecordCopyField( rec, i+1, expanded, sv->cols[ i ] );
146  if (r != ERROR_SUCCESS)
147  break;
148  expanded_mask |= (1<<(sv->cols[i]-1));
149  }
150 
151  /* set the row in the underlying table */
152  if (r == ERROR_SUCCESS)
153  r = sv->table->ops->set_row( sv->table, row, expanded, expanded_mask );
154 
155  msiobj_release( &expanded->hdr );
156  return r;
157 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
UINT MSI_RecordCopyField(MSIRECORD *, UINT, MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:166
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:306
MSIOBJECTHDR hdr
Definition: msipriv.h:151
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLint GLuint mask
Definition: glext.h:6028
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT cols[1]
Definition: select.c:48
UINT num_cols
Definition: select.c:46
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:355
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:76
MSIVIEW * table
Definition: select.c:45
UINT(* set_row)(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
Definition: msipriv.h:278
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
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
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

◆ translate_record()

static UINT translate_record ( MSISELECTVIEW sv,
MSIRECORD in,
MSIRECORD **  out 
)
static

Definition at line 51 of file select.c.

52 {
53  UINT r, col_count, i;
55 
56  if ((r = sv->table->ops->get_dimensions( sv->table, NULL, &col_count )))
57  return r;
58 
59  if (!(object = MSI_CreateRecord( col_count )))
60  return ERROR_OUTOFMEMORY;
61 
62  for (i = 0; i < sv->num_cols; i++)
63  {
64  if ((r = MSI_RecordCopyField( in, i + 1, object, sv->cols[i] )))
65  {
66  msiobj_release( &object->hdr );
67  return r;
68  }
69  }
70 
71  *out = object;
72  return ERROR_SUCCESS;
73 }
UINT MSI_RecordCopyField(MSIRECORD *, UINT, MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:166
#define ERROR_SUCCESS
Definition: deptool.c:10
coclass MSXML2::XSLTemplate40 object
UINT(* get_dimensions)(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: msipriv.h:306
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT cols[1]
Definition: select.c:48
UINT num_cols
Definition: select.c:46
const MSIVIEWOPS * ops
Definition: msipriv.h:355
static FILE * out
Definition: regtests2xml.c:44
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:76
MSIVIEW * table
Definition: select.c:45
GLuint in
Definition: glext.h:9616
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
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by SELECT_insert_row(), and SELECT_modify().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msidb  )

Variable Documentation

◆ select_ops

const MSIVIEWOPS select_ops
static
Initial value:
=
{
}
static UINT SELECT_fetch_stream(struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
Definition: select.c:96
static UINT SELECT_insert_row(struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary)
Definition: select.c:159
static UINT SELECT_modify(struct tagMSIVIEW *view, MSIMODIFY mode, MSIRECORD *rec, UINT row)
Definition: select.c:295
static UINT SELECT_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: select.c:223
static UINT SELECT_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: select.c:184
static UINT SELECT_delete(struct tagMSIVIEW *view)
Definition: select.c:337
static UINT SELECT_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
Definition: select.c:117
#define NULL
Definition: types.h:112
static UINT SELECT_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: select.c:75
static UINT SELECT_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: select.c:208
static UINT SELECT_close(struct tagMSIVIEW *view)
Definition: select.c:196

Definition at line 352 of file select.c.

Referenced by SELECT_AddColumn(), and SELECT_CreateView().