mirror of
https://github.com/dg/dibi.git
synced 2025-08-15 10:34:06 +02:00
* seek() or rowCount() in unbuffered mode throws exceptions
* out of range seek() throws exception * deprecated DibiDriver::errorInfo * fixed seek(0) on first iteration * added DibiDatabaseException::catchError() & restore() for converting errors to exceptions
This commit is contained in:
@@ -104,7 +104,7 @@ class DibiPdoDriver extends DibiDriver
|
||||
protected function doQuery($sql)
|
||||
{
|
||||
$res = $this->getConnection()->query($sql);
|
||||
return $res instanceof PDOStatement ? new DibiPdoResult($res) : NULL;
|
||||
return $res instanceof PDOStatement ? new DibiPdoResult($res, TRUE) : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,23 +169,6 @@ class DibiPdoDriver extends DibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns last error
|
||||
*
|
||||
* @return array with items 'message' and 'code'
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
$error = $this->getConnection()->errorInfo();
|
||||
return array(
|
||||
'message' => $error[2],
|
||||
'code' => $error[1],
|
||||
'SQLSTATE '=> $error[0],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Escapes the string
|
||||
*
|
||||
@@ -270,7 +253,7 @@ class DibiPdoResult extends DibiResult
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function rowCount()
|
||||
protected function doRowCount()
|
||||
{
|
||||
return $this->resource->rowCount();
|
||||
}
|
||||
@@ -294,9 +277,10 @@ class DibiPdoResult extends DibiResult
|
||||
* Moves cursor position without fetching row
|
||||
*
|
||||
* @param int the 0-based cursor pos to seek to
|
||||
* @return boolean TRUE on success, FALSE if unable to seek to specified record
|
||||
* @return void
|
||||
* @throws DibiException
|
||||
*/
|
||||
public function seek($row)
|
||||
protected function doSeek($row)
|
||||
{
|
||||
$this->row = $row;
|
||||
}
|
||||
@@ -308,7 +292,7 @@ class DibiPdoResult extends DibiResult
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function free()
|
||||
protected function doFree()
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user