Lines Matching refs:db_obj
42 static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...) in php_sqlite3_error() argument
51 if (db_obj && db_obj->exception) { in php_sqlite3_error()
63 #define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \ argument
64 if (!(db_obj) || !(member)) { \
97 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
104 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
110 if (db_obj->initialised) { in PHP_METHOD()
132 rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL); in PHP_METHOD()
136 db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc)); in PHP_METHOD()
138 db_obj->db ? sqlite3_errmsg(db_obj->db) : ""); in PHP_METHOD()
140 sqlite3_close(db_obj->db); in PHP_METHOD()
149 if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) { in PHP_METHOD()
150 …hrow_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
151 sqlite3_close(db_obj->db); in PHP_METHOD()
157 db_obj->initialised = 1; in PHP_METHOD()
158 db_obj->authorizer_fci = empty_fcall_info; in PHP_METHOD()
159 db_obj->authorizer_fcc = empty_fcall_info_cache; in PHP_METHOD()
161 sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, db_obj); in PHP_METHOD()
165 sqlite3_db_config(db_obj->db, SQLITE_DBCONFIG_DEFENSIVE, 1, NULL); in PHP_METHOD()
178 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
181 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
187 if (db_obj->initialised) { in PHP_METHOD()
188 zend_llist_clean(&(db_obj->free_list)); in PHP_METHOD()
189 if(db_obj->db) { in PHP_METHOD()
190 errcode = sqlite3_close(db_obj->db); in PHP_METHOD()
192 …php_sqlite3_error(db_obj, "Unable to close database: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
196 db_obj->initialised = 0; in PHP_METHOD()
206 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
210 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
216 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
218 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
219 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
247 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
249 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
255 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
257 RETURN_LONG((zend_long) sqlite3_last_insert_rowid(db_obj->db)); in PHP_METHOD()
264 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
266 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
272 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
274 if (db_obj->initialised) { in PHP_METHOD()
275 RETURN_LONG(sqlite3_errcode(db_obj->db)); in PHP_METHOD()
285 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
287 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
293 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
295 if (db_obj->initialised) { in PHP_METHOD()
296 RETURN_LONG(sqlite3_extended_errcode(db_obj->db)); in PHP_METHOD()
306 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
309 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
316 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
318 if (db_obj->initialised) { in PHP_METHOD()
319 ret = sqlite3_extended_result_codes(db_obj->db, enable ? 1 : 0); in PHP_METHOD()
333 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
335 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
341 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
343 if (db_obj->initialised) { in PHP_METHOD()
344 RETURN_STRING((char *)sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
354 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
360 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
366 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
369 return_code = sqlite3_busy_timeout(db_obj->db, ms); in PHP_METHOD()
371 …php_sqlite3_error(db_obj, "Unable to set busy timeout: %d, %s", return_code, sqlite3_errmsg(db_obj… in PHP_METHOD()
375 php_ignore_value(sqlite3_busy_timeout(db_obj->db, ms)); in PHP_METHOD()
387 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
392 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
398 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
404 ) { php_sqlite3_error(db_obj, "Not supported in multithreaded Web servers"); in PHP_METHOD()
410 php_sqlite3_error(db_obj, "SQLite Extension are disabled"); in PHP_METHOD()
415 php_sqlite3_error(db_obj, "Empty string as an extension"); in PHP_METHOD()
429 php_sqlite3_error(db_obj, "Unable to load extension at '%s'", lib_path); in PHP_METHOD()
437 php_sqlite3_error(db_obj, "Unable to open extensions outside the defined directory"); in PHP_METHOD()
442 sqlite3_enable_load_extension(db_obj->db, 1); in PHP_METHOD()
443 if (sqlite3_load_extension(db_obj->db, fullpath, 0, &errtext) != SQLITE_OK) { in PHP_METHOD()
444 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
446 sqlite3_enable_load_extension(db_obj->db, 0); in PHP_METHOD()
449 sqlite3_enable_load_extension(db_obj->db, 0); in PHP_METHOD()
459 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
461 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
467 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
469 RETURN_LONG(sqlite3_changes(db_obj->db)); in PHP_METHOD()
498 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
505 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
511 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
519 stmt_obj->db_obj = db_obj; in PHP_METHOD()
522 errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL); in PHP_METHOD()
524 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->d… in PHP_METHOD()
535 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
542 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
550 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
556 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
564 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
565 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
573 stmt_obj->db_obj = db_obj; in PHP_METHOD()
576 …return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL… in PHP_METHOD()
578 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_ob… in PHP_METHOD()
587 result->db_obj = db_obj; in PHP_METHOD()
601 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
607 php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
657 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
664 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
670 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
678 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
679 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
685 return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &stmt, NULL); in PHP_METHOD()
687 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_ob… in PHP_METHOD()
720 php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
949 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
958 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
964 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
972 …if (sqlite3_create_function(db_obj->db, sql_func, sql_func_num_args, flags | SQLITE_UTF8, func, ph… in PHP_METHOD()
978 func->next = db_obj->funcs; in PHP_METHOD()
979 db_obj->funcs = func; in PHP_METHOD()
992 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1000 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1006 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1014 …if (sqlite3_create_function(db_obj->db, sql_func, sql_func_num_args, SQLITE_UTF8, func, NULL, php_… in PHP_METHOD()
1021 func->next = db_obj->funcs; in PHP_METHOD()
1022 db_obj->funcs = func; in PHP_METHOD()
1035 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1042 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1048 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1055 …if (sqlite3_create_collation(db_obj->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_callb… in PHP_METHOD()
1060 collation->next = db_obj->collations; in PHP_METHOD()
1061 db_obj->collations = collation; in PHP_METHOD()
1234 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1243 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1249 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1253 …if (sqlite3_blob_open(db_obj->db, dbname, table, column, rowid, sqlite_flags, &blob) != SQLITE_OK)… in PHP_METHOD()
1254 php_sqlite3_error(db_obj, "Unable to open blob: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
1281 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1285 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1291 RETVAL_BOOL(db_obj->exception); in PHP_METHOD()
1293 db_obj->exception = enableExceptions; in PHP_METHOD()
1300 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1302 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1310 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1313 if (ZEND_FCI_INITIALIZED(db_obj->authorizer_fci)) { in PHP_METHOD()
1314 zval_ptr_dtor(&db_obj->authorizer_fci.function_name); in PHP_METHOD()
1315 db_obj->authorizer_fci.size = 0; in PHP_METHOD()
1320 db_obj->authorizer_fci = fci; in PHP_METHOD()
1321 Z_ADDREF(db_obj->authorizer_fci.function_name); in PHP_METHOD()
1322 db_obj->authorizer_fcc = fcc; in PHP_METHOD()
1395 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1411 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1413 if(stmt_obj->db_obj) { in PHP_METHOD()
1414 …zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlit… in PHP_METHOD()
1430 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1434 …php_sqlite3_error(stmt_obj->db_obj, "Unable to reset statement: %s", sqlite3_errmsg(sqlite3_db_han… in PHP_METHOD()
1450 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1454 …php_sqlite3_error(stmt_obj->db_obj, "Unable to clear statement: %s", sqlite3_errmsg(sqlite3_db_han… in PHP_METHOD()
1477 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1507 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1521 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1529 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1540 …php_sqlite3_error(stmt_obj->db_obj, "Unable to read stream for parameter %ld", param->param_number… in php_sqlite3_bind_params()
1552 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1557 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1570 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1579 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1584 …php_sqlite3_error(stmt_obj->db_obj, "Unknown parameter type: %pd for parameter %pd", param->type, … in php_sqlite3_bind_params()
1609 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1624 …php_sqlite3_error(stmt_obj->db_obj, "The expanded parameter requires SQLite3 >= 3.14 and %s is ins… in PHP_METHOD()
1721 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in sqlite3stmt_bind()
1770 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1793 result->db_obj = stmt_obj->db_obj; in PHP_METHOD()
1804 …php_sqlite3_error(stmt_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db_h… in PHP_METHOD()
1818 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1831 db_obj = Z_SQLITE3_DB_P(db_zval); in PHP_METHOD()
1833 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1839 stmt_obj->db_obj = db_obj; in PHP_METHOD()
1842 errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL); in PHP_METHOD()
1844 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->d… in PHP_METHOD()
1855 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
1868 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1887 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1911 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1935 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1974 …php_sqlite3_error(result_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db… in PHP_METHOD()
1988 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
2007 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
2011 zend_llist_del_element(&(result_obj->db_obj->free_list), &result_obj->stmt_obj_zval, in PHP_METHOD()
2048 php_sqlite3_db_object *db_obj = (php_sqlite3_db_object *)autharg; in php_sqlite3_authorizer() local
2049 zend_fcall_info *fci = &db_obj->authorizer_fci; in php_sqlite3_authorizer()
2092 if (zend_call_function(fci, &db_obj->authorizer_fcc) != SUCCESS || Z_ISUNDEF(retval)) { in php_sqlite3_authorizer()
2093 php_sqlite3_error(db_obj, "An error occurred while invoking the authorizer callback"); in php_sqlite3_authorizer()
2096 php_sqlite3_error(db_obj, "The authorizer callback returned an invalid type: expected int"); in php_sqlite3_authorizer()
2101 php_sqlite3_error(db_obj, "The authorizer callback returned an invalid value"); in php_sqlite3_authorizer()
2248 zend_llist_del_element(&(intern->db_obj->free_list), intern->stmt, in php_sqlite3_stmt_object_free_storage()