diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/eseutil.h')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/eseutil.h | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/eseutil.h b/src/libs/dutil/WixToolset.DUtil/inc/eseutil.h new file mode 100644 index 00000000..bea47b2b --- /dev/null +++ b/src/libs/dutil/WixToolset.DUtil/inc/eseutil.h | |||
@@ -0,0 +1,223 @@ | |||
1 | #pragma once | ||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | #define ReleaseEseQuery(pqh) if (pqh) { EseFinishQuery(pqh); } | ||
10 | #define ReleaseNullEseQuery(pqh) if (pqh) { EseFinishQuery(pqh); pqh = NULL; } | ||
11 | |||
12 | struct ESE_COLUMN_SCHEMA | ||
13 | { | ||
14 | JET_COLUMNID jcColumn; | ||
15 | LPCWSTR pszName; | ||
16 | JET_COLTYP jcColumnType; | ||
17 | BOOL fKey; // If this column is part of the key of the table | ||
18 | BOOL fFixed; | ||
19 | BOOL fNullable; | ||
20 | BOOL fAutoIncrement; | ||
21 | }; | ||
22 | |||
23 | struct ESE_TABLE_SCHEMA | ||
24 | { | ||
25 | JET_TABLEID jtTable; | ||
26 | LPCWSTR pszName; | ||
27 | DWORD dwColumns; | ||
28 | ESE_COLUMN_SCHEMA *pcsColumns; | ||
29 | }; | ||
30 | |||
31 | struct ESE_DATABASE_SCHEMA | ||
32 | { | ||
33 | DWORD dwTables; | ||
34 | ESE_TABLE_SCHEMA *ptsTables; | ||
35 | }; | ||
36 | |||
37 | typedef enum ESE_QUERY_TYPE | ||
38 | { | ||
39 | ESE_QUERY_EXACT, | ||
40 | ESE_QUERY_FROM_TOP, | ||
41 | ESE_QUERY_FROM_BOTTOM | ||
42 | } ESE_QUERY_TYPE; | ||
43 | |||
44 | typedef void* ESE_QUERY_HANDLE; | ||
45 | |||
46 | HRESULT DAPI EseBeginSession( | ||
47 | __out JET_INSTANCE *pjiInstance, | ||
48 | __out JET_SESID *pjsSession, | ||
49 | __in_z LPCWSTR pszInstance, | ||
50 | __in_z LPCWSTR pszPath | ||
51 | ); | ||
52 | HRESULT DAPI EseEndSession( | ||
53 | __in JET_INSTANCE jiInstance, | ||
54 | __in JET_SESID jsSession | ||
55 | ); | ||
56 | HRESULT DAPI EseEnsureDatabase( | ||
57 | __in JET_SESID jsSession, | ||
58 | __in_z LPCWSTR pszFile, | ||
59 | __in ESE_DATABASE_SCHEMA *pdsSchema, | ||
60 | __out JET_DBID* pjdbDb, | ||
61 | __in BOOL fExclusive, | ||
62 | __in BOOL fReadonly | ||
63 | ); | ||
64 | HRESULT DAPI EseCloseDatabase( | ||
65 | __in JET_SESID jsSession, | ||
66 | __in JET_DBID jdbDb | ||
67 | ); | ||
68 | HRESULT DAPI EseCreateTable( | ||
69 | __in JET_SESID jsSession, | ||
70 | __in JET_DBID jdbDb, | ||
71 | __in_z LPCWSTR pszTable, | ||
72 | __out JET_TABLEID *pjtTable | ||
73 | ); | ||
74 | HRESULT DAPI EseOpenTable( | ||
75 | __in JET_SESID jsSession, | ||
76 | __in JET_DBID jdbDb, | ||
77 | __in_z LPCWSTR pszTable, | ||
78 | __out JET_TABLEID *pjtTable | ||
79 | ); | ||
80 | HRESULT DAPI EseCloseTable( | ||
81 | __in JET_SESID jsSession, | ||
82 | __in JET_TABLEID jtTable | ||
83 | ); | ||
84 | HRESULT DAPI EseEnsureColumn( | ||
85 | __in JET_SESID jsSession, | ||
86 | __in JET_TABLEID jtTable, | ||
87 | __in_z LPCWSTR pszColumnName, | ||
88 | __in JET_COLTYP jcColumnType, | ||
89 | __in ULONG ulColumnSize, | ||
90 | __in BOOL fFixed, | ||
91 | __in BOOL fNullable, | ||
92 | __out_opt JET_COLUMNID *pjcColumn | ||
93 | ); | ||
94 | HRESULT DAPI EseGetColumn( | ||
95 | __in JET_SESID jsSession, | ||
96 | __in JET_TABLEID jtTable, | ||
97 | __in_z LPCWSTR pszColumnName, | ||
98 | __out JET_COLUMNID *pjcColumn | ||
99 | ); | ||
100 | HRESULT DAPI EseMoveCursor( | ||
101 | __in JET_SESID jsSession, | ||
102 | __in JET_TABLEID jtTable, | ||
103 | __in LONG lRow | ||
104 | ); | ||
105 | HRESULT DAPI EseDeleteRow( | ||
106 | __in JET_SESID jsSession, | ||
107 | __in JET_TABLEID jtTable | ||
108 | ); | ||
109 | HRESULT DAPI EseBeginTransaction( | ||
110 | __in JET_SESID jsSession | ||
111 | ); | ||
112 | HRESULT DAPI EseRollbackTransaction( | ||
113 | __in JET_SESID jsSession, | ||
114 | __in BOOL fAll | ||
115 | ); | ||
116 | HRESULT DAPI EseCommitTransaction( | ||
117 | __in JET_SESID jsSession | ||
118 | ); | ||
119 | HRESULT DAPI EsePrepareUpdate( | ||
120 | __in JET_SESID jsSession, | ||
121 | __in JET_TABLEID jtTable, | ||
122 | __in ULONG ulPrep | ||
123 | ); | ||
124 | HRESULT DAPI EseFinishUpdate( | ||
125 | __in JET_SESID jsSession, | ||
126 | __in JET_TABLEID jtTable, | ||
127 | __in BOOL fSeekToInsertedRecord | ||
128 | ); | ||
129 | HRESULT DAPI EseSetColumnBinary( | ||
130 | __in JET_SESID jsSession, | ||
131 | __in ESE_TABLE_SCHEMA tsTable, | ||
132 | __in DWORD dwColumn, | ||
133 | __in_bcount(cbBuffer) const BYTE* pbBuffer, | ||
134 | __in SIZE_T cbBuffer | ||
135 | ); | ||
136 | HRESULT DAPI EseSetColumnDword( | ||
137 | __in JET_SESID jsSession, | ||
138 | __in ESE_TABLE_SCHEMA tsTable, | ||
139 | __in DWORD dwColumn, | ||
140 | __in DWORD dwValue | ||
141 | ); | ||
142 | HRESULT DAPI EseSetColumnBool( | ||
143 | __in JET_SESID jsSession, | ||
144 | __in ESE_TABLE_SCHEMA tsTable, | ||
145 | __in DWORD dwColumn, | ||
146 | __in BOOL fValue | ||
147 | ); | ||
148 | HRESULT DAPI EseSetColumnString( | ||
149 | __in JET_SESID jsSession, | ||
150 | __in ESE_TABLE_SCHEMA tsTable, | ||
151 | __in DWORD dwColumn, | ||
152 | __in_z LPCWSTR pszValue | ||
153 | ); | ||
154 | HRESULT DAPI EseSetColumnEmpty( | ||
155 | __in JET_SESID jsSession, | ||
156 | __in ESE_TABLE_SCHEMA tsTable, | ||
157 | __in DWORD dwColumn | ||
158 | ); | ||
159 | HRESULT DAPI EseGetColumnBinary( | ||
160 | __in JET_SESID jsSession, | ||
161 | __in ESE_TABLE_SCHEMA tsTable, | ||
162 | __in DWORD dwColumn, | ||
163 | __deref_inout_bcount(*piBuffer) BYTE** ppbBuffer, | ||
164 | __inout SIZE_T* piBuffer | ||
165 | ); | ||
166 | HRESULT DAPI EseGetColumnDword( | ||
167 | __in JET_SESID jsSession, | ||
168 | __in ESE_TABLE_SCHEMA tsTable, | ||
169 | __in DWORD dwColumn, | ||
170 | __out DWORD *pdwValue | ||
171 | ); | ||
172 | HRESULT DAPI EseGetColumnBool( | ||
173 | __in JET_SESID jsSession, | ||
174 | __in ESE_TABLE_SCHEMA tsTable, | ||
175 | __in DWORD dwColumn, | ||
176 | __out BOOL *pfValue | ||
177 | ); | ||
178 | HRESULT DAPI EseGetColumnString( | ||
179 | __in JET_SESID jsSession, | ||
180 | __in ESE_TABLE_SCHEMA tsTable, | ||
181 | __in DWORD dwColumn, | ||
182 | __out LPWSTR *ppszValue | ||
183 | ); | ||
184 | |||
185 | // Call this once for each key column in the table | ||
186 | HRESULT DAPI EseBeginQuery( | ||
187 | __in JET_SESID jsSession, | ||
188 | __in JET_TABLEID jtTable, | ||
189 | __in ESE_QUERY_TYPE qtQueryType, | ||
190 | __out ESE_QUERY_HANDLE *peqhHandle | ||
191 | ); | ||
192 | HRESULT DAPI EseSetQueryColumnBinary( | ||
193 | __in ESE_QUERY_HANDLE eqhHandle, | ||
194 | __in_bcount(cbBuffer) const BYTE* pbBuffer, | ||
195 | __in SIZE_T cbBuffer, | ||
196 | __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*" | ||
197 | ); | ||
198 | HRESULT DAPI EseSetQueryColumnDword( | ||
199 | __in ESE_QUERY_HANDLE eqhHandle, | ||
200 | __in DWORD dwData, | ||
201 | __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*" | ||
202 | ); | ||
203 | HRESULT DAPI EseSetQueryColumnBool( | ||
204 | __in ESE_QUERY_HANDLE eqhHandle, | ||
205 | __in BOOL fValue, | ||
206 | __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*" | ||
207 | ); | ||
208 | HRESULT DAPI EseSetQueryColumnString( | ||
209 | __in ESE_QUERY_HANDLE eqhHandle, | ||
210 | __in_z LPCWSTR pszString, | ||
211 | __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*" | ||
212 | ); | ||
213 | HRESULT DAPI EseFinishQuery( | ||
214 | __in ESE_QUERY_HANDLE eqhHandle | ||
215 | ); | ||
216 | // Once all columns have been set up, call this and read the result | ||
217 | HRESULT DAPI EseRunQuery( | ||
218 | __in ESE_QUERY_HANDLE eqhHandle | ||
219 | ); | ||
220 | |||
221 | #ifdef __cplusplus | ||
222 | } | ||
223 | #endif | ||