1 /*
2 +----------------------------------------------------------------------+
3 | PHP Version 7 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2016 The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Author: Wez Furlong <wez@php.net> |
16 +----------------------------------------------------------------------+
17 */
18
19 /* $Id$ */
20
21 #ifndef PHP_PDO_SQLITE_INT_H
22 #define PHP_PDO_SQLITE_INT_H
23
24 #include <sqlite3.h>
25
26 typedef struct {
27 const char *file;
28 int line;
29 unsigned int errcode;
30 char *errmsg;
31 } pdo_sqlite_error_info;
32
33 struct pdo_sqlite_fci {
34 zend_fcall_info fci;
35 zend_fcall_info_cache fcc;
36 };
37
38 struct pdo_sqlite_func {
39 struct pdo_sqlite_func *next;
40
41 zval func, step, fini;
42 int argc;
43 const char *funcname;
44
45 /* accelerated callback references */
46 struct pdo_sqlite_fci afunc, astep, afini;
47 };
48
49 struct pdo_sqlite_collation {
50 struct pdo_sqlite_collation *next;
51
52 const char *name;
53 zval callback;
54 struct pdo_sqlite_fci fc;
55 };
56
57 typedef struct {
58 sqlite3 *db;
59 pdo_sqlite_error_info einfo;
60 struct pdo_sqlite_func *funcs;
61 struct pdo_sqlite_collation *collations;
62 } pdo_sqlite_db_handle;
63
64 typedef struct {
65 pdo_sqlite_db_handle *H;
66 sqlite3_stmt *stmt;
67 unsigned pre_fetched:1;
68 unsigned done:1;
69 } pdo_sqlite_stmt;
70
71 extern pdo_driver_t pdo_sqlite_driver;
72
73 extern int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line);
74 #define pdo_sqlite_error(s) _pdo_sqlite_error(s, NULL, __FILE__, __LINE__)
75 #define pdo_sqlite_error_stmt(s) _pdo_sqlite_error(stmt->dbh, stmt, __FILE__, __LINE__)
76
77 extern struct pdo_stmt_methods sqlite_stmt_methods;
78 #endif