1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-20 04:41:26 +02:00

* DibiConnection::getConfig('name') returns name of connection

* seek() returns boolean again
* DibiDriver throws exception when is used after free()
This commit is contained in:
David Grudl
2007-11-13 01:51:44 +00:00
parent 40444c1341
commit 0eeff53fe8
14 changed files with 85 additions and 56 deletions

View File

@@ -246,14 +246,12 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
{
if (!mssql_data_seek($this->resultset, $row)) {
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
return mssql_data_seek($this->resultset, $row);
}

View File

@@ -290,7 +290,7 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
@@ -299,9 +299,7 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
throw new DibiDatabaseException('Cannot seek an unbuffered result set');
}
if (!mysql_data_seek($this->resultset, $row)) {
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
return mysql_data_seek($this->resultset, $row);
}

View File

@@ -43,14 +43,14 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
/**
* Connection resource
* @var resource
* @var mysqli
*/
private $connection;
/**
* Resultset resource
* @var resource
* @var mysqli_result
*/
private $resultset;
@@ -275,7 +275,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
@@ -283,9 +283,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
if (!$this->buffered) {
throw new DibiDatabaseException('Cannot seek an unbuffered result set');
}
if (!mysqli_data_seek($this->resultset, $row)) {
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
return mysqli_data_seek($this->resultset, $row);
}
@@ -356,7 +354,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
/**
* Returns the connection resource
*
* @return mixed
* @return mysqli
*/
public function getResource()
{
@@ -368,7 +366,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
/**
* Returns the resultset resource
*
* @return mixed
* @return mysqli_result
*/
public function getResultResource()
{

View File

@@ -259,12 +259,13 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
{
$this->row = $row;
return TRUE;
}

View File

@@ -253,7 +253,7 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)

View File

@@ -37,14 +37,14 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
/**
* Connection resource
* @var resource
* @var PDO
*/
private $connection;
/**
* Resultset resource
* @var resource
* @var PDOStatement
*/
private $resultset;
@@ -220,7 +220,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
@@ -261,7 +261,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
/**
* Returns the connection resource
*
* @return mixed
* @return PDO
*/
public function getResource()
{
@@ -273,7 +273,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
/**
* Returns the resultset resource
*
* @return mixed
* @return PDOStatement
*/
public function getResultResource()
{

View File

@@ -258,14 +258,12 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
{
if (!pg_result_seek($this->resultset, $row)) {
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
return pg_result_seek($this->resultset, $row);
}

View File

@@ -248,7 +248,7 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
* Moves cursor position without fetching row
*
* @param int the 0-based cursor pos to seek to
* @return void
* @return boolean TRUE on success, FALSE if unable to seek to specified record
* @throws DibiException
*/
public function seek($row)
@@ -256,9 +256,7 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
if (!$this->buffered) {
throw new DibiDatabaseException('Cannot seek an unbuffered result set');
}
if (!sqlite_seek($this->resultset, $row)) {
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
return sqlite_seek($this->resultset, $row);
}