forked from bloomberg/comdb2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comdb2_sql_internal.h
80 lines (64 loc) · 1.94 KB
/
comdb2_sql_internal.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
/*
Copyright 2015 Bloomberg Finance L.P.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __COMDB2_SQL_INTERNAL_H
#define __COMDB2_SQL_INTERNAL_H
#include <sqlite3.h>
#include <list.h>
typedef struct reqhdr {
int reqtype;
int len;
} reqhdr_type;
typedef struct rsphdr {
int rcode;
int len;
} rsphdr;
typedef struct finalize_request {
int tranid;
} finalize_request_type;
typedef struct column_request {
int tranid;
int column;
} column_request_type;
/* request types */
enum {
RSQLITE3_CLOSE = 1, /* close connection */
RSQLITE3_FINALIZE = 2, /* done with statement */
RSQLITE3_PREPARE = 3, /* start new statement */
RSQLITE3_DECLTYPE = 4, /* return column type string */
RSQLITE3_TEXT = 5, /* get string value of column */
RSQLITE3_ERRMSG = 6, /* return error message string for last error */
RSQLITE3_STEP = 7, /* insert/fetch/update next record */
RSQLITE3_EXEC = 8, /* execute statment */
RSQLITE3_CHANGES = 9, /* #changed rows for exec */
};
/* field flags */
enum { SQLFIELD_NULL = 1 };
struct sqlite3_stmt {
int tranid;
struct sql_schema *schema;
sqlite3 *db;
char *debug_sql;
LINKC_T(struct sqlite3_stmt) lnk;
};
struct sqlite {
int fd;
int ncols;
char **colnames;
char **colvalues;
char *colnamebuf;
int colnamebufsize;
char *colvalbuf;
int colvalbufsize;
LISTC_T(struct sqlite3_stmt) cursors;
};
#endif