From: arjen Date: Wed, 9 Jul 2003 07:22:52 +0000 (+0000) Subject: PHP function db::query() returns the result index. X-Git-Tag: V0_0_6~6 X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=5d2a5ebfc5971ff96786b1ae01352c2e9032bcde PHP function db::query() returns the result index. PHP function db::num_rows() accepts a result index as argument (default = 0 -> use result from the previous query). New PHP function db::fetch_object(). --- diff --git a/src/phpclasses/db.postgres.php b/src/phpclasses/db.postgres.php index e8e911c..9858fa3 100644 --- a/src/phpclasses/db.postgres.php +++ b/src/phpclasses/db.postgres.php @@ -62,6 +62,7 @@ $this->db_result = pg_exec ($this->db_connection, $inp_sql_query); $this->db_row_number = 0; + return $this->db_result; } function fetch_row() { @@ -81,12 +82,25 @@ } } - function num_rows() { + function fetch_object($result, $row) + { + return pg_fetch_object($result, $row); + } + + function num_rows($db_result = 0) { /* This functions returns the number of rows in a resultset - * INPUT : NONE + * INPUT : Postgres result index (default = internal result).. * OUTPUT : Number of rows (number) */ - return pg_numrows($this->db_result); + + if ($db_result == 0) + { + // Default: use result from inside the object. + + $db_result = $this->db_result; + } + return pg_numrows($db_result); + // 4.2.X return pg_num_rows($this->db_result); }