From 80c2907dc35a04ae1c8d78baf414aabe40d9a25a Mon Sep 17 00:00:00 2001 From: Kenneth Schwartz Date: Wed, 12 Jan 2005 08:56:59 +0000 Subject: [PATCH] Add SQLite classes, update examples git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@177066 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../sqlite/functions/sqlite-array-query.xml | 29 ++- .../sqlite/functions/sqlite-busy-timeout.xml | 14 +- reference/sqlite/functions/sqlite-changes.xml | 11 +- reference/sqlite/functions/sqlite-column.xml | 23 ++- .../functions/sqlite-create-aggregate.xml | 14 +- .../functions/sqlite-create-function.xml | 13 +- reference/sqlite/functions/sqlite-current.xml | 27 ++- reference/sqlite/functions/sqlite-exec.xml | 28 +-- reference/sqlite/functions/sqlite-factory.xml | 23 ++- .../sqlite/functions/sqlite-fetch-all.xml | 25 ++- .../sqlite/functions/sqlite-fetch-array.xml | 47 +++-- .../functions/sqlite-fetch-column-types.xml | 61 ++++++- .../sqlite/functions/sqlite-fetch-object.xml | 29 ++- .../sqlite/functions/sqlite-fetch-single.xml | 20 ++- .../sqlite/functions/sqlite-field-name.xml | 31 +++- .../sqlite/functions/sqlite-has-prev.xml | 13 +- reference/sqlite/functions/sqlite-key.xml | 61 +++++++ .../sqlite/functions/sqlite-last-error.xml | 11 +- .../functions/sqlite-last-insert-rowid.xml | 11 +- reference/sqlite/functions/sqlite-next.xml | 22 ++- .../sqlite/functions/sqlite-num-fields.xml | 19 +- .../sqlite/functions/sqlite-num-rows.xml | 15 +- reference/sqlite/functions/sqlite-open.xml | 12 +- reference/sqlite/functions/sqlite-prev.xml | 13 +- reference/sqlite/functions/sqlite-query.xml | 25 ++- reference/sqlite/functions/sqlite-rewind.xml | 13 +- reference/sqlite/functions/sqlite-seek.xml | 13 +- .../sqlite/functions/sqlite-single-query.xml | 13 +- .../functions/sqlite-unbuffered-query.xml | 12 +- reference/sqlite/functions/sqlite-valid.xml | 31 +++- reference/sqlite/reference.xml | 166 +++++++++++++++++- 31 files changed, 718 insertions(+), 127 deletions(-) create mode 100755 reference/sqlite/functions/sqlite-key.xml diff --git a/reference/sqlite/functions/sqlite-array-query.xml b/reference/sqlite/functions/sqlite-array-query.xml index 2de92e0779..182ae7a52a 100644 --- a/reference/sqlite/functions/sqlite-array-query.xml +++ b/reference/sqlite/functions/sqlite-array-query.xml @@ -1,8 +1,9 @@ - + sqlite_array_query + SQLiteDatabase->arrayQuery Execute a query against a given database and returns an array @@ -21,6 +22,16 @@ intresult_type booldecode_binary + Object oriented style (method): + + SQLiteDatabase + + arrayarrayQuery + stringquery + intresult_type + booldecode_binary + + sqlite_array_query is similar to calling sqlite_query and then @@ -29,9 +40,13 @@ sqlite_array_query is significantly faster than using such a script. - - <function>sqlite_array_query</function> implemented yourself - + &sqlite.result-type; + &sqlite.case-fold; + &sqlite.decode-bin; + + + <function>sqlite_array_query</function> implemented yourself + ]]> - - + + + sqlite_array_query is best suited to queries @@ -52,6 +68,7 @@ while ($r = sqlite_fetch_array($q)) { performance. + &sqlite.param-compat; See also sqlite_query, sqlite_fetch_array, and diff --git a/reference/sqlite/functions/sqlite-busy-timeout.xml b/reference/sqlite/functions/sqlite-busy-timeout.xml index 73cbc5b005..2d5cab8344 100644 --- a/reference/sqlite/functions/sqlite-busy-timeout.xml +++ b/reference/sqlite/functions/sqlite-busy-timeout.xml @@ -1,7 +1,9 @@ - + - sqlite_busy_timeout + + sqlite_busy_timeout + SQLiteDatabase->busyTimeout Set busy timeout duration, or disable busy handlers @@ -11,6 +13,14 @@ resourcedbhandle intmilliseconds + Object oriented style (method): + + SQLiteDatabase + + voidbusyTimeout + intmilliseconds + + Set the maximum time that sqlite will wait for a dbhandle diff --git a/reference/sqlite/functions/sqlite-changes.xml b/reference/sqlite/functions/sqlite-changes.xml index 413c93f0f7..411a142577 100644 --- a/reference/sqlite/functions/sqlite-changes.xml +++ b/reference/sqlite/functions/sqlite-changes.xml @@ -1,8 +1,9 @@ - + sqlite_changes + SQLiteDatabase->changes Returns the number of rows that were changed by the most recent SQL statement @@ -14,6 +15,14 @@ intsqlite_changes resourcedbhandle + Object oriented style (method): + + SQLiteDatabase + + intchanges + + + Returns the numbers of rows that were changed by the most recent SQL statement executed against the dbhandle database diff --git a/reference/sqlite/functions/sqlite-column.xml b/reference/sqlite/functions/sqlite-column.xml index 5c307a0366..5e344e89f9 100644 --- a/reference/sqlite/functions/sqlite-column.xml +++ b/reference/sqlite/functions/sqlite-column.xml @@ -1,8 +1,10 @@ - + sqlite_column + SQLiteResult->column + SQLiteUnbuffered->column Fetches a column from the current row of a result set @@ -13,14 +15,29 @@ mixedindex_or_name booldecode_binary + + SQLiteResult + + mixedcolumn + mixedindex_or_name + booldecode_binary + + + + SQLiteUnbuffered + + mixedcolumn + mixedindex_or_name + booldecode_binary + + Fetches the value of a column named index_or_name (if it is a string), or of the ordinal column numbered index_or_name (if it is an integer) from the current row of the query result handle result. - The decode binary flag operates in the same way as described under - sqlite_fetch_array. + &sqlite.decode-bin; Use this function when you are iterating a large result set with many columns, or with columns that contain large amounts of data. diff --git a/reference/sqlite/functions/sqlite-create-aggregate.xml b/reference/sqlite/functions/sqlite-create-aggregate.xml index 7b41d342c2..1e2f1c2fb8 100644 --- a/reference/sqlite/functions/sqlite-create-aggregate.xml +++ b/reference/sqlite/functions/sqlite-create-aggregate.xml @@ -1,8 +1,9 @@ - + sqlite_create_aggregate + SQLiteDatabase->createAggregate Register an aggregating UDF for use in SQL statements @@ -15,6 +16,17 @@ callbackfinalize_func intnum_args + Object oriented style (method): + + SQLiteDatabase + + boolcreateAggregate + stringfunction_name + callbackstep_func + callbackfinalize_func + intnum_args + + sqlite_create_aggregate is similar to sqlite_create_function except that it registers diff --git a/reference/sqlite/functions/sqlite-create-function.xml b/reference/sqlite/functions/sqlite-create-function.xml index 2ac234ec88..67c70053c4 100644 --- a/reference/sqlite/functions/sqlite-create-function.xml +++ b/reference/sqlite/functions/sqlite-create-function.xml @@ -1,8 +1,9 @@ - + sqlite_create_function + SQLiteDatabase->createFunction Registers a "regular" User Defined Function for use in SQL statements @@ -16,6 +17,16 @@ callbackcallback intnum_args + Object oriented style (method): + + SQLiteDatabase + + boolcreateFunction + stringfunction_name + callbackcallback + intnum_args + + sqlite_create_function allows you to register a PHP function with SQLite as an UDF (User Defined diff --git a/reference/sqlite/functions/sqlite-current.xml b/reference/sqlite/functions/sqlite-current.xml index f94772be68..5ea6db58b0 100644 --- a/reference/sqlite/functions/sqlite-current.xml +++ b/reference/sqlite/functions/sqlite-current.xml @@ -1,8 +1,10 @@ - + sqlite_current + SQLiteResult->current + SQLiteUnbuffered->current Fetches the current row from a result set as an array @@ -13,6 +15,23 @@ intresult_type booldecode_binary + Object oriented style (method): + + SQLiteResult + + arraycurrent + intresult_type + booldecode_binary + + + + SQLiteUnbuffered + + arraycurrent + intresult_type + booldecode_binary + + sqlite_current is identical to sqlite_fetch_array except that it does not advance @@ -23,9 +42,9 @@ If the current position is beyond the final row, this function returns &false; - - &sqlite.no-unbuffered; - + &sqlite.result-type; + &sqlite.case-fold; + &sqlite.decode-bin; See also sqlite_seek, sqlite_next, and diff --git a/reference/sqlite/functions/sqlite-exec.xml b/reference/sqlite/functions/sqlite-exec.xml index 7aba9c7d41..959f5586fa 100644 --- a/reference/sqlite/functions/sqlite-exec.xml +++ b/reference/sqlite/functions/sqlite-exec.xml @@ -1,11 +1,10 @@ - + sqlite_exec - - Executes a result-less query against a given database - + SQLiteDatabase->exec + Executes a result-less query against a given database Description @@ -19,6 +18,14 @@ stringquery resourcedbhandle + Object oriented style (method): + + SQLiteDatabase + + boolexec + stringquery + + Executes an SQL statement given by the query against a given database handle (specified by the dbhandle @@ -28,15 +35,6 @@ This function will return a boolean result; &true; for success or &false; for failure. If you need to run a query that returns rows, see sqlite_query. - - - Two alternative syntaxes are supported for compatibility with other - database extensions (such as MySQL). - The preferred form is the first one, where the - db parameter is the first parameter to the - function. - - SQLite will execute multiple queries separated by @@ -44,8 +42,10 @@ loaded from a file or have embedded in a script. + &sqlite.param-compat; - See also sqlite_query, sqlite_unbuffered_query and + See also sqlite_query, + sqlite_unbuffered_query and sqlite_array_query. diff --git a/reference/sqlite/functions/sqlite-factory.xml b/reference/sqlite/functions/sqlite-factory.xml index 9d104a7995..d2494b63b3 100755 --- a/reference/sqlite/functions/sqlite-factory.xml +++ b/reference/sqlite/functions/sqlite-factory.xml @@ -1,23 +1,30 @@ - + sqlite_factory - - Opens a SQLite database and creates an object for it - + Opens a SQLite database and returns an SQLiteDatabase object Description - SQLitesqlite_factory + SQLiteDatabasesqlite_factory stringfilename intmode stringerror_message - - &warn.undocumented.func; - + + 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 procedural resource. Please see the + sqlite_open reference page for usage and caveats. + + + See also sqlite_open and + sqlite_popen. + diff --git a/reference/sqlite/functions/sqlite-fetch-all.xml b/reference/sqlite/functions/sqlite-fetch-all.xml index fdc9cd3b48..c41b927442 100755 --- a/reference/sqlite/functions/sqlite-fetch-all.xml +++ b/reference/sqlite/functions/sqlite-fetch-all.xml @@ -1,11 +1,11 @@ - + sqlite_fetch_all - - Fetches all rows from a result set as an array of arrays - + SQLiteResult->fetchAll + SQLiteUnbuffered->fetchAll + Fetches all rows from a result set as an array of arrays Description @@ -15,6 +15,23 @@ intresult_type booldecode_binary + Object oriented style (method): + + SQLiteResult + + arrayfetchAll + intresult_type + booldecode_binary + + + + SQLiteUnbuffered + + arrayfetchAll + intresult_type + booldecode_binary + + &warn.undocumented.func; diff --git a/reference/sqlite/functions/sqlite-fetch-array.xml b/reference/sqlite/functions/sqlite-fetch-array.xml index 85ee60c57a..84ab95fda7 100644 --- a/reference/sqlite/functions/sqlite-fetch-array.xml +++ b/reference/sqlite/functions/sqlite-fetch-array.xml @@ -1,8 +1,10 @@ - + sqlite_fetch_array + SQLiteResult->fetch + SQLiteUnbuffered->fetch Fetches the next row from a result set as an array @@ -13,34 +15,31 @@ intresult_type booldecode_binary + Object oriented style (method): + + SQLiteResult + + arrayfetch + intresult_type + booldecode_binary + + + + SQLiteUnbuffered + + arrayfetch + intresult_type + booldecode_binary + + Fetches the next row from the given result handle. If there are no more rows, returns &false;, otherwise returns an associative array representing the row data. - - result_type can be used to specify how you want - the results to be returned. The default value is - SQLITE_BOTH which returns columns indexed by their - ordinal column number and by column name. - SQLITE_ASSOC causes the array to be indexed only by - column names, and SQLITE_NUM to be indexed only by - ordinal column numbers. - - - The column names returned by SQLITE_ASSOC and - SQLITE_BOTH will be case-folded according to the value - of the sqlite.assoc_case - configuration option. - - - When decode_binary is set to &true; (the default), - PHP will decode the binary encoding it applied to the data if it - was encoded using the sqlite_escape_string. You - will usually always leave this value at its default, unless you are - interoperating with databases created by other sqlite capable - applications. - + &sqlite.result-type; + &sqlite.case-fold; + &sqlite.decode-bin; See also sqlite_array_query and sqlite_fetch_string. diff --git a/reference/sqlite/functions/sqlite-fetch-column-types.xml b/reference/sqlite/functions/sqlite-fetch-column-types.xml index 75e2c6d6d9..ba6e2374ce 100755 --- a/reference/sqlite/functions/sqlite-fetch-column-types.xml +++ b/reference/sqlite/functions/sqlite-fetch-column-types.xml @@ -1,8 +1,9 @@ - + sqlite_fetch_column_types + SQLiteDatabase->fetchColumnTypes Return an array of column types from a particular table @@ -10,14 +11,64 @@ Description - resourcesqlite_fetch_column_types + arraysqlite_fetch_column_types stringtable_name - resourcedb - intresult_type + resourcedbhandle + intresult_type + Object oriented style (method): + + SQLiteDatabase + + arrayfetchColumnTypes + stringtable_name + intresult_type + + + + sqlite_fetch_column_types returns an array of column + data types from the specified table_name table. + + + The optional result_type parameter accepts a + constant and determines how the returned array will be indexed. Using + SQLITE_ASSOC will return only associative indices + (named fields) while SQLITE_NUM will return only + numerical indices (ordinal field numbers). SQLITE_BOTH + will return both associative and numerical indices. + SQLITE_ASSOC is the default for this function. + + &sqlite.case-fold; + + + <function>sqlite_fetch_column_types</function> example + + $type) { + echo "Column: $column Type: $type"; +} +/* Output: + * Column: bar Type: VARCHAR + * Column: arf Type: TEXT +*/ +/* OO Example */ +$db =& new SQLiteDatabase('mysqlitedb'); +$db->query('CREATE TABLE foo (bar varchar(10), arf text)'); +$cols = $db->fetchColumnTypes('foo', SQLITE_ASSOC); + +foreach ($cols as $column => $type) { + echo "Column: $column Type: $type"; +} +?]]> + + + diff --git a/reference/sqlite/functions/sqlite-fetch-object.xml b/reference/sqlite/functions/sqlite-fetch-object.xml index 4b23fc2ff2..6a57b0570a 100755 --- a/reference/sqlite/functions/sqlite-fetch-object.xml +++ b/reference/sqlite/functions/sqlite-fetch-object.xml @@ -1,11 +1,11 @@ - + sqlite_fetch_object - - Fetches the next row from a result set as an object - + SQLiteResult->fetchObject + SQLiteUnbuffered->fetchObject + Fetches the next row from a result set as an object Description @@ -16,7 +16,26 @@ arrayctor_params booldecode_binary - + Object oriented style (method): + + SQLiteResult + + objectfetchObject + stringclass_name + arrayctor_params + booldecode_binary + + + + SQLiteUnbuffered + + objectfetchObject + stringclass_name + arrayctor_params + booldecode_binary + + + &warn.undocumented.func; diff --git a/reference/sqlite/functions/sqlite-fetch-single.xml b/reference/sqlite/functions/sqlite-fetch-single.xml index 8b5a4a143a..5c219ed859 100644 --- a/reference/sqlite/functions/sqlite-fetch-single.xml +++ b/reference/sqlite/functions/sqlite-fetch-single.xml @@ -1,8 +1,10 @@ - + sqlite_fetch_single + SQLiteResult->fetchSingle + SQLiteUnbuffered->fetchSingle Fetches the first column of a result set as a string @@ -12,6 +14,21 @@ resourceresult booldecode_binary + Object oriented style (method): + + SQLiteResult + + stringfetchSingle + booldecode_binary + + + + SQLiteUnbuffered + + stringfetchSingle + booldecode_binary + + sqlite_fetch_single is identical to sqlite_fetch_array except that it returns the value @@ -21,6 +38,7 @@ This is the most optimal way to retrieve data when you are only interested in the values from a single column of data. + &sqlite.decode-bin; A <function>sqlite_fetch_single</function> example diff --git a/reference/sqlite/functions/sqlite-field-name.xml b/reference/sqlite/functions/sqlite-field-name.xml index c32bc34fa2..16f3f8e97a 100644 --- a/reference/sqlite/functions/sqlite-field-name.xml +++ b/reference/sqlite/functions/sqlite-field-name.xml @@ -1,8 +1,10 @@ - + sqlite_field_name + SQLiteResult->fieldName + SQLiteUnbuffered->fieldName Returns the name of a particular field @@ -12,10 +14,31 @@ resourceresult intfield_index + Object oriented style (method): + + SQLiteResult + + stringfieldName + intfield_index + + + + SQLiteUnbuffered + + stringfieldName + intfield_index + + - Given the ordinal column number, field_index, returns - the name of that field in the result handle - result. + Given the ordinal column number, field_index, + sqlite_field_name returns the name of that field in + the result set result. + + + The column name returned by sqlite_field_name will be + case-folded according to the value of the + sqlite.assoc_case configuration + option. diff --git a/reference/sqlite/functions/sqlite-has-prev.xml b/reference/sqlite/functions/sqlite-has-prev.xml index 62507f2808..dcc07c8ed9 100644 --- a/reference/sqlite/functions/sqlite-has-prev.xml +++ b/reference/sqlite/functions/sqlite-has-prev.xml @@ -1,8 +1,9 @@ - + sqlite_has_prev + SQLiteResult->hasPrev Returns whether or not a previous row is available @@ -11,14 +12,20 @@ boolsqlite_has_prev resourceresult + Object oriented style (method): + + SQLiteResult + + boolhasPrev + + + sqlite_has_prev returns &true; if there are more previous rows available from the result handle, or &false; otherwise; - &sqlite.no-unbuffered; - See also sqlite_prev, diff --git a/reference/sqlite/functions/sqlite-key.xml b/reference/sqlite/functions/sqlite-key.xml new file mode 100755 index 0000000000..37cfff48d4 --- /dev/null +++ b/reference/sqlite/functions/sqlite-key.xml @@ -0,0 +1,61 @@ + + + + + sqlite_key + SQLiteResult->key + Returns the current row index + + + Description + + intsqlite_key + resourceresult + + Object oriented style (method): + + SQLiteResult + + intkey + + + + + sqlite_key returns the current row index of the + buffered result set result. + + &sqlite.no-unbuffered; + + + Prior to PHP 5.0.4, sqlite_key was only able to be + called as a method on a + SQLiteResult object and + not procedurally. + + + + See also sqlite_next, + sqlite_current and + sqlite_rewind. + + + + diff --git a/reference/sqlite/functions/sqlite-last-error.xml b/reference/sqlite/functions/sqlite-last-error.xml index 1503065d92..af0db4b142 100644 --- a/reference/sqlite/functions/sqlite-last-error.xml +++ b/reference/sqlite/functions/sqlite-last-error.xml @@ -1,8 +1,9 @@ - + sqlite_last_error + SQLiteDatabase->lastError Returns the error code of the last error for a database @@ -11,6 +12,14 @@ intsqlite_last_error resourcedbhandle + Object oriented style (method): + + SQLiteDatabase + + intlastError + + + Returns the error code from the last operation performed on dbhandle, the database handle. A human readable diff --git a/reference/sqlite/functions/sqlite-last-insert-rowid.xml b/reference/sqlite/functions/sqlite-last-insert-rowid.xml index 3ce89da139..3d0c57b2f1 100644 --- a/reference/sqlite/functions/sqlite-last-insert-rowid.xml +++ b/reference/sqlite/functions/sqlite-last-insert-rowid.xml @@ -1,8 +1,9 @@ - + sqlite_last_insert_rowid + SQLiteDatabase->lastInsertRowid Returns the rowid of the most recently inserted row @@ -11,6 +12,14 @@ intsqlite_last_insert_rowid resourcedbhandle + Object oriented style (method): + + SQLiteDatabase + + intlastInsertRowid + + + Returns the rowid of the row that was most recently inserted into the database dbhandle, if it was created as an diff --git a/reference/sqlite/functions/sqlite-next.xml b/reference/sqlite/functions/sqlite-next.xml index 7a051dbd8b..ee36a4f546 100644 --- a/reference/sqlite/functions/sqlite-next.xml +++ b/reference/sqlite/functions/sqlite-next.xml @@ -1,8 +1,10 @@ - + sqlite_next + SQLiteResult->next + SQLiteUnbuffered->next Seek to the next row number @@ -11,14 +13,26 @@ boolsqlite_next resourceresult + Object oriented style (method): + + SQLiteResult + + boolnext + + + + + SQLiteUnbuffered + + boolnext + + + sqlite_next advances the result handle result to the next row. Returns &false; if there are no more rows, &true; otherwise. - - &sqlite.no-unbuffered; - See also sqlite_seek, sqlite_current and diff --git a/reference/sqlite/functions/sqlite-num-fields.xml b/reference/sqlite/functions/sqlite-num-fields.xml index 0e6e0b2fa7..10d7ce5688 100644 --- a/reference/sqlite/functions/sqlite-num-fields.xml +++ b/reference/sqlite/functions/sqlite-num-fields.xml @@ -1,8 +1,10 @@ - + sqlite_num_fields + SQLiteResult->numFields + SQLiteUnbuffered->numFields Returns the number of fields in a result set @@ -11,6 +13,21 @@ intsqlite_num_fields resourceresult + Object oriented style (method): + + SQLiteResult + + intnumFields + + + + + SQLiteUnbuffered + + intnumFields + + + Returns the number of fields in the result set. diff --git a/reference/sqlite/functions/sqlite-num-rows.xml b/reference/sqlite/functions/sqlite-num-rows.xml index d743cc5a45..95e8ad522f 100644 --- a/reference/sqlite/functions/sqlite-num-rows.xml +++ b/reference/sqlite/functions/sqlite-num-rows.xml @@ -1,8 +1,9 @@ - + sqlite_num_rows + SQLiteResult->numRows Returns the number of rows in a buffered result set @@ -11,13 +12,19 @@ intsqlite_num_rows resourceresult + Object oriented style (method): + + SQLiteResult + + intnumRows + + + Returns the number of rows in the buffered result - set. + set. - &sqlite.no-unbuffered; - See also sqlite_changes and sqlite_query. diff --git a/reference/sqlite/functions/sqlite-open.xml b/reference/sqlite/functions/sqlite-open.xml index 1417523905..ac583141cf 100644 --- a/reference/sqlite/functions/sqlite-open.xml +++ b/reference/sqlite/functions/sqlite-open.xml @@ -1,5 +1,5 @@ - + sqlite_open @@ -13,6 +13,16 @@ intmode stringerror_message + Object oriented style (constructor): + + SQLiteDatabase + + __construct + stringfilename + intmode + stringerror_message + + Returns a resource (database handle) on success, &false; on error. diff --git a/reference/sqlite/functions/sqlite-prev.xml b/reference/sqlite/functions/sqlite-prev.xml index a02d1d38eb..9e77189e53 100644 --- a/reference/sqlite/functions/sqlite-prev.xml +++ b/reference/sqlite/functions/sqlite-prev.xml @@ -1,8 +1,9 @@ - + sqlite_prev + SQLiteResult->prev Seek to the previous row number of a result set @@ -11,14 +12,20 @@ boolsqlite_prev resourceresult + Object oriented style (method): + + SQLiteResult + + boolprev + + + sqlite_prev seeks back the result handle to the previous row. Returns &false; if there are no more rows, &true; otherwise. - &sqlite.no-unbuffered; - See also sqlite_has_prev, diff --git a/reference/sqlite/functions/sqlite-query.xml b/reference/sqlite/functions/sqlite-query.xml index 0e5023d066..d7035e0a32 100644 --- a/reference/sqlite/functions/sqlite-query.xml +++ b/reference/sqlite/functions/sqlite-query.xml @@ -1,11 +1,10 @@ - + sqlite_query - - Executes a query against a given database and returns a result handle - + SQLiteDatabase->query + Executes a query against a given database and returns a result handle Description @@ -19,6 +18,14 @@ stringquery resourcedbhandle + Object oriented style (method): + + SQLiteDatabase + + SQLiteResultquery + stringquery + + Executes an SQL statement given by the query against a given database handle (specified by the dbhandle @@ -43,15 +50,7 @@ recommended that you use the much higher performance sqlite_unbuffered_query instead. - - - Two alternative syntaxes are supported for compatibility with other - database extensions (such as MySQL). - The preferred form is the first one, where the - dbhandle parameter is the first parameter to the - function. - - + &sqlite.param-compat; SQLite will execute multiple queries separated by diff --git a/reference/sqlite/functions/sqlite-rewind.xml b/reference/sqlite/functions/sqlite-rewind.xml index a78ef65bdf..ef260cff01 100644 --- a/reference/sqlite/functions/sqlite-rewind.xml +++ b/reference/sqlite/functions/sqlite-rewind.xml @@ -1,8 +1,9 @@ - + sqlite_rewind + SQLiteResult->rewind Seek to the first row number @@ -11,14 +12,20 @@ boolsqlite_rewind resourceresult + Object oriented style (method): + + SQLiteResult + + boolrewind + + + sqlite_rewind seeks back to the first row in the result set. Returns &false; if there are no rows in the result set, &true; otherwise. - &sqlite.no-unbuffered; - See also sqlite_next, sqlite_current, and diff --git a/reference/sqlite/functions/sqlite-seek.xml b/reference/sqlite/functions/sqlite-seek.xml index c63c19f208..c536d48622 100644 --- a/reference/sqlite/functions/sqlite-seek.xml +++ b/reference/sqlite/functions/sqlite-seek.xml @@ -1,8 +1,9 @@ - + sqlite_seek + SQLiteResult->seek Seek to a particular row number of a buffered result set @@ -12,14 +13,20 @@ resourceresult intrownum + Object oriented style (method): + + SQLiteResult + + boolseek + intrownum + + sqlite_seek seeks to the row given by the parameter rownum. The row number is zero-based (0 is the first row). Returns &false; if the row does not exist, &true; otherwise. - &sqlite.no-unbuffered; - See also sqlite_next, sqlite_current and diff --git a/reference/sqlite/functions/sqlite-single-query.xml b/reference/sqlite/functions/sqlite-single-query.xml index 0c7bf12095..eb7ae27003 100755 --- a/reference/sqlite/functions/sqlite-single-query.xml +++ b/reference/sqlite/functions/sqlite-single-query.xml @@ -1,8 +1,9 @@ - + sqlite_single_query + SQLiteDatabase->singleQuery Executes a query and returns either an array for one single column or the value of the first row @@ -16,6 +17,16 @@ boolfirst_row_only booldecode_binary + Object oriented style (method): + + SQLiteDatabase + + mixedsingleQuery + stringquery + boolfirst_row_only + booldecode_binary + + &warn.undocumented.func; diff --git a/reference/sqlite/functions/sqlite-unbuffered-query.xml b/reference/sqlite/functions/sqlite-unbuffered-query.xml index 06808bcd94..30c09cb8e6 100644 --- a/reference/sqlite/functions/sqlite-unbuffered-query.xml +++ b/reference/sqlite/functions/sqlite-unbuffered-query.xml @@ -1,8 +1,9 @@ - + sqlite_unbuffered_query + SQLiteDatabase->unbufferedQuery Execute a query that does not prefetch and buffer all data @@ -17,6 +18,14 @@ stringquery resourcedbhandle + Object oriented style (method): + + SQLiteDatabase + + SQLiteUnbufferedunbufferedQuery + stringquery + + sqlite_unbuffered_query is identical to sqlite_query except that the result that is returned @@ -37,6 +46,7 @@ returned from sqlite_unbuffered_query. + &sqlite.param-compat; See also sqlite_query. diff --git a/reference/sqlite/functions/sqlite-valid.xml b/reference/sqlite/functions/sqlite-valid.xml index ff29d1f116..d981981356 100755 --- a/reference/sqlite/functions/sqlite-valid.xml +++ b/reference/sqlite/functions/sqlite-valid.xml @@ -1,8 +1,10 @@ - + sqlite_valid + SQLiteResult->valid + SQLiteUnbuffered->valid Returns whether more rows are available @@ -11,9 +13,30 @@ boolsqlite_valid resourceresult - - &warn.undocumented.func; - + Object oriented style (method): + + SQLiteResult + + boolvalid + + + + + SQLiteUnbuffered + + boolvalid + + + + + sqlite_valid returns &true; if there are more + rows available from the result handle, or &false; + otherwise. + + + See also sqlite_num_rows and + sqlite_changes. + + SQLite SQLite @@ -61,6 +61,170 @@ &reference.sqlite.constants; + +
+ &reftitle.classes; + +
+ <classname>SQLiteDatabase</classname> + + Represents an opened SQLite database. + +
+ &reftitle.constructor; + + + __construct - construct a new SQLiteDatabase object + + +
+
+ &reftitle.methods; + + + query - Execute a query + + + queryExec - Execute a result-less query + + + arrayQuery - Execute a query and return the result as an array + + + singleQuery - Execute a query and return either an array for one single column or the value of the first row + + + unbufferedQuery - Execute an unbuffered query + + + lastInsertRowid - Returns the rowid of the most recently inserted row + + + changes - Returns the number of rows changed by the most recent statement + + + createAggregate - Register an aggregating UDF for use in SQL statements + + + createFunction - Register a UDF for use in SQL statements + + + busyTimeout - Sets or disables busy timeout duration + + + lastErorr - Returns the last error code of the most recently encountered error + + + fetchColumnTypes - Return an array of column types from a particular table + + +
+
+ +
+ <classname>SQLiteResult</classname> + + Represents a buffered SQLite result set. + +
+ &reftitle.methods; + + + fetch - Fetches the next row from the result set as an array + + + fetchObject - Fetches the next row from the result set as an object + + + fetchSingle - Fetches the first column from the result set as a string + + + fetchAll - Fetches all rows from the result set as an array of arrays + + + column - Fetches a column from the current row of the result set + + + numFields - Returns the number of fields in the result set + + + fieldName - Returns the name of a particular field in the result set + + + current - Fetches the current row from the result set as an array + + + key - Return the current row index + + + next - Seek to the next row number + + + valid - Returns whether more rows are available + + + rewind - Seek to the first row number of the result set + + + prev - Seek to the previous row number of the result set + + + hasPrev - Returns whether or not a previous row is available + + + numRows - Returns the number of rows in the result set + + + seek - Seek to a particular row number + + +
+
+ +
+ <classname>SQLiteUnbuffered</classname> + + Represents an unbuffered SQLite result set. Unbuffered results sets are sequential, foward-seeking only. + +
+ &reftitle.methods; + + + fetch - Fetches the next row from the result set as an array + + + fetchObject - Fetches the next row from the result set as an object + + + fetchSingle - Fetches the first column from the result set as a string + + + fetchAll - Fetches all rows from the result set as an array of arrays + + + column - Fetches a column from the current row of the result set + + + numFields - Returns the number of fields in the result set + + + fieldName - Returns the name of a particular field in the result set + + + current - Fetches the current row from the result set as an array + + + next - Seek to the next row number + + + valid - Returns whether more rows are available + + +
+
+ +
+ &reference.sqlite.ini;