Lines Matching refs:db_obj
47 static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...) in php_sqlite3_error() argument
56 if (db_obj && db_obj->exception) { in php_sqlite3_error()
68 #define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \ argument
69 if (!(db_obj) || !(member)) { \
70 php_sqlite3_error(db_obj, "The " #class_name " object has not been correctly initialised"); \
104 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
111 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
117 if (db_obj->initialised) { in PHP_METHOD()
140 rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL); in PHP_METHOD()
142 rc = sqlite3_open(fullpath, &(db_obj->db)); in PHP_METHOD()
147 db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc)); in PHP_METHOD()
149 db_obj->db ? sqlite3_errmsg(db_obj->db) : ""); in PHP_METHOD()
159 if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) { in PHP_METHOD()
160 …hrow_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
166 db_obj->initialised = 1; in PHP_METHOD()
169 sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL); in PHP_METHOD()
174 sqlite3_db_config(db_obj->db, SQLITE_DBCONFIG_DEFENSIVE, 1, NULL); in PHP_METHOD()
188 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
191 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
197 if (db_obj->initialised) { in PHP_METHOD()
198 zend_llist_clean(&(db_obj->free_list)); in PHP_METHOD()
199 if(db_obj->db) { in PHP_METHOD()
200 errcode = sqlite3_close(db_obj->db); in PHP_METHOD()
202 …php_sqlite3_error(db_obj, "Unable to close database: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
206 db_obj->initialised = 0; in PHP_METHOD()
217 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
221 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
223 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
229 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
230 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
260 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
262 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
264 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
270 RETURN_LONG((zend_long) sqlite3_last_insert_rowid(db_obj->db)); in PHP_METHOD()
278 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
280 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
282 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
288 if (db_obj->initialised) { in PHP_METHOD()
289 RETURN_LONG(sqlite3_errcode(db_obj->db)); in PHP_METHOD()
300 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
302 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
304 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
310 if (db_obj->initialised) { in PHP_METHOD()
311 RETURN_STRING((char *)sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
322 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
328 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
330 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
337 return_code = sqlite3_busy_timeout(db_obj->db, ms); in PHP_METHOD()
339 …php_sqlite3_error(db_obj, "Unable to set busy timeout: %d, %s", return_code, sqlite3_errmsg(db_obj… in PHP_METHOD()
343 php_ignore_value(sqlite3_busy_timeout(db_obj->db, ms)); in PHP_METHOD()
356 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
361 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
363 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
373 ) { php_sqlite3_error(db_obj, "Not supported in multithreaded Web servers"); in PHP_METHOD()
379 php_sqlite3_error(db_obj, "SQLite Extension are disabled"); in PHP_METHOD()
384 php_sqlite3_error(db_obj, "Empty string as an extension"); in PHP_METHOD()
398 php_sqlite3_error(db_obj, "Unable to load extension at '%s'", lib_path); in PHP_METHOD()
406 php_sqlite3_error(db_obj, "Unable to open extensions outside the defined directory"); in PHP_METHOD()
411 sqlite3_enable_load_extension(db_obj->db, 1); in PHP_METHOD()
412 if (sqlite3_load_extension(db_obj->db, fullpath, 0, &errtext) != SQLITE_OK) { in PHP_METHOD()
413 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
415 sqlite3_enable_load_extension(db_obj->db, 0); in PHP_METHOD()
418 sqlite3_enable_load_extension(db_obj->db, 0); in PHP_METHOD()
429 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
431 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
433 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
439 RETURN_LONG(sqlite3_changes(db_obj->db)); in PHP_METHOD()
470 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
477 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
479 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
491 stmt_obj->db_obj = db_obj; in PHP_METHOD()
494 errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL); in PHP_METHOD()
496 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->d… in PHP_METHOD()
507 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
515 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
523 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
525 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
537 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
538 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
546 stmt_obj->db_obj = db_obj; in PHP_METHOD()
549 …return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL… in PHP_METHOD()
551 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_ob… in PHP_METHOD()
560 result->db_obj = db_obj; in PHP_METHOD()
574 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
580 php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
631 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
638 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
640 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
652 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
653 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
659 return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &stmt, NULL); in PHP_METHOD()
661 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_ob… in PHP_METHOD()
694 php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
920 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
928 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
930 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
942 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
949 …if (sqlite3_create_function(db_obj->db, sql_func, sql_func_num_args, flags | SQLITE_UTF8, func, ph… in PHP_METHOD()
955 func->next = db_obj->funcs; in PHP_METHOD()
956 db_obj->funcs = func; in PHP_METHOD()
970 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
977 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
979 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
991 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
998 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
1005 …if (sqlite3_create_function(db_obj->db, sql_func, sql_func_num_args, SQLITE_UTF8, func, NULL, php_… in PHP_METHOD()
1012 func->next = db_obj->funcs; in PHP_METHOD()
1013 db_obj->funcs = func; in PHP_METHOD()
1027 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1033 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1035 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1047 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
1053 …if (sqlite3_create_collation(db_obj->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_callb… in PHP_METHOD()
1058 collation->next = db_obj->collations; in PHP_METHOD()
1059 db_obj->collations = collation; in PHP_METHOD()
1233 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1242 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1244 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1252 …if (sqlite3_blob_open(db_obj->db, dbname, table, column, rowid, sqlite_flags, &blob) != SQLITE_OK)… in PHP_METHOD()
1253 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()
1309 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1328 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1330 if(stmt_obj->db_obj) { in PHP_METHOD()
1331 …zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlit… in PHP_METHOD()
1350 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1354 …php_sqlite3_error(stmt_obj->db_obj, "Unable to reset statement: %s", sqlite3_errmsg(sqlite3_db_han… in PHP_METHOD()
1373 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1377 …php_sqlite3_error(stmt_obj->db_obj, "Unable to clear statement: %s", sqlite3_errmsg(sqlite3_db_han… in PHP_METHOD()
1403 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1501 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1540 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1578 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1621 …php_sqlite3_error(stmt_obj->db_obj, "Unable to read stream for parameter %ld", param->param_number… in PHP_METHOD()
1648 …php_sqlite3_error(stmt_obj->db_obj, "Unknown parameter type: %pd for parameter %pd", param->type, … in PHP_METHOD()
1665 result->db_obj = stmt_obj->db_obj; in PHP_METHOD()
1676 …php_sqlite3_error(stmt_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db_h… in PHP_METHOD()
1691 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1705 db_obj = Z_SQLITE3_DB_P(db_zval); in PHP_METHOD()
1708 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1715 stmt_obj->db_obj = db_obj; in PHP_METHOD()
1718 errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL); in PHP_METHOD()
1720 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->d… in PHP_METHOD()
1731 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
1743 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1763 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1787 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1811 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1853 …php_sqlite3_error(result_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db… in PHP_METHOD()
1866 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1890 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1898 zend_llist_del_element(&(result_obj->db_obj->free_list), &result_obj->stmt_obj_zval, in PHP_METHOD()
2191 zend_llist_del_element(&(intern->db_obj->free_list), intern->stmt, in php_sqlite3_stmt_object_free_storage()