Permalink
Browse files

reset lastError on success commands

git-svn-id: svn://dklab.ru/lib/DbSimple/trunk@181 78bb956b-1e24-0410-b8d0-c528fdc9eae3
  • Loading branch information...
1 parent d0bc8a7 commit eec01af6cf0349692d16b1336dc02b2b5c88d69e dk committed Mar 29, 2007
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/DbSimple/Generic.php
View
@@ -129,7 +129,7 @@ function& connect($dsn)
if ($fp) {
fclose($fp);
unlink($testFile);
- require_once 'Cache/Lite.php';
+ require_once 'Cache' . '/Lite.php'; // "." -> no phpEclipse notice
$t =& new Cache_Lite(array('cacheDir' => $dir.'/', 'lifeTime' => null, 'automaticSerialization' => true));
$object->setCacher(&$t);
break;
@@ -181,6 +181,7 @@ class DbSimple_Generic_Database extends DbSimple_Generic_LastError
*/
function blob($blob_id = null)
{
+ $this->_resetLastError();
return $this->_performNewBlob($blob_id);
}
@@ -190,6 +191,7 @@ function blob($blob_id = null)
*/
function transaction($mode=null)
{
+ $this->_resetLastError();
$this->_logQuery('-- START TRANSACTION '.$mode);
return $this->_performTransaction($mode);
}
@@ -200,6 +202,7 @@ function transaction($mode=null)
*/
function commit()
{
+ $this->_resetLastError();
$this->_logQuery('-- COMMIT');
return $this->_performCommit();
}
@@ -210,6 +213,7 @@ function commit()
*/
function rollback()
{
+ $this->_resetLastError();
$this->_logQuery('-- ROLLBACK');
return $this->_performRollback();
}
@@ -516,6 +520,8 @@ function ____________PRIVATE() {} // for phpEclipse outline
*/
function _query($query, &$total)
{
+ $this->_resetLastError();
+
// Fetch query attributes.
$this->attributes = $this->_transformQuery($query, 'GET_ATTRIBUTES');
@@ -683,7 +689,6 @@ function _transformQuery(&$query, $how)
$i++;
}
return true;
- ;
}
// No such transform.
$this->_setLastError(-1, "No such transform type: $how", $query);
@@ -1093,9 +1098,9 @@ function _logQueryStat($queryTime, $fetchTime, $firstFetchTime, $rows)
*/
function _cache($hash, $result=null)
{
- if (is_callable($this->_cacher))
+ if (is_callable($this->_cacher)) {
return call_user_func($this->_cacher, $hash, $result);
- else if (is_object($this->_cacher) && method_exists($this->_cacher, 'get') && method_exists($this->_cacher, 'save')) {
+ } else if (is_object($this->_cacher) && method_exists($this->_cacher, 'get') && method_exists($this->_cacher, 'save')) {
if (null === $result)
return $this->_cacher->get($hash);
else

0 comments on commit eec01af

Please sign in to comment.