1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-26 23:44:24 +02:00

- affectedRows(), insertId(), rowCount() are aliases for getAffectedRows(), getInsertId(), getRowCount()

This commit is contained in:
David Grudl
2009-02-26 20:02:14 +00:00
parent d2f1beba57
commit 2f86997ca7
14 changed files with 109 additions and 55 deletions

View File

@@ -121,7 +121,7 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return mssql_rows_affected($this->connection);
}
@@ -132,7 +132,7 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
$res = mssql_query('SELECT @@IDENTITY', $this->connection);
if (is_resource($res)) {
@@ -276,7 +276,7 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
return mssql_num_rows($this->resultSet);
}
@@ -300,7 +300,6 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
* 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
* @throws DibiException
*/
public function seek($row)
{

View File

@@ -121,7 +121,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return sqlsrv_rows_affected($this->resultSet);
}
@@ -132,7 +132,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
$res = sqlsrv_query($this->connection, 'SELECT @@IDENTITY');
if (is_resource($res)) {
@@ -276,9 +276,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
throw new DibiDriverException('Row count is not available for unbuffered queries.');
throw new NotSupportedException('Row count is not available for unbuffered queries.');
}
@@ -306,11 +306,10 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
* 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
* @throws DibiException
*/
public function seek($row)
{
throw new DibiDriverException('Cannot seek an unbuffered result set.');
throw new NotSupportedException('Cannot seek an unbuffered result set.');
}

View File

@@ -198,7 +198,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return mysql_affected_rows($this->connection);
}
@@ -209,7 +209,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
return mysql_insert_id($this->connection);
}
@@ -345,7 +345,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries.');

View File

@@ -182,7 +182,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return mysqli_affected_rows($this->connection);
}
@@ -193,7 +193,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
return mysqli_insert_id($this->connection);
}
@@ -328,7 +328,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries.');

View File

@@ -125,7 +125,7 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return odbc_num_rows($this->resultSet);
}
@@ -136,7 +136,7 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
throw new NotSupportedException('ODBC does not support autoincrementing.');
}
@@ -280,7 +280,7 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
// will return -1 with many drivers :-(
return odbc_num_rows($this->resultSet);
@@ -314,7 +314,6 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
* 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
* @throws DibiException
*/
public function seek($row)
{

View File

@@ -126,7 +126,7 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
throw new NotImplementedException;
}
@@ -137,7 +137,7 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
throw new NotSupportedException('Oracle does not support autoincrementing.');
}
@@ -148,7 +148,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
* Begins a transaction (if supported).
* @param string optinal savepoint name
* @return void
* @throws DibiDriverException
*/
public function begin($savepoint = NULL)
{
@@ -278,9 +277,9 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
throw new DibiDriverException('Row count is not available for unbuffered queries.');
throw new NotSupportedException('Row count is not available for unbuffered queries.');
}
@@ -302,7 +301,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
* 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
* @throws DibiException
*/
public function seek($row)
{

View File

@@ -142,7 +142,7 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return $this->affectedRows;
}
@@ -153,7 +153,7 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
return $this->connection->lastInsertId();
}
@@ -347,9 +347,9 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
throw new DibiDriverException('Row count is not available for unbuffered queries.');
throw new NotSupportedException('Row count is not available for unbuffered queries.');
}
@@ -371,11 +371,10 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
* 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
* @throws DibiException
*/
public function seek($row)
{
throw new DibiDriverException('Cannot seek an unbuffered result set.');
throw new NotSupportedException('Cannot seek an unbuffered result set.');
}

View File

@@ -147,7 +147,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return pg_affected_rows($this->resultSet);
}
@@ -158,7 +158,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
if ($sequence === NULL) {
// PostgreSQL 8.1 is needed
@@ -326,7 +326,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
return pg_num_rows($this->resultSet);
}
@@ -350,7 +350,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
* 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
* @throws DibiException
*/
public function seek($row)
{
@@ -417,7 +416,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
{
$version = pg_version($this->connection);
if ($version['server'] < 8) {
throw new NotSupportedException('Reflection requires PostgreSQL 8.');
throw new DibiDriverException('Reflection requires PostgreSQL 8.');
}
$this->query("

View File

@@ -145,7 +145,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
*/
public function affectedRows()
public function getAffectedRows()
{
return sqlite_changes($this->connection);
}
@@ -156,7 +156,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
*/
public function insertId($sequence)
public function getInsertId($sequence)
{
return sqlite_last_insert_rowid($this->connection);
}
@@ -287,7 +287,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
* Returns the number of rows in a result set.
* @return int
*/
public function rowCount()
public function getRowCount()
{
if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries.');