From 63976df704673b3c4d67accec321bf69cca75479 Mon Sep 17 00:00:00 2001 From: Adiel Cristo Date: Sun, 27 Aug 2023 10:53:44 -0300 Subject: [PATCH 1/3] Remove personalization (usage of you, we, etc.) --- .../pdo_sqlite/PDO/sqliteCreateAggregate.xml | 85 ++++++++++--------- .../pdo_sqlite/PDO/sqliteCreateCollation.xml | 7 +- .../pdo_sqlite/PDO/sqliteCreateFunction.xml | 65 +++++--------- reference/pdo_sqlite/configure.xml | 14 +-- reference/pdo_sqlite/reference.xml | 2 +- 5 files changed, 80 insertions(+), 93 deletions(-) diff --git a/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml b/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml index c883515fa4b9..8f271602ed7a 100644 --- a/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml +++ b/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml @@ -19,14 +19,15 @@ &warn.experimental.func; - This method is similar to except that it registers functions that can be used to calculate a - result aggregated across all the rows of a query. + This method is similar to + , + except that it registers functions that can be used to calculate a result + aggregated across all the rows of a query. - The key difference between this method and is that two functions are - required to manage the aggregate. + The key difference between this method and + + is that two functions are required to manage the aggregate. @@ -46,9 +47,9 @@ step_func - Callback function called for each row of the result set. Your PHP - function should accumulate the result and store it in the aggregation - context. + Callback function called for each row of the result set. + The PHP function should accumulate the result and store it in the + aggregation context. This function need to be defined as: @@ -65,8 +66,8 @@ &null; for the first row; on subsequent rows it will have the value - that was previously returned from the step function; you should use - this to maintain the aggregate state. + that was previously returned from the step function; this should be + used to maintain the aggregate state. @@ -105,12 +106,12 @@ finalize_func - Callback function to aggregate the "stepped" data from each row. - Once all the rows have been processed, this function will be called - and it should then take the data from the aggregation context and - return the result. This callback function should return a type understood - by SQLite (i.e. scalar type). + Callback function to aggregate the "stepped" data from each row. + Once all the rows have been processed, this function will be called and + it should then take the data from the aggregation context and return the + result. + This callback function should return a type understood by SQLite (i.e. a + scalar type). This function need to be defined as: @@ -190,7 +191,7 @@ foreach ($data as $str) { } $insert = null; -function max_len_step($context, $rownumber, $string) +function max_len_step($context, $rownumber, $string) { if (strlen($string) > $context) { $context = strlen($string); @@ -198,7 +199,7 @@ function max_len_step($context, $rownumber, $string) return $context; } -function max_len_finalize($context, $rowcount) +function max_len_finalize($context, $rowcount) { return $context === null ? 0 : $context; } @@ -213,43 +214,45 @@ var_dump($db->query('SELECT max_len(a) from strings')->fetchAll()); - In this example, we are creating an aggregating function that will - calculate the length of the longest string in one of the columns of the - table. For each row, the max_len_step function is - called and passed a $context parameter. The context - parameter is just like any other PHP variable and be set to hold an array - or even an object value. In this example, we are simply using it to hold - the maximum length we have seen so far; if the - $string has a length longer than the current - maximum, we update the context to hold this new maximum length. + In this example, an aggregating function is being created that will calculate + the length of the longest string in one of the columns of the table. + For each row, the max_len_step function is called and + passed a $context parameter. + The $context parameter is just like any other PHP + variable and be set to hold an array or even an object value. + In this example, it is simply being used to hold the maximum length seen so + far; if the $string has a length longer than the + current maximum, the $context will be updated to hold + this new maximum length. After all of the rows have been processed, SQLite calls the max_len_finalize function to determine the aggregate - result. Here, we could perform some kind of calculation based on the - data found in the $context. In our simple example - though, we have been calculating the result as the query progressed, so we - simply need to return the context value. + result. + Here, some kind of calculation could be performed based on the data found in + the $context. + In this simple example though, the result has been calculated as the query + progressed, so it's simply needed to return the context value. - It is NOT recommended for you to store a copy of the values in the context - and then process them at the end, as you would cause SQLite to use a lot of - memory to process the query - just think of how much memory you would need - if a million rows were stored in memory, each containing a string 32 bytes - in length. + It is NOT recommended to store a copy of the values in + the context and then process them at the end, as it would cause SQLite to + use a lot of memory to process the query - just think of how much memory + would be needed if a million rows were stored in memory, each containing a + string 32 bytes in length. - You can use and - to override SQLite - native SQL functions. + + and + + can be used to override SQLite native SQL functions. - &reftitle.seealso; diff --git a/reference/pdo_sqlite/PDO/sqliteCreateCollation.xml b/reference/pdo_sqlite/PDO/sqliteCreateCollation.xml index 9ae1c083171e..509a8530018f 100644 --- a/reference/pdo_sqlite/PDO/sqliteCreateCollation.xml +++ b/reference/pdo_sqlite/PDO/sqliteCreateCollation.xml @@ -34,7 +34,12 @@ callback - The name of a PHP function or user-defined function to apply as a callback, defining the behavior of the collation. It should accept two strings and return as strcmp() does, i.e. it should return -1, 1, or 0 if the first string sorts before, sorts after, or is equal to the second. + The name of a PHP function or user-defined function to apply as a + callback, defining the behavior of the collation. + It should accept two strings and return as strcmp + does, i.e. it should return -1, 1, + or 0 if the first string sorts before, sorts after, or + is equal to the second. This function need to be defined as: diff --git a/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml b/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml index f523613d4d82..659a078a1ba9 100644 --- a/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml +++ b/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml @@ -20,9 +20,9 @@ &warn.experimental.func; - This method allows you to register a PHP function with SQLite as an - UDF (User Defined Function), so that it can be called - from within your SQL statements. + This method allows to register a PHP function with SQLite as an + UDF (User Defined Function), so that it can be called from + within the SQL statements. The UDF can be used in any SQL statement that can call functions, such as @@ -86,9 +86,9 @@ num_args - The number of arguments that the SQL function takes. If - this parameter is -1, then the SQL function may take - any number of arguments. + The number of arguments that the SQL function takes. + If this parameter is -1, then the SQL function may + take any number of arguments. @@ -96,10 +96,10 @@ flags - A bitwise conjunction of flags. Currently, only - PDO::SQLITE_DETERMINISTIC is supported, which specifies - that the function always returns the same result given the same inputs - within a single SQL statement. + A bitwise conjunction of flags. + Currently, only PDO::SQLITE_DETERMINISTIC is + supported, which specifies that the function always returns the same + result given the same inputs within a single SQL statement. @@ -158,45 +158,22 @@ $rows = $db->query('SELECT md5rev(filename) FROM files')->fetchAll(); - In this example, we have a function that calculates the md5 sum of a - string, and then reverses it. When the SQL statement executes, it - returns the value of the filename transformed by our function. The data - returned in $rows contains the processed result. + In this example, there is a function that calculates the md5 sum of a string, + and then reverses it. + When the SQL statement executes, it returns the value of the filename + transformed by the function. + The data returned in $rows contains the processed result. - 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. + The beauty of this technique is that it is not needed to process the result + using a &foreach; loop after the data has been queried for. - - You can use and - to override SQLite - native SQL functions. + + and + + can be used to override SQLite native SQL functions. diff --git a/reference/pdo_sqlite/configure.xml b/reference/pdo_sqlite/configure.xml index ad4abe99e484..3b985e57a260 100644 --- a/reference/pdo_sqlite/configure.xml +++ b/reference/pdo_sqlite/configure.xml @@ -3,12 +3,14 @@
&reftitle.install; - The PDO_SQLITE PDO driver is enabled by default. To disable, - may be used, - where the optional [=DIR] is the sqlite base install directory. - As of PHP 7.4.0 libsqlite ≥ 3.5.0 is required. - Formerly, the bundled libsqlite could have been used instead, and was the - default, if [=DIR] has been omitted. + The PDO_SQLITE PDO driver is enabled by default. + To disable it, + may be used, where the optional [=DIR] is the sqlite base + install directory. + As of PHP 7.4.0, + libsqlite ≥ 3.5.0 is required. + Formerly, the bundled libsqlite could have been used instead and was the + default if [=DIR] has been omitted. Additional setup on Windows as of PHP 7.4.0 diff --git a/reference/pdo_sqlite/reference.xml b/reference/pdo_sqlite/reference.xml index 6a205be15e1f..67b816dc6f34 100644 --- a/reference/pdo_sqlite/reference.xml +++ b/reference/pdo_sqlite/reference.xml @@ -3,7 +3,7 @@ - SQLite Functions (PDO_SQLITE) + SQLite &Functions; (PDO_SQLITE) SQLite (PDO) From f70156411765e803a1fb4e20c7354255403d7b79 Mon Sep 17 00:00:00 2001 From: Adiel Cristo Date: Thu, 31 Aug 2023 01:34:52 -0300 Subject: [PATCH 2/3] Fix the uppercase of emphasized 'not' word --- reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml b/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml index 8f271602ed7a..6f76bc85056a 100644 --- a/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml +++ b/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml @@ -236,7 +236,7 @@ var_dump($db->query('SELECT max_len(a) from strings')->fetchAll()); - It is NOT recommended to store a copy of the values in + It is not recommended to store a copy of the values in the context and then process them at the end, as it would cause SQLite to use a lot of memory to process the query - just think of how much memory would be needed if a million rows were stored in memory, each containing a From 724bf3f01ebd48ef99a5d7d73dc1b9d6fe3a5aaf Mon Sep 17 00:00:00 2001 From: Adiel Cristo Date: Thu, 31 Aug 2023 01:36:30 -0300 Subject: [PATCH 3/3] Fix usage of tag --- reference/pdo_sqlite/PDO/sqliteCreateFunction.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml b/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml index 659a078a1ba9..8ba69ca544b3 100644 --- a/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml +++ b/reference/pdo_sqlite/PDO/sqliteCreateFunction.xml @@ -162,7 +162,7 @@ $rows = $db->query('SELECT md5rev(filename) FROM files')->fetchAll(); and then reverses it. When the SQL statement executes, it returns the value of the filename transformed by the function. - The data returned in $rows contains the processed result. + The data returned in $rows contains the processed result. The beauty of this technique is that it is not needed to process the result