This commit is contained in:
Robin Appelman 2010-07-05 13:35:41 +02:00
commit db5ac0b477
1 changed files with 12 additions and 4 deletions

View File

@ -302,6 +302,8 @@ class OC_UTIL {
class OC_DB {
static private $DBConnection=false;
static private $schema=false;
static private $affected=0;
static private $result=false;
/**
* connect to the datbase if not already connected
*/
@ -371,12 +373,15 @@ class OC_DB {
}elseif($CONFIG_DBTYPE=='pgsql'){
$cmd=str_replace('`','"',$cmd);
}
$result=self::$DBConnection->query($cmd);
$result=self::$DBConnection->exec($cmd);
if (PEAR::isError($result)) {
$entry='DB Error: "'.$result->getMessage().'"<br />';
$entry.='Offending command was: '.$cmd.'<br />';
die($entry);
}else{
self::$affected=$result;
}
self::$result=$result;
return $result;
}
@ -454,7 +459,7 @@ class OC_DB {
* @return int
*/
static function affected_rows() {
self::$DBConnection->affectedRows();
return self::$affected;
}
/**
@ -487,8 +492,11 @@ class OC_DB {
* @param unknown_type $result
* @return bool
*/
static function free_result($result) {
$result->free();
static function free_result() {
if(self::$result){
self::$result->free();
self::$result=false;
}
}
static public function disconnect(){