forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp_sqlite3.h
155 lines (121 loc) · 3.74 KB
/
php_sqlite3.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
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 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: |
| http://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 |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Scott MacVicar <[email protected]> |
+----------------------------------------------------------------------+
$Id$
*/
#ifndef PHP_SQLITE_H
#define PHP_SQLITE_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
/* Include PHP Standard Header */
#include "php.h"
/* Include headers */
#include <sqlite3.h>
#define PHP_SQLITE3_VERSION "0.7-dev"
extern zend_module_entry sqlite3_module_entry;
#define phpext_sqlite3_ptr &sqlite3_module_entry
ZEND_BEGIN_MODULE_GLOBALS(sqlite3)
char *extension_dir;
ZEND_END_MODULE_GLOBALS(sqlite3)
#ifdef ZTS
# define SQLITE3G(v) TSRMG(sqlite3_globals_id, zend_sqlite3_globals *, v)
#else
# define SQLITE3G(v) (sqlite3_globals.v)
#endif
#define PHP_SQLITE3_ASSOC 1<<0
#define PHP_SQLITE3_NUM 1<<1
#define PHP_SQLITE3_BOTH (PHP_SQLITE3_ASSOC|PHP_SQLITE3_NUM)
/* for backwards compatability reasons */
#ifndef SQLITE_OPEN_READONLY
#define SQLITE_OPEN_READONLY 0x00000001
#endif
#ifndef SQLITE_OPEN_READWRITE
#define SQLITE_OPEN_READWRITE 0x00000002
#endif
#ifndef SQLITE_OPEN_CREATE
#define SQLITE_OPEN_CREATE 0x00000004
#endif
/* Structure for SQLite Statement Parameter. */
struct php_sqlite3_bound_param {
long param_number;
char *name;
int name_len;
int type;
zval *parameter;
};
struct php_sqlite3_fci {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
};
/* Structure for SQLite function. */
typedef struct _php_sqlite3_func {
struct _php_sqlite3_func *next;
const char *func_name;
int argc;
zval *func, *step, *fini;
struct php_sqlite3_fci afunc, astep, afini;
} php_sqlite3_func;
/* Structure for SQLite Database object. */
typedef struct _php_sqlite3_db_object {
zend_object zo;
int initialised;
sqlite3 *db;
php_sqlite3_func *funcs;
} php_sqlite3_db_object;
/*typedef struct _php_sqlite3_stmt {
sqlite3_stmt *stmt;
int initialised;
} php_sqlite3_stmt;*/
typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt;
typedef struct _php_sqlite3_result_object php_sqlite3_result;
/* sqlite3 objects to be destroyed */
typedef struct _php_sqlite3_stmt_free_list {
sqlite3_stmt *stmt;
zval *statement_object;
zval *result_object;
} php_sqlite3_stmt_free_list;
/* Structure for SQLite Result object. */
struct _php_sqlite3_result_object {
zend_object zo;
php_sqlite3_db_object *db_obj;
php_sqlite3_stmt *stmt_obj;
zval *stmt_obj_zval;
int initialised;
int is_prepared_statement;
int complete;
};
/* Structure for SQLite Statement object. */
struct _php_sqlite3_stmt_object {
zend_object zo;
sqlite3_stmt *stmt;
php_sqlite3_db_object *db_obj;
zval *db_obj_zval;
int initialised;
/* Keep track of the zvals for bound parameters */
HashTable *bound_params;
};
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/