ReactOS 0.4.15-dev-8235-gcd88a97
create.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 create.c:

Go to the source code of this file.

Classes

struct  tagMSICREATEVIEW
 

Typedefs

typedef struct tagMSICREATEVIEW MSICREATEVIEW
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msidb)
 
static UINT CREATE_fetch_int (struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
 
static UINT CREATE_execute (struct tagMSIVIEW *view, MSIRECORD *record)
 
static UINT CREATE_close (struct tagMSIVIEW *view)
 
static UINT CREATE_get_dimensions (struct tagMSIVIEW *view, UINT *rows, UINT *cols)
 
static UINT CREATE_get_column_info (struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
 
static UINT CREATE_modify (struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
 
static UINT CREATE_delete (struct tagMSIVIEW *view)
 
static UINT check_columns (const column_info *col_info)
 
UINT CREATE_CreateView (MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, column_info *col_info, BOOL hold)
 

Variables

static const MSIVIEWOPS create_ops
 

Typedef Documentation

◆ MSICREATEVIEW

Function Documentation

◆ check_columns()

static UINT check_columns ( const column_info col_info)
static

Definition at line 147 of file create.c.

148{
149 const column_info *c1, *c2;
150
151 /* check for two columns with the same name */
152 for( c1 = col_info; c1; c1 = c1->next )
153 for( c2 = c1->next; c2; c2 = c2->next )
154 if (!wcscmp( c1->column, c2->column ))
156
157 return ERROR_SUCCESS;
158}
#define ERROR_SUCCESS
Definition: deptool.c:10
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
struct _column_info * next
Definition: msipriv.h:226
LPCWSTR column
Definition: msipriv.h:223
#define ERROR_BAD_QUERY_SYNTAX
Definition: winerror.h:973

Referenced by CREATE_CreateView().

◆ CREATE_close()

static UINT CREATE_close ( struct tagMSIVIEW view)
static

Definition at line 74 of file create.c.

75{
77
78 TRACE("%p\n", cv);
79
80 return ERROR_SUCCESS;
81}
#define TRACE(s)
Definition: solgame.cpp:4

◆ CREATE_CreateView()

UINT CREATE_CreateView ( MSIDATABASE db,
MSIVIEW **  view,
LPCWSTR  table,
column_info col_info,
BOOL  hold 
)

Definition at line 160 of file create.c.

162{
163 MSICREATEVIEW *cv = NULL;
164 UINT r;
165 column_info *col;
166 BOOL temp = TRUE;
167 BOOL tempprim = FALSE;
168
169 TRACE("%p\n", cv );
170
171 r = check_columns( col_info );
172 if( r != ERROR_SUCCESS )
173 return r;
174
175 cv = msi_alloc_zero( sizeof *cv );
176 if( !cv )
178
179 for( col = col_info; col; col = col->next )
180 {
181 if (!col->table)
182 col->table = table;
183
184 if( !(col->type & MSITYPE_TEMPORARY) )
185 temp = FALSE;
186 else if ( col->type & MSITYPE_KEY )
187 tempprim = TRUE;
188 }
189
190 if ( !temp && tempprim )
191 {
192 msi_free( cv );
194 }
195
196 /* fill the structure */
197 cv->view.ops = &create_ops;
198 msiobj_addref( &db->hdr );
199 cv->db = db;
200 cv->name = table;
201 cv->col_info = col_info;
202 cv->bIsTemp = temp;
203 cv->hold = hold;
204 *view = (MSIVIEW*) cv;
205
206 return ERROR_SUCCESS;
207}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static UINT check_columns(const column_info *col_info)
Definition: create.c:147
static const MSIVIEWOPS create_ops
Definition: create.c:124
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:217
unsigned int BOOL
Definition: ntddk_ex.h:94
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
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
#define MSITYPE_TEMPORARY
Definition: msipriv.h:53
#define MSITYPE_KEY
Definition: msipriv.h:52
unsigned int UINT
Definition: ndis.h:50
static calc_node_t temp
Definition: rpn_ieee.c:38
LPCWSTR table
Definition: msipriv.h:222
LPCWSTR name
Definition: create.c:45
MSIDATABASE * db
Definition: create.c:44
column_info * col_info
Definition: create.c:48
BOOL bIsTemp
Definition: create.c:46
MSIVIEW view
Definition: create.c:43
MSIOBJECTHDR hdr
Definition: msipriv.h:108
const MSIVIEWOPS * ops
Definition: msipriv.h:355
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985

◆ CREATE_delete()

static UINT CREATE_delete ( struct tagMSIVIEW view)
static

Definition at line 112 of file create.c.

113{
115
116 TRACE("%p\n", cv );
117
118 msiobj_release( &cv->db->hdr );
119 msi_free( cv );
120
121 return ERROR_SUCCESS;
122}
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241

◆ CREATE_execute()

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

Definition at line 60 of file create.c.

61{
64
65 TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name),
66 cv->bIsTemp?"temporary":"permanent");
67
68 if (cv->bIsTemp && !cv->hold)
69 return ERROR_SUCCESS;
70
71 return msi_create_table( cv->db, cv->name, cv->col_info, persist, cv->hold );
72}
#define debugstr_w
Definition: kernel32.h:32
@ MSICONDITION_FALSE
Definition: msiquery.h:26
@ MSICONDITION_TRUE
Definition: msiquery.h:27
UINT msi_create_table(MSIDATABASE *db, LPCWSTR name, column_info *col_info, MSICONDITION persistent, BOOL hold) DECLSPEC_HIDDEN
Definition: table.c:705

◆ CREATE_fetch_int()

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

Definition at line 51 of file create.c.

52{
54
55 TRACE("%p %d %d %p\n", cv, row, col, val );
56
58}
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
GLuint GLfloat * val
Definition: glext.h:7180

◆ CREATE_get_column_info()

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

Definition at line 92 of file create.c.

94{
96
97 TRACE("%p %d %p %p %p %p\n", cv, n, name, type, temporary, table_name );
98
100}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
Definition: name.c:39

◆ CREATE_get_dimensions()

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

Definition at line 83 of file create.c.

84{
86
87 TRACE("%p %p %p\n", cv, rows, cols );
88
90}

◆ CREATE_modify()

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

Definition at line 102 of file create.c.

104{
106
107 TRACE("%p %d %p\n", cv, eModifyMode, rec );
108
110}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msidb  )

Variable Documentation

◆ create_ops

const MSIVIEWOPS create_ops
static
Initial value:
=
{
}
static UINT CREATE_delete(struct tagMSIVIEW *view)
Definition: create.c:112
static UINT CREATE_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: create.c:83
static UINT CREATE_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: create.c:60
static UINT CREATE_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: create.c:51
static UINT CREATE_close(struct tagMSIVIEW *view)
Definition: create.c:74
static UINT CREATE_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: create.c:92
static UINT CREATE_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
Definition: create.c:102

Definition at line 124 of file create.c.

Referenced by CREATE_CreateView().