1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-08 15:16:58 +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:
David Grudl
2007-11-12 01:39:26 +00:00
parent 5ee6a19f93
commit ea00d5d37d
14 changed files with 184 additions and 223 deletions

View File

@@ -123,7 +123,7 @@ class DibiMsSqlDriver extends DibiDriver
throw new DibiDatabaseException('Query error', 0, $sql);
}
return is_resource($res) ? new DibiMSSqlResult($res) : NULL;
return is_resource($res) ? new DibiMSSqlResult($res, TRUE) : NULL;
}
@@ -189,21 +189,6 @@ class DibiMsSqlDriver extends DibiDriver
/**
* Returns last error
*
* @return array with items 'message' and 'code'
*/
public function errorInfo()
{
return array(
'message' => NULL,
'code' => NULL,
);
}
/**
* Escapes the string
*
@@ -293,7 +278,7 @@ class DibiMSSqlResult extends DibiResult
*
* @return int
*/
public function rowCount()
protected function doRowCount()
{
return mssql_num_rows($this->resource);
}
@@ -317,11 +302,14 @@ class DibiMSSqlResult 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)
{
return mssql_data_seek($this->resource, $row);
if (!mssql_data_seek($this->resource, $row)) {
throw new DibiDriverException('Unable to seek to row ' . $row);
}
}
@@ -331,7 +319,7 @@ class DibiMSSqlResult extends DibiResult
*
* @return void
*/
protected function free()
protected function doFree()
{
mssql_free_result($this->resource);
}