[phpMP-CVS] CVS: phpMP/dba mysql.dba,1.11,1.12
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2002-04-11 05:40:18
|
Update of /cvsroot/phpmp/phpMP/dba In directory usw-pr-cvs1:/tmp/cvs-serv3388/dba Modified Files: mysql.dba Log Message: Updated more DBA. Added Extremely Basic News module. Index: mysql.dba =================================================================== RCS file: /cvsroot/phpmp/phpMP/dba/mysql.dba,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** mysql.dba 11 Apr 2002 04:21:02 -0000 1.11 --- mysql.dba 11 Apr 2002 05:40:15 -0000 1.12 *************** *** 43,46 **** --- 43,48 ---- //PERFORMS QUERIES ON A MYSQL DATABASE. class DBA{ + + var $identLink; function connect() { *************** *** 48,64 **** $db = @mysql_connect($MPCONF['DB']['host'], $MPCONF['DB']['username'], $MPCONF['DB']['password']); if (!$db) { return 0; } else { return $db; } } ! function close($db) { ! @mysql_close($db); } function query($query) { global $MPCONF; ! $db = $this->connect(); if (!$db) { $result = 0; --- 50,73 ---- $db = @mysql_connect($MPCONF['DB']['host'], $MPCONF['DB']['username'], $MPCONF['DB']['password']); if (!$db) { + $this->connected = 0; return 0; } else { + $this->identLink = $db; return $db; } } ! function close() { ! @mysql_close($this->identLink); ! $this->identLink = 0; } function query($query) { global $MPCONF; ! if($this->identLink == 0) { ! $db = $this->connect(); ! } else { ! $db = $this->identLink; ! } if (!$db) { $result = 0; *************** *** 70,83 **** $result = @mysql_query($query, $db) or die("MySQL Error: ".mysql_error($db)); } - $this->close($db); return $result; } function num_rows($query) { ! return @mysql_num_rows($query); } function fetch_array($query) { return @mysql_fetch_array($query); } } --- 79,121 ---- $result = @mysql_query($query, $db) or die("MySQL Error: ".mysql_error($db)); } return $result; } function num_rows($query) { ! if($this->identLink == 0) { ! $db = $this->connect(); ! } else { ! $db = $this->identLink; ! } ! $num = @mysql_num_rows($query); ! return $num; } function fetch_array($query) { + if($this->identLink == 0) { + $db = $this->connect(); + } else { + $db = $this->identLink; + } return @mysql_fetch_array($query); + } + + function fetch_row($query) { + if($this->identLink == 0) { + $db = $this->connect(); + } else { + $db = $this->identLink; + } + $result = @mysql_fetch_row($query); + return $result; + } + + function affected_rows() { + if($this->identLink == 0) { + $db = $this->connect(); + } else { + $db = $this->identLink; + } + return @mysql_affected_rows($db); } } |