[Hastymail-cvs] SF.net SVN: hastymail:[750] trunk/hastymail2/db/db.php
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2009-02-16 15:54:42
|
Revision: 750 http://hastymail.svn.sourceforge.net/hastymail/?rev=750&view=rev Author: sailfrog Date: 2009-02-16 15:54:38 +0000 (Mon, 16 Feb 2009) Log Message: ----------- better MDB2 error handling Modified Paths: -------------- trunk/hastymail2/db/db.php Modified: trunk/hastymail2/db/db.php =================================================================== --- trunk/hastymail2/db/db.php 2009-02-16 15:40:56 UTC (rev 749) +++ trunk/hastymail2/db/db.php 2009-02-16 15:54:38 UTC (rev 750) @@ -177,15 +177,20 @@ } return $result_set; } - function delete($sql, $ses=false) { + function write($sql, $ses=false) { if ($this->read_only) { return 0; } $result = 0; if ($this->pear_type == 'MDB2') { $sth = $this->db_write->prepare($sql); - $res = $sth->execute(); - $result = $res; + if (method_exists($sth, 'execute')) { + $res = $sth->execute(); + $result = $res; + } + else { + $res = $sth; + } } else { $res =& $this->db_write->query($sql); @@ -202,11 +207,14 @@ } return $result; } + function delete($sql, $ses=false) { + return $this->write($sql, $ses); + } function update($sql, $ses=false) { - return $this->delete($sql, $ses); + return $this->write($sql, $ses); } function insert($sql, $ses=false) { - return $this->delete($sql, $ses); + return $this->write($sql, $ses); } function single($sql, $force=false, $explain=false, $ses=false) { if ($this->pear_type == 'MDB2') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |