sqlite_factory
(PHP 5 < 5.4.0)
sqlite_factory — Opens an SQLite database and returns an SQLiteDatabase object
Description
$filename
[, int $mode
= 0666
[, string &$error_message
]] )sqlite_factory() behaves similarly to sqlite_open() in that it opens an SQLite database or attempts to create it if it does not exist. However, a SQLiteDatabase object is returned rather than a resource. Please see the sqlite_open() reference page for further usage and caveats.
Parameters
-
filename
-
The filename of the SQLite database.
-
mode
-
The mode of the file. Intended to be used to open the database in read-only mode. Presently, this parameter is ignored by the sqlite library. The default value for mode is the octal value 0666 and this is the recommended value.
-
error_message
-
Passed by reference and is set to hold a descriptive error message explaining why the database could not be opened if there was an error.
Return Values
Returns an SQLiteDatabase object on success, NULL
on error.
Examples
Example #1 sqlite_factory() example
<?php
$dbhandle = sqlite_factory('sqlitedb');
$dbhandle->query('SELECT user_id, username FROM users');
/* functionally equivalent to: */
$dbhandle = new SQLiteDatabase('sqlitedb');
$dbhandle->query('SELECT user_id, username FROM users');
?>
See Also
- sqlite_open() - Opens an SQLite database and create the database if it does not exist
- sqlite_popen() - Opens a persistent handle to an SQLite database and create the database if it does not exist
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- SQLite
- sqlite_array_query
- sqlite_busy_timeout
- sqlite_changes
- sqlite_close
- sqlite_column
- sqlite_create_aggregate
- sqlite_create_function
- sqlite_current
- sqlite_error_string
- sqlite_escape_string
- sqlite_exec
- sqlite_factory
- sqlite_fetch_all
- sqlite_fetch_array
- sqlite_fetch_column_types
- sqlite_fetch_object
- sqlite_fetch_single
- sqlite_fetch_string
- sqlite_field_name
- sqlite_has_more
- sqlite_has_prev
- sqlite_key
- sqlite_last_error
- sqlite_last_insert_rowid
- sqlite_libencoding
- sqlite_libversion
- sqlite_next
- sqlite_num_fields
- sqlite_num_rows
- sqlite_open
- sqlite_popen
- sqlite_prev
- sqlite_query
- sqlite_rewind
- sqlite_seek
- sqlite_single_query
- sqlite_udf_decode_binary
- sqlite_udf_encode_binary
- sqlite_unbuffered_query
- sqlite_valid
Коментарии
404 Not Found