[MSI]
[reactos.git] / reactos / dll / win32 / msi / query.h
1 /*
2 * Implementation of the Microsoft Installer (msi.dll)
3 *
4 * Copyright 2002 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 #ifndef __WINE_MSI_QUERY_H
22 #define __WINE_MSI_QUERY_H
23
24 #define OP_EQ 1
25 #define OP_AND 2
26 #define OP_OR 3
27 #define OP_GT 4
28 #define OP_LT 5
29 #define OP_LE 6
30 #define OP_GE 7
31 #define OP_NE 8
32 #define OP_ISNULL 9
33 #define OP_NOTNULL 10
34
35 #define EXPR_COMPLEX 1
36 #define EXPR_COLUMN 2
37 #define EXPR_COL_NUMBER 3
38 #define EXPR_IVAL 4
39 #define EXPR_SVAL 5
40 #define EXPR_UVAL 6
41 #define EXPR_STRCMP 7
42 #define EXPR_WILDCARD 9
43 #define EXPR_COL_NUMBER_STRING 10
44 #define EXPR_COL_NUMBER32 11
45 #define EXPR_UNARY 12
46
47 struct sql_str {
48 LPCWSTR data;
49 INT len;
50 };
51
52 struct complex_expr
53 {
54 UINT op;
55 struct expr *left;
56 struct expr *right;
57 };
58
59 struct tagJOINTABLE;
60 union ext_column
61 {
62 struct
63 {
64 LPCWSTR column;
65 LPCWSTR table;
66 } unparsed;
67 struct
68 {
69 UINT column;
70 struct tagJOINTABLE *table;
71 } parsed;
72 };
73
74 struct expr
75 {
76 int type;
77 union
78 {
79 struct complex_expr expr;
80 INT ival;
81 UINT uval;
82 LPCWSTR sval;
83 union ext_column column;
84 } u;
85 };
86
87 typedef struct
88 {
89 MSIDATABASE *db;
90 LPCWSTR command;
91 DWORD n, len;
92 UINT r;
93 MSIVIEW **view; /* View structure for the resulting query. This value
94 * tracks the view currently being created so we can free
95 * this view on syntax error.
96 */
97 struct list *mem;
98 } SQL_input;
99
100 UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,
101 struct list *mem ) DECLSPEC_HIDDEN;
102
103 UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) DECLSPEC_HIDDEN;
104
105 UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
106 const column_info *columns ) DECLSPEC_HIDDEN;
107
108 UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN;
109
110 UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
111 column_info *columns ) DECLSPEC_HIDDEN;
112
113 UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
114 struct expr *cond ) DECLSPEC_HIDDEN;
115
116 UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
117 column_info *col_info, BOOL hold ) DECLSPEC_HIDDEN;
118
119 UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
120 column_info *columns, column_info *values, BOOL temp ) DECLSPEC_HIDDEN;
121
122 UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
123 column_info *list, struct expr *expr ) DECLSPEC_HIDDEN;
124
125 UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN;
126
127 UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold ) DECLSPEC_HIDDEN;
128
129 UINT STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view ) DECLSPEC_HIDDEN;
130
131 UINT STORAGES_CreateView( MSIDATABASE *db, MSIVIEW **view ) DECLSPEC_HIDDEN;
132
133 UINT DROP_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name ) DECLSPEC_HIDDEN;
134
135 int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip) DECLSPEC_HIDDEN;
136
137 MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ) DECLSPEC_HIDDEN;
138
139 UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
140 MSICONDITION persistent ) DECLSPEC_HIDDEN;
141
142 #endif /* __WINE_MSI_QUERY_H */