-
Notifications
You must be signed in to change notification settings - Fork 0
/
cursor_window.h
337 lines (290 loc) · 9.13 KB
/
cursor_window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#ifndef _DB_CURSOR_WINDOW_H_
#define _DB_CURSOR_WINDOW_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "common.h"
typedef struct _CursorWindow CursorWindow;
#define FIELD_TYPE_NULL 0 /**init value when create cursor window */
#define FIELD_TYPE_INTEGER 1
#define FIELD_TYPE_BOOL 2
#define FIELD_TYPE_FLOAT 3
#define FIELD_TYPE_STRING 4
#define FIELD_TYPE_STRING_16 5
#define FIELD_TYPE_BLOB 6
//#define FIELD_TYPE_NULL 7
/**
* @brief create a cursor window
* @param[in] col_num colume number
* @return CursorWindow instance
*/
extern CursorWindow* cursor_window_create(INT32 col_num);
/**
* @brief duplicate a cursor window
* @param[in] src source CursorWindow
* @return CursorWindow instance
*/
extern CursorWindow* cursor_window_duplicate(CursorWindow* src);
/**
* @brief destroy cursor window
* @param[in] thiz CursorWindow instance
*/
extern void cursor_window_destroy(CursorWindow* thiz);
/**
* @brief get row numbner
* @param[in] thiz CursorWindow instance
* @return row nunber
*/
extern INT32 cursor_window_get_row_num(CursorWindow* thiz);
/**
* @brief get colume numbner
* @param[in] thiz CursorWindow instance
* @return colume nunber
*/
extern INT32 cursor_window_get_col_num(CursorWindow* thiz);
/**
* @brief alloc new row
* @return error code
*/
extern BOOL cursor_window_alloc_row(CursorWindow* thiz);
/**
* @brief get int64 value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[int] value int value
* @return error code
*/
extern BOOL cursor_window_put_int(CursorWindow* thiz,INT32 row,INT64 value);
/**
* @brief get bool value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[int] value bool value
* @return error code
*/
extern BOOL cursor_window_put_bool(CursorWindow* thiz,INT32 col,BOOL value);
/**
* @brief get double value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[int] value double value
* @return error code
*/
extern BOOL cursor_window_put_double(CursorWindow* thiz,INT32 row,double value);
/**
* @brief get null value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @return error code
*/
extern BOOL cursor_window_put_null(CursorWindow* thiz,INT32 col);
/**
* @brief get string value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[int] value string value
* @return error code
*/
extern BOOL cursor_window_put_string(CursorWindow* thiz,INT32 row,const CHAR* value);
/**
* @brief get wstring value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[int] value wstring value
* @return error code
*/
extern BOOL cursor_window_put_string_16(CursorWindow* thiz,INT32 row,const WCHAR* value);
/**
* @brief get blob value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[int] value blob value
* @return error code
*/
extern BOOL cursor_window_put_blob(CursorWindow* thiz,INT32 row,const void* value,INT32 len);
/**
* @brief update int value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[int] value int value
* @return error code
*/
extern BOOL cursor_window_update_int(CursorWindow* thiz,INT32 row,INT32 col,INT64 value);
/**
* @brief update bool value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[int] value bool value
* @return error code
*/
extern BOOL cursor_window_update_bool(CursorWindow* thiz,INT32 row,INT32 col,BOOL value);
/**
* @brief update double value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[int] value double value
* @return error code
*/
extern BOOL cursor_window_update_double(CursorWindow* thiz,INT32 row,INT32 col,double value);
/**
* @brief update string value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[int] value string value
* @return error code
*/
extern BOOL cursor_window_update_string(CursorWindow* thiz,INT32 row,INT32 col,const CHAR* value);
/**
* @brief update wstring value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[int] value wstring value
* @return error code
*/
extern BOOL cursor_window_update_string_16(CursorWindow* thiz,INT32 row,INT32 col,const WCHAR* value);
/**
* @brief update blob value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[int] value blob value
* @param[int] len blob value length
* @return error code
*/
extern BOOL cursor_window_update_blob(CursorWindow* thiz,INT32 row,INT32 col,const void* value,INT32 len);
/**
* @brief get int value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] value save int value
* @return error code
*/
extern BOOL cursor_window_get_int(CursorWindow* thiz,INT32 row,INT32 col,INT64* value);
/**
* @brief get bool value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] value save bool value
* @return error code
*/
extern BOOL cursor_window_get_bool(CursorWindow* thiz,INT32 row,INT32 col,BOOL* value);
/**
* @brief get double value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] value save double value
* @return error code
*/
extern BOOL cursor_window_get_double(CursorWindow* thiz,INT32 row,INT32 col,double* value);
/**
* @brief get string value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] value save string value
* @return error code
*/
extern const CHAR* cursor_window_get_string(CursorWindow* thiz,INT32 row,INT32 col);
/**
* @brief get string value, if the source data is wstring, this funtion will convert the wstring into string
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @return string value
*/
extern const CHAR* cursor_window_get_string_coerce(CursorWindow* thiz,INT32 row,INT32 col);
/**
* @brief get wstring value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @return wstring value
*/
extern const WCHAR* cursor_window_get_string_16(CursorWindow* thiz,INT32 row,INT32 col);
/**
* @brief get wstring value, if the source data is string, this funtion will convert the string into wstring
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @return wstring value
*/
extern const WCHAR* cursor_window_get_string_16_coerce(CursorWindow* thiz,INT32 row,INT32 col);
/**
* @brief get blob value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] len save the blob data length
* @return blob value
*/
extern const void* cursor_window_get_blob(CursorWindow* thiz,INT32 row,INT32 col,INT32* len);
/**
* @brief get value
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] type save the value type
* @param[out] data save the value address
* @param[out] len save the blob data length
* @return error code
*/
extern BOOL cursor_window_get_value(CursorWindow* thiz,INT32 row,INT32 col,UINT8* type,void** data,INT32* len);
/**
* @brief get type
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @param[in] col colume index
* @param[out] type save the value type
* @return error code
*/
extern BOOL cursor_window_get_type(CursorWindow* thiz,INT32 row,INT32 col,UINT8* type);
/**
* @brief delete row
*
* @param[in] thiz CursorWindow instance
* @param[in] row row index
* @return error code
*/
extern BOOL cursor_window_delete_row(CursorWindow* thiz,INT32 row);
/**
* @brief delete last row
*
* @param[in] thiz CursorWindow instance
* @return error code
*/
extern BOOL cursor_window_delete_last_row(CursorWindow* thiz);
#ifdef __cplusplus
}
#endif
#endif