diff --git a/reference/sqlite/functions/sqlite-array-query.xml b/reference/sqlite/functions/sqlite-array-query.xml index 957105abc3..cecd42e613 100644 --- a/reference/sqlite/functions/sqlite-array-query.xml +++ b/reference/sqlite/functions/sqlite-array-query.xml @@ -1,9 +1,9 @@ - + sqlite_array_query - Execute a query against a given database and returns an array + Execute a query against a given database and returns an array. Description @@ -25,13 +25,15 @@ <function>sqlite_array_query</function> implemented yourself -]]> +?> +]]> @@ -43,6 +45,11 @@ while ($r = sqlite_fetch_array($q)) { performance. + + See also sqlite_query, + sqlite_fetch_array, and + sqlite_fetch_string. + + sqlite_busy_timeout - Set busy timeout duration, or disable busy handlers + Set busy timeout duration, or disable busy handlers. Description @@ -23,7 +23,12 @@ PHP sets the default busy timeout to be 60 seconds when the database is opened. - + + + + There are one thousand (1000) milliseconds in one second. + + + sqlite_changes - Returns the number of rows that were changed by the most recent SQL statement + + Returns the number of rows that were changed by the most + recent SQL statement. + Description @@ -15,6 +18,9 @@ Returns the numbers of rows that were changed by the most recent SQL statement executed against the database db. + + See also sqlite_num_rows. + + sqlite_column - Fetches a column from the current row of a result set + Fetches a column from the current row of a result set. Description @@ -25,6 +25,9 @@ Use this function when you are iterating a large result set with many columns, or with columns that contain large amounts of data. + + See also sqlite_fetch_string. + + sqlite_create_aggregate - Register an aggregating UDF for use in SQL statements + Register an aggregating UDF for use in SQL statements. Description @@ -52,25 +52,26 @@ $data = array( $db = sqlite_open(':memory:'); sqlite_query($db, "CREATE TABLE strings(a)"); foreach ($data as $str) { - sqlite_query($db, "INSERT INTO strings VALUES('" . - sqlite_escape_string($str) . "')"); + $str = sqlite_escape_string($str); + sqlite_query($db, "INSERT INTO strings VALUES ('$str')"); } function max_len_step(&$context, $string) { - if (strlen($string) > $context) { - $context = strlen($string); - } + if (strlen($string) > $context) { + $context = strlen($string); + } } function max_len_finalize(&$context) { - return $context; + return $context; } sqlite_create_aggregate($db, 'max_len', 'max_len_step', 'max_len_finalize'); var_dump(sqlite_array_query($db, 'SELECT max_len(a) from strings')); -?>]]> +?> +]]> diff --git a/reference/sqlite/functions/sqlite-create-function.xml b/reference/sqlite/functions/sqlite-create-function.xml index 8d1b371741..c0cac6044b 100644 --- a/reference/sqlite/functions/sqlite-create-function.xml +++ b/reference/sqlite/functions/sqlite-create-function.xml @@ -1,9 +1,11 @@ - + sqlite_create_function - Registers a "regular" User Defined Function for use in SQL statements + + Registers a "regular" User Defined Function for use in SQL statements. + Description @@ -35,7 +37,6 @@ The UDF can be used in any SQL statement that can call functions, such as SELECT and UPDATE statements and also in triggers. - <function>sqlite_create_function</function> example @@ -49,7 +50,8 @@ function md5_and_reverse($string) { sqlite_create_function($db, 'md5rev', 'md5_and_reverse', 1); $rows = sqlite_array_query($db, 'SELECT md5rev(filename) from files'); -?>]]> +?> +]]> @@ -63,7 +65,6 @@ $rows = sqlite_array_query($db, 'SELECT md5rev(filename) from files'); The beauty of this technique is that you do not need to process the result using a foreach() loop after you have queried for the data. - PHP registers a special function named php when the database is first opened. The php function can be used to call any PHP @@ -76,7 +77,8 @@ $rows = sqlite_array_query($db, 'SELECT md5rev(filename) from files'); ]]> +?> +]]> This example will call the md5 on each diff --git a/reference/sqlite/functions/sqlite-current.xml b/reference/sqlite/functions/sqlite-current.xml index 52c9ba72eb..0d6ffdedb6 100644 --- a/reference/sqlite/functions/sqlite-current.xml +++ b/reference/sqlite/functions/sqlite-current.xml @@ -1,9 +1,9 @@ - + sqlite_current - Fetches the current row from a result set as an array + Fetches the current row from a result set as an array. Description @@ -30,7 +30,8 @@ See also sqlite_seek, - sqlite_next. + sqlite_next, and + sqlite_fetch_array. diff --git a/reference/sqlite/functions/sqlite-error-string.xml b/reference/sqlite/functions/sqlite-error-string.xml index 2c73ee1a1e..dfe5887cca 100644 --- a/reference/sqlite/functions/sqlite-error-string.xml +++ b/reference/sqlite/functions/sqlite-error-string.xml @@ -1,9 +1,9 @@ - + sqlite_error_string - Returns the textual description of an error code + Returns the textual description of an error code. Description diff --git a/reference/sqlite/functions/sqlite-escape-string.xml b/reference/sqlite/functions/sqlite-escape-string.xml index 22f819a61e..bf804a00ee 100644 --- a/reference/sqlite/functions/sqlite-escape-string.xml +++ b/reference/sqlite/functions/sqlite-escape-string.xml @@ -1,5 +1,5 @@ - + sqlite_escape_string @@ -47,6 +47,9 @@ sqlite_udf_encode_binary instead. + + See also sqlite_udf_encode_binary. + + sqlite_fetch_string - Fetches first column of a result set as a string. + Fetches the first column of a result set as a string. Description @@ -22,6 +22,9 @@ This is the most optimial way to retrieve data when you are only interested in the values from a single column of data. + + See also sqlite_fetch_array. + + sqlite_field_name - Returns the name of a particular field + Returns the name of a particular field. Description diff --git a/reference/sqlite/functions/sqlite-has-more.xml b/reference/sqlite/functions/sqlite-has-more.xml index 0502b44e3b..bf72fea5f2 100644 --- a/reference/sqlite/functions/sqlite-has-more.xml +++ b/reference/sqlite/functions/sqlite-has-more.xml @@ -1,9 +1,9 @@ - + sqlite_has_more - Returns whether or not more rows are available + Returns whether or not more rows are available. Description @@ -16,6 +16,10 @@ rows available from the result handle, or &false; otherwise. + + See also sqlite_num_rows and + sqlite_changes. + + sqlite_last_error - Returns the error code of the last error for a database + Returns the error code of the last error for a database. Description @@ -13,7 +13,9 @@ Returns the error code from the last operation performed on - db, the database handle. + db, the database handle. A human readable + description of the error code can be retrieved using + sqlite_error_string. See also sqlite_error_string. diff --git a/reference/sqlite/functions/sqlite-last-insert-rowid.xml b/reference/sqlite/functions/sqlite-last-insert-rowid.xml index 64957b2dd7..d915052d01 100644 --- a/reference/sqlite/functions/sqlite-last-insert-rowid.xml +++ b/reference/sqlite/functions/sqlite-last-insert-rowid.xml @@ -1,9 +1,9 @@ - + sqlite_last_insert_rowid - Returns the rowid of the most recently inserted row + Returns the rowid of the most recently inserted row. Description diff --git a/reference/sqlite/functions/sqlite-libencoding.xml b/reference/sqlite/functions/sqlite-libencoding.xml index 6d9deb7bb2..3833a9e175 100644 --- a/reference/sqlite/functions/sqlite-libencoding.xml +++ b/reference/sqlite/functions/sqlite-libencoding.xml @@ -1,9 +1,9 @@ - + sqlite_libencoding - Returns the encoding of the linked SQLite library + Returns the encoding of the linked SQLite library. Description diff --git a/reference/sqlite/functions/sqlite-libversion.xml b/reference/sqlite/functions/sqlite-libversion.xml index ec19cfae2a..e63030ab33 100644 --- a/reference/sqlite/functions/sqlite-libversion.xml +++ b/reference/sqlite/functions/sqlite-libversion.xml @@ -1,9 +1,9 @@ - + sqlite_libversion - Returns the version of the linked SQLite library + Returns the version of the linked SQLite library. Description diff --git a/reference/sqlite/functions/sqlite-next.xml b/reference/sqlite/functions/sqlite-next.xml index 325312124a..a7ae685ee6 100644 --- a/reference/sqlite/functions/sqlite-next.xml +++ b/reference/sqlite/functions/sqlite-next.xml @@ -1,9 +1,9 @@ - + sqlite_next - Seek to next row number + Seek to the next row number. Description diff --git a/reference/sqlite/functions/sqlite-num-fields.xml b/reference/sqlite/functions/sqlite-num-fields.xml index 3122f3292c..8b224eec22 100644 --- a/reference/sqlite/functions/sqlite-num-fields.xml +++ b/reference/sqlite/functions/sqlite-num-fields.xml @@ -1,9 +1,9 @@ - + sqlite_num_fields - Returns the number of fields in a result set + Returns the number of fields in a result set. Description @@ -14,6 +14,10 @@ Returns the number of fields in the result set. + + See also sqlite_column and + sqlite_num_rows. + + sqlite_num_rows - Returns the number of rows in a result set + Returns the number of rows in a buffered result set. Description @@ -12,13 +12,18 @@ resourceresult - Returns the number of rows in the result set. + Returns the number of rows in the buffered result + set. This function cannot be used with unbuffered result sets. + + See also sqlite_changes and + sqlite_query. + + sqlite_open @@ -11,7 +11,7 @@ resourcesqlite_open stringfilename intmode - string&errmessage + string&error_message Returns a resource on success, &false; on error. @@ -44,12 +44,12 @@ ]]> @@ -60,9 +60,9 @@ if ($db = sqlite_open('mysqlitedb', 0666, $sqliteerror)) { On Unix platforms, SQLite is sensitive to scripts that use the fork() system call. If you do have such a script, it is recommended that you close the handle prior to forking and then re-open it in the child and/or parent. - For more information on this issue, see The C language interface - to the SQLite library in the section entitled + For more information on this issue, see + The C language interface + to the SQLite library in the section entitled Multi-Threading And SQLite. diff --git a/reference/sqlite/functions/sqlite-popen.xml b/reference/sqlite/functions/sqlite-popen.xml index b79b047b09..40adb22596 100644 --- a/reference/sqlite/functions/sqlite-popen.xml +++ b/reference/sqlite/functions/sqlite-popen.xml @@ -1,9 +1,12 @@ - + sqlite_popen - Opens a persistent handle to an SQLite database. Will create the database if it does not exist + + Opens a persistent handle to an SQLite database. Will create the + database if it does not exist. + Description @@ -11,7 +14,7 @@ resourcesqlite_popen stringfilename intmode - string&errmessage + string&error_message This function behaves identically to sqlite_open diff --git a/reference/sqlite/functions/sqlite-query.xml b/reference/sqlite/functions/sqlite-query.xml index 27cf395386..c092e82952 100644 --- a/reference/sqlite/functions/sqlite-query.xml +++ b/reference/sqlite/functions/sqlite-query.xml @@ -1,9 +1,11 @@ - + sqlite_query - Executes a query against a given database and returns a result handle + + Executes a query against a given database and returns a result handle. + Description @@ -66,7 +68,8 @@ - See also sqlite_array_query. + See also sqlite_unbuffered_query and + sqlite_array_query. diff --git a/reference/sqlite/functions/sqlite-rewind.xml b/reference/sqlite/functions/sqlite-rewind.xml index 279ea5c90b..c9b2c64dd7 100644 --- a/reference/sqlite/functions/sqlite-rewind.xml +++ b/reference/sqlite/functions/sqlite-rewind.xml @@ -1,9 +1,9 @@ - + sqlite_rewind - Seek to the first row number + Seek to the first row number. Description @@ -23,7 +23,8 @@ See also sqlite_next, - sqlite_current and sqlite_seek. + sqlite_current, and + sqlite_seek. diff --git a/reference/sqlite/functions/sqlite-seek.xml b/reference/sqlite/functions/sqlite-seek.xml index eb030bb0cc..435ba90bc2 100644 --- a/reference/sqlite/functions/sqlite-seek.xml +++ b/reference/sqlite/functions/sqlite-seek.xml @@ -1,9 +1,9 @@ - + sqlite_seek - Seek to a particular row number + Seek to a particular row number of a buffered result set. Description diff --git a/reference/sqlite/functions/sqlite-udf-decode-binary.xml b/reference/sqlite/functions/sqlite-udf-decode-binary.xml index 0e1f5f9cee..d97eb58bc8 100644 --- a/reference/sqlite/functions/sqlite-udf-decode-binary.xml +++ b/reference/sqlite/functions/sqlite-udf-decode-binary.xml @@ -1,9 +1,9 @@ - + sqlite_udf_decode_binary - Decode binary data passed as parameters to an UDF + Decode binary data passed as parameters to an UDF. Description @@ -47,26 +47,27 @@ $data = array( $db = sqlite_open(':memory:'); sqlite_query($db, "CREATE TABLE strings(a)"); foreach ($data as $str) { - sqlite_query($db, "INSERT INTO strings VALUES('" . - sqlite_escape_string($str) . "')"); + $str = sqlite_escape_string($str); + sqlite_query($db, "INSERT INTO strings VALUES ('$str')"); } function max_len_step(&$context, $string) { - $string = sqlite_udf_decode_binary($string); - if (strlen($string) > $context) { - $context = strlen($string); - } + $string = sqlite_udf_decode_binary($string); + if (strlen($string) > $context) { + $context = strlen($string); + } } function max_len_finalize(&$context) { - return $context; + return $context; } sqlite_create_aggregate($db, 'max_len', 'max_len_step', 'max_len_finalize'); var_dump(sqlite_array_query($db, 'SELECT max_len(a) from strings')); -?>]]> +?> +]]> diff --git a/reference/sqlite/functions/sqlite-udf-encode-binary.xml b/reference/sqlite/functions/sqlite-udf-encode-binary.xml index cca29b3e71..e736472fd6 100644 --- a/reference/sqlite/functions/sqlite-udf-encode-binary.xml +++ b/reference/sqlite/functions/sqlite-udf-encode-binary.xml @@ -1,9 +1,9 @@ - + sqlite_udf_encode_binary - Encode binary data before returning it from an UDF + Encode binary data before returning it from an UDF. Description @@ -28,9 +28,9 @@ - Do not use sqlite_escape_string to quote strings - returned from UDF's as it will lead to double-quoting of the data. Use - this function instead! + Do not use sqlite_escape_string to quote strings + returned from UDF's as it will lead to double-quoting of the data. Use + sqlite_udf_encode_binary instead! diff --git a/reference/sqlite/functions/sqlite-unbuffered-query.xml b/reference/sqlite/functions/sqlite-unbuffered-query.xml index 6dae99797c..620256e2da 100644 --- a/reference/sqlite/functions/sqlite-unbuffered-query.xml +++ b/reference/sqlite/functions/sqlite-unbuffered-query.xml @@ -1,5 +1,5 @@ - + sqlite_unbuffered_query @@ -30,11 +30,16 @@ - Functions such as sqlite_seek and - sqlite_rewind do not work on result handles - returned from this function. + Functions such as sqlite_seek, + sqlite_rewind, sqlite_next, + sqlite_current, and + sqlite_num_rows do not work on result handles + returned from sqlite_unbuffered_query. + + See also sqlite_query. +