1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-19 20:33:37 +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

@@ -126,8 +126,7 @@ class DibiOracleDriver extends DibiDriver
throw new DibiDatabaseException($err['message'], $err['code'], $sql);
}
// TODO!
return is_resource($res) ? new DibiOracleResult($statement) : TRUE;
return is_resource($res) ? new DibiOracleResult($statement, TRUE) : TRUE;
}
@@ -201,18 +200,6 @@ class DibiOracleDriver extends DibiDriver
/**
* Returns last error
*
* @return array with items 'message' and 'code'
*/
public function errorInfo()
{
return oci_error($this->getConnection());
}
/**
* Escapes the string
*
@@ -294,7 +281,7 @@ class DibiOracleResult extends DibiResult
*
* @return int
*/
public function rowCount()
protected function doRowCount()
{
return oci_num_rows($this->resource);
}
@@ -309,6 +296,7 @@ class DibiOracleResult extends DibiResult
*/
protected function doFetch()
{
$this->fetched = TRUE;
return oci_fetch_assoc($this->resource);
}
@@ -318,11 +306,13 @@ class DibiOracleResult 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)
{
//throw new BadMethodCallException(__METHOD__ . ' is not implemented');
if ($row === 0 && !$this->fetched) return TRUE;
throw new BadMethodCallException(__METHOD__ . ' is not implemented');
}
@@ -332,7 +322,7 @@ class DibiOracleResult extends DibiResult
*
* @return void
*/
protected function free()
protected function doFree()
{
oci_free_statement($this->resource);
}