57#if defined(COMPILE_DL_PDO_SQLITE) || defined(COMPILE_DL_PDO_SQLITE_EXTERNAL)
69#ifndef PDO_SQLITE_OMIT_LOAD_EXTENSION
73 char *extension, *errtext =
NULL;
84 if (extension_len == 0) {
109 sqlite3 *sqlite_handle;
110 sqlite_handle = db_handle->
db;
113 sqlite3_db_config(sqlite_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1,
NULL);
115 if (sqlite3_load_extension(sqlite_handle, fullpath, 0, &errtext) != SQLITE_OK) {
117 sqlite3_free(errtext);
118 sqlite3_db_config(sqlite_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 0,
NULL);
125 sqlite3_db_config(sqlite_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 0,
NULL);
136static ssize_t php_pdosqlite3_stream_write(
php_stream *stream,
const char *
buf,
size_t count)
150 if (sqlite3_blob_write(sqlite3_stream->
blob,
buf,
count, sqlite3_stream->
position) != SQLITE_OK) {
174 if (sqlite3_blob_read(sqlite3_stream->
blob,
buf,
count, sqlite3_stream->
position) != SQLITE_OK) {
182static int php_pdosqlite3_stream_close(
php_stream *stream,
int close_handle)
186 if (sqlite3_blob_close(sqlite3_stream->
blob) != SQLITE_OK) {
190 efree(sqlite3_stream);
195static int php_pdosqlite3_stream_flush(
php_stream *stream)
214 *newoffs = sqlite3_stream->
position;
225 *newoffs = sqlite3_stream->
position;
231 if (sqlite3_stream->
size < (
size_t)(
offset)) {
237 *newoffs = sqlite3_stream->
position;
246 }
else if (sqlite3_stream->
size < (
size_t)(-
offset)) {
252 *newoffs = sqlite3_stream->
position;
257 *newoffs = sqlite3_stream->
position;
262static int php_pdosqlite3_stream_cast(
php_stream *stream,
int castas,
void **
ret)
270 ssb->sb.st_size = sqlite3_stream->
size;
275 php_pdosqlite3_stream_write,
276 php_pdosqlite3_stream_read,
277 php_pdosqlite3_stream_close,
278 php_pdosqlite3_stream_flush,
280 php_pdosqlite3_stream_seek,
281 php_pdosqlite3_stream_cast,
282 php_pdosqlite3_stream_stat,
289 char *table, *column, *dbname =
"main", *
mode =
"rb";
290 size_t table_len, column_len, dbname_len;
292 sqlite3_blob *blob =
NULL;
307 sqlite3 *sqlite_handle;
308 sqlite_handle = db_handle->
db;
311 if (sqlite3_blob_open(sqlite_handle, dbname, table, column, rowid, sqlite_flags, &blob) != SQLITE_OK) {
317 sqlite3_stream->
blob = blob;
320 sqlite3_stream->
size = sqlite3_blob_bytes(blob);
322 if (sqlite_flags != 0) {
335static int php_sqlite_collation_callback(
void *
context,
int string1_len,
const void *string1,
336 int string2_len,
const void *string2)
352 zend_type_error(
"%s(): Return value of the callback must be of type int, %s returned",
384#ifdef SQLITE_DETERMINISTIC
395 pdosqlite_ce = register_class_Pdo_Sqlite(
pdo_dbh_ce);
SAPI_API sapi_module_struct sapi_module
count(Countable|array $value, int $mode=COUNT_NORMAL)
zend_ffi_ctype_name_buf buf
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
PDO_API void php_pdo_unregister_driver(const pdo_driver_t *driver)
PDO_API zend_result php_pdo_register_driver(const pdo_driver_t *driver)
PDO_API zend_result php_pdo_register_driver_specific_ce(const pdo_driver_t *driver, zend_class_entry *ce)
zend_class_entry * pdo_dbh_ce
PDO_API zend_class_entry * php_pdo_get_exception(void)
zend_object * pdo_dbh_new(zend_class_entry *ce)
php_info_print_table_start()
php_info_print_table_row(2, "PDO Driver for Firebird", "enabled")
php_info_print_table_end()
zend_module_entry pdo_sqlite_module_entry
#define PHP_MSHUTDOWN_FUNCTION
#define PHP_MINIT_FUNCTION
#define PHP_MINFO_FUNCTION
#define PDO_CONSTRUCT_CHECK
#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value)
struct _pdo_dbh_t pdo_dbh_t
#define PHP_PDO_SQLITE_VERSION
@ PDO_SQLITE_ATTR_READONLY_STATEMENT
@ PDO_SQLITE_ATTR_OPEN_FLAGS
@ PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES
void pdo_sqlite_create_function_internal(INTERNAL_FUNCTION_PARAMETERS)
void pdo_sqlite_create_collation_internal(INTERNAL_FUNCTION_PARAMETERS, pdo_sqlite_create_collation_callback callback)
const pdo_driver_t pdo_sqlite_driver
void pdo_sqlite_create_aggregate_internal(INTERNAL_FUNCTION_PARAMETERS)
#define SQLITE_OPEN_CREATE
#define SQLITE_OPEN_READWRITE
#define SQLITE_OPEN_READONLY
struct _php_stream php_stream
#define php_stream_to_zval(stream, zval)
struct _php_stream_ops php_stream_ops
#define php_stream_alloc(ops, thisptr, persistent_id, mode)
struct _php_stream_statbuf php_stream_statbuf
zend_fcall_info_cache callback
ZEND_API ZEND_COLD void zend_type_error(const char *format,...)
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
ZEND_API const char * zend_zval_value_name(const zval *arg)
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num)
#define ZEND_GET_MODULE(name)
#define ZVAL_STRINGL(z, s, l)
strncmp(string $string1, string $string2, int $length)
strcmp(string $string1, string $string2)
ZEND_API ZEND_COLD zend_object * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format,...)
ZEND_API zend_string * get_active_function_or_method_name(void)
struct _zend_string zend_string
struct _zend_module_dep zend_module_dep
struct _zend_module_entry zend_module_entry
#define STANDARD_MODULE_PROPERTIES
#define ZEND_MOD_REQUIRED(name)
#define STANDARD_MODULE_HEADER_EX
struct _zend_class_entry zend_class_entry
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
#define VCWD_REALPATH(path, real_path)