1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 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 #ifndef PHP_PDO_SQLITE_INT_H 20 #define PHP_PDO_SQLITE_INT_H 21 22 #include <sqlite3.h> 23 24 typedef struct { 25 const char *file; 26 int line; 27 unsigned int errcode; 28 char *errmsg; 29 } pdo_sqlite_error_info; 30 31 struct pdo_sqlite_fci { 32 zend_fcall_info fci; 33 zend_fcall_info_cache fcc; 34 }; 35 36 struct pdo_sqlite_func { 37 struct pdo_sqlite_func *next; 38 39 zval func, step, fini; 40 int argc; 41 const char *funcname; 42 43 /* accelerated callback references */ 44 struct pdo_sqlite_fci afunc, astep, afini; 45 }; 46 47 struct pdo_sqlite_collation { 48 struct pdo_sqlite_collation *next; 49 50 const char *name; 51 zval callback; 52 struct pdo_sqlite_fci fc; 53 }; 54 55 typedef struct { 56 sqlite3 *db; 57 pdo_sqlite_error_info einfo; 58 struct pdo_sqlite_func *funcs; 59 struct pdo_sqlite_collation *collations; 60 } pdo_sqlite_db_handle; 61 62 typedef struct { 63 pdo_sqlite_db_handle *H; 64 sqlite3_stmt *stmt; 65 unsigned pre_fetched:1; 66 unsigned done:1; 67 } pdo_sqlite_stmt; 68 69 extern const pdo_driver_t pdo_sqlite_driver; 70 71 extern int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line); 72 #define pdo_sqlite_error(s) _pdo_sqlite_error(s, NULL, __FILE__, __LINE__) 73 #define pdo_sqlite_error_stmt(s) _pdo_sqlite_error(stmt->dbh, stmt, __FILE__, __LINE__) 74 75 extern const struct pdo_stmt_methods sqlite_stmt_methods; 76 77 enum { 78 PDO_SQLITE_ATTR_OPEN_FLAGS = PDO_ATTR_DRIVER_SPECIFIC, 79 PDO_SQLITE_ATTR_READONLY_STATEMENT, 80 PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES 81 }; 82 83 #endif 84