Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : SQLite Functions : sqlite_factory

sqlite_factory

Opens a SQLite database and returns a SQLiteDatabase object (PHP 5)
SQLiteDatabase sqlite_factory ( string filename [, int mode [, 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 a SQLiteDatabase object on success, NULL on error.

Examples

Example 2328. 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');

?>


Change Language


Follow Navioo On Twitter
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
eXTReMe Tracker