diff --git a/inc/lib_base.php b/inc/lib_base.php index d946f565c8..67dbcb2eac 100755 --- a/inc/lib_base.php +++ b/inc/lib_base.php @@ -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().'"
'; $entry.='Offending command was: '.$cmd.'
'; 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(){