This source file includes following definitions.
- php_sqlite3_db_from_obj
- php_sqlite3_result_from_obj
- php_sqlite3_stmt_from_obj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef PHP_SQLITE_STRUCTS_H
22 #define PHP_SQLITE_STRUCTS_H
23
24 #include <sqlite3.h>
25
26
27 #ifndef SQLITE_OPEN_READONLY
28 #define SQLITE_OPEN_READONLY 0x00000001
29 #endif
30
31 #ifndef SQLITE_OPEN_READWRITE
32 #define SQLITE_OPEN_READWRITE 0x00000002
33 #endif
34
35 #ifndef SQLITE_OPEN_CREATE
36 #define SQLITE_OPEN_CREATE 0x00000004
37 #endif
38
39
40 struct php_sqlite3_bound_param {
41 zend_long param_number;
42 zend_string *name;
43 zend_long type;
44 zval parameter;
45 };
46
47 struct php_sqlite3_fci {
48 zend_fcall_info fci;
49 zend_fcall_info_cache fcc;
50 };
51
52
53 typedef struct _php_sqlite3_func {
54 struct _php_sqlite3_func *next;
55
56 const char *func_name;
57 int argc;
58
59 zval func, step, fini;
60 struct php_sqlite3_fci afunc, astep, afini;
61 } php_sqlite3_func;
62
63
64 typedef struct _php_sqlite3_collation {
65 struct _php_sqlite3_collation *next;
66
67 const char *collation_name;
68 zval cmp_func;
69 struct php_sqlite3_fci fci;
70 } php_sqlite3_collation;
71
72
73 typedef struct _php_sqlite3_db_object {
74 int initialised;
75 sqlite3 *db;
76 php_sqlite3_func *funcs;
77 php_sqlite3_collation *collations;
78
79 zend_bool exception;
80
81 zend_llist free_list;
82 zend_object zo;
83 } php_sqlite3_db_object;
84
85 static inline php_sqlite3_db_object *php_sqlite3_db_from_obj(zend_object *obj) {
86 return (php_sqlite3_db_object*)((char*)(obj) - XtOffsetOf(php_sqlite3_db_object, zo));
87 }
88
89 #define Z_SQLITE3_DB_P(zv) php_sqlite3_db_from_obj(Z_OBJ_P((zv)))
90
91
92 typedef struct _php_sqlite3_agg_context {
93 zval zval_context;
94 zend_long row_count;
95 } php_sqlite3_agg_context;
96
97 typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt;
98 typedef struct _php_sqlite3_result_object php_sqlite3_result;
99
100
101 typedef struct _php_sqlite3_free_list {
102 zval stmt_obj_zval;
103 php_sqlite3_stmt *stmt_obj;
104 } php_sqlite3_free_list;
105
106
107 struct _php_sqlite3_result_object {
108 php_sqlite3_db_object *db_obj;
109 php_sqlite3_stmt *stmt_obj;
110 zval stmt_obj_zval;
111
112 int is_prepared_statement;
113 int complete;
114 zend_object zo;
115 };
116
117 static inline php_sqlite3_result *php_sqlite3_result_from_obj(zend_object *obj) {
118 return (php_sqlite3_result*)((char*)(obj) - XtOffsetOf(php_sqlite3_result, zo));
119 }
120
121 #define Z_SQLITE3_RESULT_P(zv) php_sqlite3_result_from_obj(Z_OBJ_P((zv)))
122
123
124 struct _php_sqlite3_stmt_object {
125 sqlite3_stmt *stmt;
126 php_sqlite3_db_object *db_obj;
127 zval db_obj_zval;
128
129 int initialised;
130
131
132 HashTable *bound_params;
133 zend_object zo;
134 };
135
136 static inline php_sqlite3_stmt *php_sqlite3_stmt_from_obj(zend_object *obj) {
137 return (php_sqlite3_stmt*)((char*)(obj) - XtOffsetOf(php_sqlite3_stmt, zo));
138 }
139
140 #define Z_SQLITE3_STMT_P(zv) php_sqlite3_stmt_from_obj(Z_OBJ_P((zv)))
141
142 #endif
143
144
145
146
147
148
149
150
151