msi: Add the column type INTEGER as an alias for INT.
[wine] / dlls / msi / alter.c
1 /*
2  * Implementation of the Microsoft Installer (msi.dll)
3  *
4  * Copyright 2006 Mike McCormack
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 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "wine/debug.h"
27 #include "msi.h"
28 #include "msiquery.h"
29 #include "objbase.h"
30 #include "objidl.h"
31 #include "msipriv.h"
32
33 #include "query.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(msidb);
36
37 typedef struct tagMSIALTERVIEW
38 {
39     MSIVIEW        view;
40     MSIDATABASE   *db;
41 } MSIALTERVIEW;
42
43 static UINT ALTER_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val )
44 {
45     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
46
47     TRACE("%p %d %d %p\n", av, row, col, val );
48
49     return ERROR_FUNCTION_FAILED;
50 }
51
52 static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
53 {
54     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
55
56     TRACE("%p %d %d %p\n", av, row, col, stm );
57
58     return ERROR_FUNCTION_FAILED;
59 }
60
61 static UINT ALTER_set_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT val )
62 {
63     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
64
65     TRACE("%p %d %d %04x\n", av, row, col, val );
66
67     return ERROR_FUNCTION_FAILED;
68 }
69
70 static UINT ALTER_insert_row( struct tagMSIVIEW *view, MSIRECORD *record )
71 {
72     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
73
74     TRACE("%p %p\n", av, record );
75
76     return ERROR_FUNCTION_FAILED;
77 }
78
79 static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record )
80 {
81     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
82
83     FIXME("%p %p\n", av, record);
84
85     return ERROR_SUCCESS;
86 }
87
88 static UINT ALTER_close( struct tagMSIVIEW *view )
89 {
90     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
91
92     TRACE("%p\n", av );
93
94     return ERROR_SUCCESS;
95 }
96
97 static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols )
98 {
99     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
100
101     TRACE("%p %p %p\n", av, rows, cols );
102
103     return ERROR_FUNCTION_FAILED;
104 }
105
106 static UINT ALTER_get_column_info( struct tagMSIVIEW *view,
107                 UINT n, LPWSTR *name, UINT *type )
108 {
109     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
110
111     TRACE("%p %d %p %p\n", av, n, name, type );
112
113     return ERROR_FUNCTION_FAILED;
114 }
115
116 static UINT ALTER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
117                 MSIRECORD *rec )
118 {
119     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
120
121     TRACE("%p %d %p\n", av, eModifyMode, rec );
122
123     return ERROR_FUNCTION_FAILED;
124 }
125
126 static UINT ALTER_delete( struct tagMSIVIEW *view )
127 {
128     MSIALTERVIEW *av = (MSIALTERVIEW*)view;
129
130     TRACE("%p\n", av );
131     msi_free( av );
132
133     return ERROR_SUCCESS;
134 }
135
136 static UINT ALTER_find_matching_rows( struct tagMSIVIEW *view, UINT col,
137     UINT val, UINT *row, MSIITERHANDLE *handle )
138 {
139     TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
140
141     return ERROR_FUNCTION_FAILED;
142 }
143
144
145 static const MSIVIEWOPS alter_ops =
146 {
147     ALTER_fetch_int,
148     ALTER_fetch_stream,
149     ALTER_set_int,
150     ALTER_insert_row,
151     ALTER_execute,
152     ALTER_close,
153     ALTER_get_dimensions,
154     ALTER_get_column_info,
155     ALTER_modify,
156     ALTER_delete,
157     ALTER_find_matching_rows
158 };
159
160 UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, int hold )
161 {
162     MSIALTERVIEW *av = NULL;
163
164     TRACE("%p\n", av );
165
166     av = msi_alloc_zero( sizeof *av );
167     if( !av )
168         return ERROR_FUNCTION_FAILED;
169
170     /* fill the structure */
171     av->view.ops = &alter_ops;
172     av->db = db;
173
174     *view = &av->view;
175
176     return ERROR_SUCCESS;
177 }