- Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathphp_sqlite3_structs.h
138 lines (108 loc) · 4 KB
/
php_sqlite3_structs.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
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Scott MacVicar <scottmac@php.net> |
+----------------------------------------------------------------------+
*/
#ifndefPHP_SQLITE_STRUCTS_H
#definePHP_SQLITE_STRUCTS_H
#include<sqlite3.h>
/* for backwards compatibility reasons */
#ifndefSQLITE_OPEN_READONLY
#defineSQLITE_OPEN_READONLY 0x00000001
#endif
#ifndefSQLITE_OPEN_READWRITE
#defineSQLITE_OPEN_READWRITE 0x00000002
#endif
#ifndefSQLITE_OPEN_CREATE
#defineSQLITE_OPEN_CREATE 0x00000004
#endif
/* Structure for SQLite Statement Parameter. */
structphp_sqlite3_bound_param {
zend_longparam_number;
zend_string*name;
zend_longtype;
zvalparameter;
};
/* Structure for SQLite function. */
typedefstruct_php_sqlite3_func {
struct_php_sqlite3_func*next;
constchar*func_name;
intargc;
zend_fcall_info_cachefunc;
zend_fcall_info_cachestep;
zend_fcall_info_cachefini;
} php_sqlite3_func;
/* Structure for SQLite collation function */
typedefstruct_php_sqlite3_collation {
struct_php_sqlite3_collation*next;
constchar*collation_name;
zend_fcall_info_cachecmp_func;
} php_sqlite3_collation;
/* Structure for SQLite Database object. */
typedefstruct_php_sqlite3_db_object {
intinitialised;
sqlite3*db;
php_sqlite3_func*funcs;
php_sqlite3_collation*collations;
zend_fcall_info_cacheauthorizer_fcc;
boolexception;
zend_llistfree_list;
zend_objectzo;
} php_sqlite3_db_object;
staticinlinephp_sqlite3_db_object*php_sqlite3_db_from_obj(zend_object*obj) {
return (php_sqlite3_db_object*)((char*)(obj) -XtOffsetOf(php_sqlite3_db_object, zo));
}
#defineZ_SQLITE3_DB_P(zv) php_sqlite3_db_from_obj(Z_OBJ_P((zv)))
/* Structure for SQLite Database object. */
typedefstruct_php_sqlite3_agg_context {
zvalzval_context;
zend_longrow_count;
} php_sqlite3_agg_context;
typedefstruct_php_sqlite3_stmt_objectphp_sqlite3_stmt;
typedefstruct_php_sqlite3_result_objectphp_sqlite3_result;
/* sqlite3 objects to be destroyed */
typedefstruct_php_sqlite3_free_list {
zvalstmt_obj_zval;
php_sqlite3_stmt*stmt_obj;
} php_sqlite3_free_list;
/* Structure for SQLite Result object. */
struct_php_sqlite3_result_object {
php_sqlite3_db_object*db_obj;
php_sqlite3_stmt*stmt_obj;
zvalstmt_obj_zval;
/* Cache of column names to speed up repeated fetchArray(SQLITE3_ASSOC) calls.
* Cache is cleared on reset() and finalize() calls. */
intcolumn_count;
zend_string**column_names;
intis_prepared_statement;
zend_objectzo;
};
staticinlinephp_sqlite3_result*php_sqlite3_result_from_obj(zend_object*obj) {
return (php_sqlite3_result*)((char*)(obj) -XtOffsetOf(php_sqlite3_result, zo));
}
#defineZ_SQLITE3_RESULT_P(zv) php_sqlite3_result_from_obj(Z_OBJ_P((zv)))
/* Structure for SQLite Statement object. */
struct_php_sqlite3_stmt_object {
sqlite3_stmt*stmt;
php_sqlite3_db_object*db_obj;
zvaldb_obj_zval;
intinitialised;
/* Keep track of the zvals for bound parameters */
HashTable*bound_params;
zend_objectzo;
};
staticinlinephp_sqlite3_stmt*php_sqlite3_stmt_from_obj(zend_object*obj) {
return (php_sqlite3_stmt*)((char*)(obj) -XtOffsetOf(php_sqlite3_stmt, zo));
}
#defineZ_SQLITE3_STMT_P(zv) php_sqlite3_stmt_from_obj(Z_OBJ_P((zv)))
#endif