Changeset:
f3a2b89b6e47
https://sourceforge.net/p/mrbs/hg-code/ci/f3a2b89b6e47d687db80aa8c5575ae5959a3dabd
Author:
John Beranek <[email protected]>
Date:
Wed Oct 05 09:05:38 2016 +0100
Log message:
Removed superfluous DBStatement->free() method
diffstat:
README.sqlapi | 20 ++++----------------
web/lib/MRBS/DBStatement.php | 9 ---------
2 files changed, 4 insertions(+), 25 deletions(-)
diffs (65 lines):
diff -r 0de8f79338ac -r f3a2b89b6e47 README.sqlapi
--- a/README.sqlapi Wed Oct 05 08:57:52 2016 +0100
+++ b/README.sqlapi Wed Oct 05 09:05:38 2016 +0100
@@ -240,30 +240,22 @@
->row($rownumber)
Return a row from a result. The first row is row number 0.
The row is returned as an array with index 0=first column, etc.
- When called with i >= number of rows in the result, this frees up the
- results structure and returns 0. This is designed to be used in a loop
+ When called with i >= number of rows in the result, returns 0 to signify
+ the end of the result set. This is designed to be used in a loop
like this to retrieve all the rows:
for ($i = 0; (($row = $stmt->row($r, $i)); $i++) { ... process the row ...
}
- When used this way, there is no need to call $stmt->free(). But if
- rows are accessed in other way, $stmt->free() must be called when you are
- done with the statement object, unless the statement object falls out of
- scope.
-
->row_keyed($rownumber)
Return a row from a result. The first row is row number 0.
The row is returned as an associative array with column (field) names as
the indexes. (PHP also makes numeric indexes for the same data.)
- When called with i >= number of rows in the result, this frees up the
- results structure and returns 0. This is designed to be used in a loop
+ When called with i >= number of rows in the result, returns 0 to signify
+ the end of the result set. This is designed to be used in a loop
like this to retrieve all the rows:
for ($i = 0; (($row = $stmt->row_keyed($i)); $i++) { ... }
- When used this way, there is no need to call $stmt->free(). But if
- rows are accessed in other ways, $stmt->free() must be called when you are
- done with the statement object, unless the statement object falls out of
scope.
NOTE: You should explicitly name each column in your SQL statement which
is not a simple field name, because databases differ in how they assume
a default name. For example, don't use ->row_keyed() on a query
@@ -280,7 +272,3 @@
->num_fields()
Returns the number of columns/fields returned by the statement.
-
-->free()
- Frees the statement object. Not strictly necessary if the statement object
- falls out of scope.
diff -r 0de8f79338ac -r f3a2b89b6e47 web/lib/MRBS/DBStatement.php
--- a/web/lib/MRBS/DBStatement.php Wed Oct 05 08:57:52 2016 +0100
+++ b/web/lib/MRBS/DBStatement.php Wed Oct 05 09:05:38 2016 +0100
@@ -72,15 +72,6 @@
return $this->statement->rowCount();
}
- // Free a statement. You need not call this if you call row() or
- // row_keyed() until the row returns 0, since those methods free the
- // statement when you finish reading the rows.
- public function free ()
- {
- $this->statement->closeCursor();
- }
-
-
// Returns the number of fields in a statement.
public function num_fields()
{
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits