1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-10 16:14:57 +02:00

* update DibiVariableInterface

* some bugs fixed
This commit is contained in:
David Grudl
2007-11-12 07:33:23 +00:00
parent 89c53395c1
commit 46850aa588
15 changed files with 53 additions and 53 deletions

View File

@@ -54,8 +54,8 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -180,6 +180,7 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -188,7 +189,7 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? -1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value);
if ($type === dibi::FIELD_DATETIME) return date("'Y-m-d H:i:s'", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}
@@ -251,7 +252,7 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface
public function seek($row)
{
if (!mssql_data_seek($this->resultset, $row)) {
throw new DibiDriverException('Unable to seek to row ' . $row);
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
}

View File

@@ -65,8 +65,8 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -224,6 +224,7 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -232,7 +233,7 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value);
if ($type === dibi::FIELD_DATETIME) return date("'Y-m-d H:i:s'", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}
@@ -298,7 +299,7 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
throw new BadMethodCallException(__METHOD__ . ' is not allowed for unbuffered queries');
}
if (!mysql_data_seek($this->resultset, $row)) {
throw new DibiDriverException('Unable to seek to row ' . $row);
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
}

View File

@@ -65,8 +65,8 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -208,6 +208,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -216,7 +217,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value);
if ($type === dibi::FIELD_DATETIME) return date("'Y-m-d H:i:s'", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}
@@ -283,7 +284,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
throw new BadMethodCallException(__METHOD__ . ' is not allowed for unbuffered queries');
}
if (!mysqli_data_seek($this->resultset, $row)) {
throw new DibiDriverException('Unable to seek to row ' . $row);
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
}

View File

@@ -60,8 +60,8 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -195,6 +195,7 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -203,7 +204,7 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? -1 : 0;
if ($type === dibi::FIELD_DATE) return date("#m/d/Y#", $value);
if ($type === dibi::FIELD_DATETIME) return date("#m/d/Y H:i:s#", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}

View File

@@ -59,8 +59,8 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -193,6 +193,7 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -201,7 +202,7 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("U", $value);
if ($type === dibi::FIELD_DATETIME) return date("U", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}

View File

@@ -59,8 +59,8 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -168,6 +168,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -176,7 +177,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value);
if ($type === dibi::FIELD_DATETIME) return date("'Y-m-d H:i:s'", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}

View File

@@ -52,8 +52,8 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -194,6 +194,7 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -202,7 +203,7 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? 'TRUE' : 'FALSE';
if ($type === dibi::FIELD_DATE) return date("'Y-m-d'", $value);
if ($type === dibi::FIELD_DATETIME) return date("'Y-m-d H:i:s'", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}
@@ -263,7 +264,7 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface
public function seek($row)
{
if (!pg_result_seek($this->resultset, $row)) {
throw new DibiDriverException('Unable to seek to row ' . $row);
throw new DibiDatabaseException('Unable to seek to row ' . $row);
}
}

View File

@@ -58,8 +58,8 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
/**
* Connects to a database
*
* @throws DibiException
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
@@ -185,6 +185,7 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
* @param string value
* @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER)
* @return string formatted value
* @throws InvalidArgumentException
*/
public function format($value, $type)
{
@@ -193,7 +194,7 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
if ($type === dibi::FIELD_BOOL) return $value ? 1 : 0;
if ($type === dibi::FIELD_DATE) return date("U", $value);
if ($type === dibi::FIELD_DATETIME) return date("U", $value);
throw new DibiException('Invalid formatting type');
throw new InvalidArgumentException('Unsupported formatting type');
}
@@ -269,6 +270,7 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
*/
public function free()
{
$this->resultset = NULL;
}