query.h 4.58 KB
Newer Older
1 2 3
/*
 * Implementation of the Microsoft Installer (msi.dll)
 *
4
 * Copyright 2002 Mike McCormack for CodeWeavers
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 22 23
 */

#ifndef __WINE_MSI_QUERY_H
#define __WINE_MSI_QUERY_H

24 25 26
#include <stdarg.h>

#include "windef.h"
27
#include "winbase.h"
28
#include "objbase.h"
29 30 31 32
#include "objidl.h"
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
33
#include "wine/list.h"
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52


#define OP_EQ       1
#define OP_AND      2
#define OP_OR       3
#define OP_GT       4
#define OP_LT       5
#define OP_LE       6
#define OP_GE       7
#define OP_NE       8
#define OP_ISNULL   9
#define OP_NOTNULL  10

#define EXPR_COMPLEX  1
#define EXPR_COLUMN   2
#define EXPR_COL_NUMBER 3
#define EXPR_IVAL     4
#define EXPR_SVAL     5
#define EXPR_UVAL     6
53
#define EXPR_STRCMP   7
54
#define EXPR_WILDCARD 9
55
#define EXPR_COL_NUMBER_STRING 10
56
#define EXPR_COL_NUMBER32 11
57
#define EXPR_UNARY    12
58 59 60 61 62

struct sql_str {
    LPCWSTR data;
    INT len;
};
63 64 65 66 67 68 69 70

struct complex_expr
{
    UINT op;
    struct expr *left;
    struct expr *right;
};

71 72
struct tagJOINTABLE;
union ext_column
73
{
74 75 76 77 78 79 80 81 82 83
    struct
    {
        LPCWSTR column;
        LPCWSTR table;
    } unparsed;
    struct
    {
        UINT column;
        struct tagJOINTABLE *table;
    } parsed;
84 85
};

86 87 88 89 90 91 92 93
struct expr
{
    int type;
    union
    {
        struct complex_expr expr;
        INT   ival;
        UINT  uval;
94
        LPCWSTR sval;
95
        union ext_column column;
96 97 98
    } u;
};

99 100 101 102 103 104 105 106 107 108 109 110 111
typedef struct
{
    MSIDATABASE *db;
    LPCWSTR command;
    DWORD n, len;
    UINT r;
    MSIVIEW **view;  /* View structure for the resulting query.  This value
                      * tracks the view currently being created so we can free
                      * this view on syntax error.
                      */
    struct list *mem;
} SQL_input;

112
UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,
113
                   struct list *mem ) DECLSPEC_HIDDEN;
114

115
UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) DECLSPEC_HIDDEN;
116

117
UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
118
                        const column_info *columns ) DECLSPEC_HIDDEN;
119

120
UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN;
121

122
UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
123
                       column_info *columns ) DECLSPEC_HIDDEN;
124

125
UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
126
                       struct expr *cond ) DECLSPEC_HIDDEN;
127

128
UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
129
                        column_info *col_info, BOOL hold ) DECLSPEC_HIDDEN;
130

131
UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
132
                        column_info *columns, column_info *values, BOOL temp ) DECLSPEC_HIDDEN;
133

134
UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
135
                        column_info *list, struct expr *expr ) DECLSPEC_HIDDEN;
136

137
UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN;
138

139
UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold ) DECLSPEC_HIDDEN;
140

141
UINT STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view ) DECLSPEC_HIDDEN;
142

143
UINT STORAGES_CreateView( MSIDATABASE *db, MSIVIEW **view ) DECLSPEC_HIDDEN;
144

145
UINT DROP_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name ) DECLSPEC_HIDDEN;
146

147
int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip) DECLSPEC_HIDDEN;
148

149
MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ) DECLSPEC_HIDDEN;
150

151
UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
152
                       MSICONDITION persistent ) DECLSPEC_HIDDEN;
153

154 155
UINT msi_select_update( MSIVIEW *view, MSIRECORD *rec, UINT row ) DECLSPEC_HIDDEN;

156 157
UINT msi_view_refresh_row( MSIDATABASE *db, MSIVIEW *view, UINT row, MSIRECORD *rec ) DECLSPEC_HIDDEN;

158
#endif /* __WINE_MSI_QUERY_H */