Returns the SQLite3? library version (such as "3.2.17")
resource sqlite3_open(string path_to_database)
Open (or create) the database. If path_to_database does not exist, the file is created.
In-memory databases are created by the special argument :memory:
bool sqlite3_close(resource handle)
Close (and free) a database handle. No further sqlite_* functions should be invoked after.
Note: All queries must be closed (see: sqlite3_query_close) before, or a warning message will be displayed.
string sqlite3_error(resource handle)
Return the error message of the most recent failed call.
bool sqlite3_exec(resource handle, string sql [,mixed callback])
Execute a query. This functions returns TRUE for successful execution of the query, FALSE otherwise.
NB: the callback argument, if specified, is the name of a user defined function that will be called each time a row is fetched (for SELECT queries). See examples/example3.php for details on how to use this feature.
resource sqlite3_query(resource handle, string sql)
Execute a SQL query. Returns:
* FALSE if the query execution failed.
* a resource (resultset) otherwise.
array sqlite3_fetch_array(resource resultset)
Fetch the next row of the resultset into an associative array.
array sqlite3_fetch(resource resultset)
Fetch the next row of the resultset into an ordered array.
integer sqlite3_column_count(resource resultset)
Return the number of column if the specified resultset.
array sqlite3_column_name(resource resultset, int col)
Return the name of the column col.
array sqlite3_column_type(resource resultset, int col)
Return the type of the column col.
The type is one of the following constants:
bool sqlite3_query_close(resource resultset)
Close the specified resultset.You should always call this function when you no longer need the resultset.
integer sqlite3_last_insert_rowid(resource sqlite3)
Each entry in an SQLite?? table has a unique integer key. (The key is the value of the INTEGER PRIMARY KEY column if there is such a column, otherwise the key is generated at random. The unique key is always available as the ROWID, OID, or _ROWID_ column.) This routine returns the integer key of the most recent insert in the database.
integer sqlite3_changes(resource sqlite3)
This function returns the number of database rows that were changed (or inserted or deleted) by the most recently completed INSERT, UPDATE, or DELETE statement. Only changes that are directly specified by the INSERT, UPDATE, or DELETE statement are counted. Auxiliary changes caused by triggers are not counted. Use the sqlite3_total_changes() function to find the total number of changes including changes caused by triggers.
Within the body of a trigger, the sqlite3_changes() function does work to report the number of rows that were changed for the most recently completed INSERT, UPDATE, or DELETE statement within the trigger body.
SQLite?? implements the command "DELETE FROM table" without a WHERE clause by dropping and recreating the table. (This is much faster than going through and deleting individual elements from the table.) Because of this optimization, the change count for "DELETE FROM table" will be zero regardless of the number of elements that were originally in the table. To get an accurate count of the number of rows deleted, use "DELETE FROM table WHERE 1" instead.
bool sqlite3_create_function (resource sqlite3, string func_name, integer num_args, string callback_name)
Define a new SQL function, named func_name. This function accepts num_args arguments. The callback_name parameter is the name of the PHP function that implement this SQL function. See example/example4.php script.