ReactOS  0.4.14-dev-552-g2fad488
create.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 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 148 of file create.c.

149 {
150  const column_info *c1, *c2;
151 
152  /* check for two columns with the same name */
153  for( c1 = col_info; c1; c1 = c1->next )
154  for( c2 = c1->next; c2; c2 = c2->next )
155  if (!strcmpW( c1->column, c2->column ))
156  return ERROR_BAD_QUERY_SYNTAX;
157 
158  return ERROR_SUCCESS;
159 }
#define ERROR_SUCCESS
Definition: deptool.c:10
struct _column_info * next
Definition: msipriv.h:216
LPCWSTR column
Definition: msipriv.h:212
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
#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 75 of file create.c.

76 {
78 
79  TRACE("%p\n", cv);
80 
81  return ERROR_SUCCESS;
82 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#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 161 of file create.c.

163 {
164  MSICREATEVIEW *cv = NULL;
165  UINT r;
166  column_info *col;
167  BOOL temp = TRUE;
168  BOOL tempprim = FALSE;
169 
170  TRACE("%p\n", cv );
171 
172  r = check_columns( col_info );
173  if( r != ERROR_SUCCESS )
174  return r;
175 
176  cv = msi_alloc_zero( sizeof *cv );
177  if( !cv )
178  return ERROR_FUNCTION_FAILED;
179 
180  for( col = col_info; col; col = col->next )
181  {
182  if (!col->table)
183  col->table = table;
184 
185  if( !col->temporary )
186  temp = FALSE;
187  else if ( col->type & MSITYPE_KEY )
188  tempprim = TRUE;
189  }
190 
191  if ( !temp && tempprim )
192  {
193  msi_free( cv );
194  return ERROR_FUNCTION_FAILED;
195  }
196 
197  /* fill the structure */
198  cv->view.ops = &create_ops;
199  msiobj_addref( &db->hdr );
200  cv->db = db;
201  cv->name = table;
202  cv->col_info = col_info;
203  cv->bIsTemp = temp;
204  cv->hold = hold;
205  *view = (MSIVIEW*) cv;
206 
207  return ERROR_SUCCESS;
208 }
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:218
static const MSIVIEWOPS create_ops
Definition: create.c:125
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
struct _column_info * next
Definition: msipriv.h:216
MSIVIEW view
Definition: create.c:44
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
BOOL bIsTemp
Definition: create.c:47
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
LPCWSTR name
Definition: create.c:46
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
#define MSITYPE_KEY
Definition: msipriv.h:49
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
BOOL temporary
Definition: msipriv.h:214
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
LPCWSTR table
Definition: msipriv.h:211
MSIDATABASE * db
Definition: create.c:45
static UINT check_columns(const column_info *col_info)
Definition: create.c:148
column_info * col_info
Definition: create.c:49
MSIOBJECTHDR hdr
Definition: msipriv.h:97

Referenced by yyparse().

◆ CREATE_delete()

static UINT CREATE_delete ( struct tagMSIVIEW view)
static

Definition at line 113 of file create.c.

114 {
116 
117  TRACE("%p\n", cv );
118 
119  msiobj_release( &cv->db->hdr );
120  msi_free( cv );
121 
122  return ERROR_SUCCESS;
123 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRACE(s)
Definition: solgame.cpp:4
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
MSIDATABASE * db
Definition: create.c:45
MSIOBJECTHDR hdr
Definition: msipriv.h:97

◆ CREATE_execute()

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

Definition at line 61 of file create.c.

62 {
65 
66  TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name),
67  cv->bIsTemp?"temporary":"permanent");
68 
69  if (cv->bIsTemp && !cv->hold)
70  return ERROR_SUCCESS;
71 
72  return msi_create_table( cv->db, cv->name, cv->col_info, persist );
73 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL bIsTemp
Definition: create.c:47
LPCWSTR name
Definition: create.c:46
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
UINT msi_create_table(MSIDATABASE *db, LPCWSTR name, column_info *col_info, MSICONDITION persistent) DECLSPEC_HIDDEN
Definition: table.c:716
#define TRACE(s)
Definition: solgame.cpp:4
MSIDATABASE * db
Definition: create.c:45
column_info * col_info
Definition: create.c:49

◆ CREATE_fetch_int()

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

Definition at line 52 of file create.c.

53 {
55 
56  TRACE("%p %d %d %p\n", cv, 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

◆ 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 93 of file create.c.

95 {
97 
98  TRACE("%p %d %p %p %p %p\n", cv, n, name, type, temporary, table_name );
99 
100  return ERROR_FUNCTION_FAILED;
101 }
GLdouble n
Definition: glext.h:7729
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:38

◆ CREATE_get_dimensions()

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

Definition at line 84 of file create.c.

85 {
87 
88  TRACE("%p %p %p\n", cv, rows, cols );
89 
90  return ERROR_FUNCTION_FAILED;
91 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4

◆ CREATE_modify()

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

Definition at line 103 of file create.c.

105 {
107 
108  TRACE("%p %d %p\n", cv, eModifyMode, rec );
109 
110  return ERROR_FUNCTION_FAILED;
111 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4

◆ 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:113
static UINT CREATE_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: create.c:93
smooth NULL
Definition: ftsmooth.c:416
static UINT CREATE_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: create.c:52
static UINT CREATE_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
Definition: create.c:103
static UINT CREATE_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: create.c:61
static UINT CREATE_close(struct tagMSIVIEW *view)
Definition: create.c:75
static UINT CREATE_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: create.c:84

Definition at line 125 of file create.c.

Referenced by CREATE_CreateView().