Lines Matching refs:db_obj

45 static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...)  in php_sqlite3_error()  argument
54 if (db_obj && db_obj->exception) { in php_sqlite3_error()
66 #define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \ argument
67 if (!(db_obj) || !(member)) { \
68 php_sqlite3_error(db_obj, "The " #class_name " object has not been correctly initialised"); \
102 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
109 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
115 if (db_obj->initialised) { in PHP_METHOD()
137 rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL); in PHP_METHOD()
141 db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc)); in PHP_METHOD()
143 db_obj->db ? sqlite3_errmsg(db_obj->db) : ""); in PHP_METHOD()
145 sqlite3_close(db_obj->db); in PHP_METHOD()
154 if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) { in PHP_METHOD()
155 …hrow_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
156 sqlite3_close(db_obj->db); in PHP_METHOD()
162 db_obj->initialised = 1; in PHP_METHOD()
165 sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL); in PHP_METHOD()
170 sqlite3_db_config(db_obj->db, SQLITE_DBCONFIG_DEFENSIVE, 1, NULL); in PHP_METHOD()
184 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
187 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
193 if (db_obj->initialised) { in PHP_METHOD()
194 zend_llist_clean(&(db_obj->free_list)); in PHP_METHOD()
195 if(db_obj->db) { in PHP_METHOD()
196 errcode = sqlite3_close(db_obj->db); in PHP_METHOD()
198 …php_sqlite3_error(db_obj, "Unable to close database: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
202 db_obj->initialised = 0; in PHP_METHOD()
213 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
217 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
219 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
225 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
226 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
256 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
258 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
260 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
266 RETURN_LONG((zend_long) sqlite3_last_insert_rowid(db_obj->db)); in PHP_METHOD()
274 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
276 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
278 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
284 if (db_obj->initialised) { in PHP_METHOD()
285 RETURN_LONG(sqlite3_errcode(db_obj->db)); in PHP_METHOD()
296 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
298 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
300 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
306 if (db_obj->initialised) { in PHP_METHOD()
307 RETURN_LONG(sqlite3_extended_errcode(db_obj->db)); in PHP_METHOD()
318 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
321 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
324 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
330 if (db_obj->initialised) { in PHP_METHOD()
331 ret = sqlite3_extended_result_codes(db_obj->db, enable ? 1 : 0); in PHP_METHOD()
346 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
348 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
350 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3) in PHP_METHOD()
356 if (db_obj->initialised) { in PHP_METHOD()
357 RETURN_STRING((char *)sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
368 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
374 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
376 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
383 return_code = sqlite3_busy_timeout(db_obj->db, ms); in PHP_METHOD()
385 …php_sqlite3_error(db_obj, "Unable to set busy timeout: %d, %s", return_code, sqlite3_errmsg(db_obj in PHP_METHOD()
389 php_ignore_value(sqlite3_busy_timeout(db_obj->db, ms)); in PHP_METHOD()
402 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
407 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
409 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
419 ) { php_sqlite3_error(db_obj, "Not supported in multithreaded Web servers"); in PHP_METHOD()
425 php_sqlite3_error(db_obj, "SQLite Extension are disabled"); in PHP_METHOD()
430 php_sqlite3_error(db_obj, "Empty string as an extension"); in PHP_METHOD()
444 php_sqlite3_error(db_obj, "Unable to load extension at '%s'", lib_path); in PHP_METHOD()
452 php_sqlite3_error(db_obj, "Unable to open extensions outside the defined directory"); in PHP_METHOD()
457 sqlite3_enable_load_extension(db_obj->db, 1); in PHP_METHOD()
458 if (sqlite3_load_extension(db_obj->db, fullpath, 0, &errtext) != SQLITE_OK) { in PHP_METHOD()
459 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
461 sqlite3_enable_load_extension(db_obj->db, 0); in PHP_METHOD()
464 sqlite3_enable_load_extension(db_obj->db, 0); in PHP_METHOD()
475 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()
485 RETURN_LONG(sqlite3_changes(db_obj->db)); in PHP_METHOD()
516 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 stmt_obj->db_obj = db_obj; in PHP_METHOD()
541 errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL); in PHP_METHOD()
543 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->d… in PHP_METHOD()
554 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
562 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
570 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
572 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
584 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
585 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
593 stmt_obj->db_obj = db_obj; in PHP_METHOD()
597 …return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL… in PHP_METHOD()
599 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_ob… in PHP_METHOD()
608 result->db_obj = db_obj; in PHP_METHOD()
622 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
628 php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
679 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
686 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
688 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
700 if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) { in PHP_METHOD()
701 php_sqlite3_error(db_obj, "%s", errtext); in PHP_METHOD()
707 return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &stmt, NULL); in PHP_METHOD()
709 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_ob… in PHP_METHOD()
742 php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
972 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
980 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
982 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
994 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
1001 …if (sqlite3_create_function(db_obj->db, sql_func, sql_func_num_args, flags | SQLITE_UTF8, func, ph… in PHP_METHOD()
1007 func->next = db_obj->funcs; in PHP_METHOD()
1008 db_obj->funcs = func; in PHP_METHOD()
1022 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1029 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1031 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1043 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
1050 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
1057 …if (sqlite3_create_function(db_obj->db, sql_func, sql_func_num_args, SQLITE_UTF8, func, NULL, php_… in PHP_METHOD()
1064 func->next = db_obj->funcs; in PHP_METHOD()
1065 db_obj->funcs = func; in PHP_METHOD()
1079 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1085 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1087 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1099 php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name)); in PHP_METHOD()
1105 …if (sqlite3_create_collation(db_obj->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_callb… in PHP_METHOD()
1110 collation->next = db_obj->collations; in PHP_METHOD()
1111 db_obj->collations = collation; in PHP_METHOD()
1285 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1294 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1296 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1304 …if (sqlite3_blob_open(db_obj->db, dbname, table, column, rowid, sqlite_flags, &blob) != SQLITE_OK)… in PHP_METHOD()
1305 php_sqlite3_error(db_obj, "Unable to open blob: %s", sqlite3_errmsg(db_obj->db)); in PHP_METHOD()
1333 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1337 db_obj = Z_SQLITE3_DB_P(object); in PHP_METHOD()
1343 RETVAL_BOOL(db_obj->exception); in PHP_METHOD()
1345 db_obj->exception = enableExceptions; in PHP_METHOD()
1418 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1437 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1439 if(stmt_obj->db_obj) { in PHP_METHOD()
1440 …zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlit… in PHP_METHOD()
1459 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1463 …php_sqlite3_error(stmt_obj->db_obj, "Unable to reset statement: %s", sqlite3_errmsg(sqlite3_db_han… in PHP_METHOD()
1482 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1486 …php_sqlite3_error(stmt_obj->db_obj, "Unable to clear statement: %s", sqlite3_errmsg(sqlite3_db_han… in PHP_METHOD()
1512 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1542 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1556 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1564 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1575 …php_sqlite3_error(stmt_obj->db_obj, "Unable to read stream for parameter %ld", param->param_number… in php_sqlite3_bind_params()
1587 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1592 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1605 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1614 …php_sqlite3_error(stmt_obj->db_obj, "Unable to bind parameter number " ZEND_LONG_FMT " (%d)", para… in php_sqlite3_bind_params()
1619 …php_sqlite3_error(stmt_obj->db_obj, "Unknown parameter type: %pd for parameter %pd", param->type, … in php_sqlite3_bind_params()
1644 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1659 …php_sqlite3_error(stmt_obj->db_obj, "The expanded parameter requires SQLite3 >= 3.14 and %s is ins… in PHP_METHOD()
1756 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1795 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1833 SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); in PHP_METHOD()
1856 result->db_obj = stmt_obj->db_obj; in PHP_METHOD()
1868 …php_sqlite3_error(stmt_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db_h… in PHP_METHOD()
1883 php_sqlite3_db_object *db_obj; in PHP_METHOD() local
1897 db_obj = Z_SQLITE3_DB_P(db_zval); in PHP_METHOD()
1900 SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) in PHP_METHOD()
1907 stmt_obj->db_obj = db_obj; in PHP_METHOD()
1911 errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL); in PHP_METHOD()
1913 …php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->d… in PHP_METHOD()
1924 zend_llist_add_element(&(db_obj->free_list), &free_item); in PHP_METHOD()
1936 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1956 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
1980 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
2004 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
2045 …php_sqlite3_error(result_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db… in PHP_METHOD()
2058 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
2080 SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) in PHP_METHOD()
2088 zend_llist_del_element(&(result_obj->db_obj->free_list), &result_obj->stmt_obj_zval, in PHP_METHOD()
2403 zend_llist_del_element(&(intern->db_obj->free_list), intern->stmt, in php_sqlite3_stmt_object_free_storage()