[TEP-COMMIT] [CVS catalog] replace the mysql_fetch_array() call with a mysql_fetch_assoc() call, and

anonymous-OfajU3CKLf1/[email protected] 8 Apr 2004 02:32:16 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Commit in catalog/catalog/includes/classes on MAIN

database.php +13 1.1 -> 1.2

database/mysql.php +11 -1 1.1 -> 1.2

+24 -1

2 modified files

replace the mysql_fetch_array() call with a mysql_fetch_assoc() call, and
set a compatibility function as mysql_fetch_assoc() is not available for
PHP < 4.0.3 servers

add a new affectedRows() method

----------

catalog /catalog /includes /classes

database.php 1.1 -> 1.2

diff -u -r1.1 -r1.2
--- database.php 2004/02/16 06:38:27 1.1
+++ database.php 2004/04/08 02:32:14 1.2
@@ -267,6 +267,7 @@

$query_handler,
$result,
$rows,

+ $affected_rows,

$cache_key,
$cache_expire,
$cache_data,

@@ -425,6 +426,18 @@

}

return $this->rows;

+ }
+
+ function affectedRows() {
+ if (!isset($this->affected_rows)) {
+ if (!isset($this->query_handler)) {
+ $this->execute();
+ }
+
+ $this->affected_rows = $this->db_class->affectedRows();
+ }
+
+ return $this->affected_rows;

}

function execute() {

----------

catalog /catalog /includes /classes /database

mysql.php 1.1 -> 1.2

diff -u -r1.1 -r1.2
--- mysql.php 2004/02/16 06:38:28 1.1
+++ mysql.php 2004/04/08 02:32:15 1.2
@@ -10,6 +10,12 @@

Released under the GNU General Public License
*/

+ if (!function_exists('mysql_fetch_assoc')) {
+ function mysql_fetch_assoc($resource) {
+ return mysql_fetch_array($resource, MYSQL_ASSOC);
+ }
+ }
+

class osC_Database_mysql extends osC_Database {
var $sql_parse_string = 'addslashes',
$sql_parse_string_with_connection_handler = false;

@@ -148,7 +154,7 @@

}

function next($resource) {

- return @mysql_fetch_array($resource, MYSQL_ASSOC);

+ return @mysql_fetch_assoc($resource);

}

function freeResult($resource) {

@@ -173,6 +179,10 @@

function numberOfRows($resource) {
return @mysql_num_rows($resource);

+ }
+
+ function affectedRows() {
+ return mysql_affected_rows($this->link);

}
}
?>

CVSspam 0.2.8

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click