1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 21:58:10 +02:00

* vetsina method/trid oznacena jako final

This commit is contained in:
David Grudl
2007-08-09 03:31:34 +00:00
parent 609a3d64fb
commit 8b89eb3bd0
12 changed files with 68 additions and 38 deletions

View File

@@ -130,7 +130,7 @@ class dibi
* dibi::query() error mode * dibi::query() error mode
* @var bool * @var bool
*/ */
public static $throwExceptions = FALSE; public static $throwExceptions = TRUE;
/** /**
* Substitutions for identifiers * Substitutions for identifiers
@@ -320,6 +320,36 @@ class dibi
/**
* Begins a transaction - Monostate for DibiDriver::begin()
*/
public static function begin()
{
return self::getConnection()->begin();
}
/**
* Commits statements in a transaction - Monostate for DibiDriver::commit()
*/
public static function commit()
{
return self::getConnection()->commit();
}
/**
* Rollback changes in a transaction - Monostate for DibiDriver::rollback()
*/
public static function rollback()
{
return self::getConnection()->rollback();
}
private static function dumpHighlight($matches) private static function dumpHighlight($matches)
{ {
if (!empty($matches[1])) // comment if (!empty($matches[1])) // comment

View File

@@ -75,7 +75,7 @@ abstract class DibiDriver
* @see DibiDriver::__construct * @see DibiDriver::__construct
* @return array * @return array
*/ */
public function getConfig() final public function getConfig()
{ {
return $this->config; return $this->config;
} }
@@ -86,7 +86,7 @@ abstract class DibiDriver
* Returns the connection resource * Returns the connection resource
* @return resource * @return resource
*/ */
public function getConnection() final public function getConnection()
{ {
if (!$this->connection) $this->connection = $this->connect(); if (!$this->connection) $this->connection = $this->connect();
@@ -102,7 +102,7 @@ abstract class DibiDriver
* @return int|DibiResult * @return int|DibiResult
* @throws DibiException * @throws DibiException
*/ */
public function query($args) final public function query($args)
{ {
// receive arguments // receive arguments
if (!is_array($args)) if (!is_array($args))
@@ -256,9 +256,9 @@ abstract class DibiDriver
* Access to undeclared property * Access to undeclared property
* @throws Exception * @throws Exception
*/ */
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
/**#@-*/ /**#@-*/

View File

@@ -37,13 +37,13 @@ class DibiException extends Exception
} }
public function getSql() final public function getSql()
{ {
return $this->sql; return $this->sql;
} }
public function getDbError() final public function getDbError()
{ {
return $this->dbError; return $this->dbError;
} }

View File

@@ -294,7 +294,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
public function setType($field, $type = NULL) final public function setType($field, $type = NULL)
{ {
if ($field === TRUE) if ($field === TRUE)
$this->detectTypes(); $this->detectTypes();
@@ -309,14 +309,14 @@ abstract class DibiResult implements IteratorAggregate, Countable
/** is this needed? */ /** is this needed? */
public function getType($field) final public function getType($field)
{ {
return isset($this->convert[$field]) ? $this->convert[$field] : NULL; return isset($this->convert[$field]) ? $this->convert[$field] : NULL;
} }
public function convert($value, $type) final public function convert($value, $type)
{ {
if ($value === NULL || $value === FALSE) if ($value === NULL || $value === FALSE)
return $value; return $value;
@@ -341,7 +341,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
* Gets an array of field names * Gets an array of field names
* @return array * @return array
*/ */
public function getFields() final public function getFields()
{ {
// lazy init // lazy init
if ($this->meta === NULL) $this->buildMeta(); if ($this->meta === NULL) $this->buildMeta();
@@ -355,7 +355,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
* @param string column name * @param string column name
* @return array * @return array
*/ */
public function getMetaData($field) final public function getMetaData($field)
{ {
// lazy init // lazy init
if ($this->meta === NULL) $this->buildMeta(); if ($this->meta === NULL) $this->buildMeta();
@@ -368,7 +368,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
* Acquires .... * Acquires ....
* @return void * @return void
*/ */
protected function detectTypes() final protected function detectTypes()
{ {
if ($this->meta === NULL) $this->buildMeta(); if ($this->meta === NULL) $this->buildMeta();
} }
@@ -383,7 +383,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
/** these are the required IteratorAggregate functions */ /** these are the required IteratorAggregate functions */
public function getIterator($offset = NULL, $count = NULL) final public function getIterator($offset = NULL, $count = NULL)
{ {
return new DibiResultIterator($this, $offset, $count); return new DibiResultIterator($this, $offset, $count);
} }
@@ -392,7 +392,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
/** these are the required Countable functions */ /** these are the required Countable functions */
public function count() final public function count()
{ {
return $this->rowCount(); return $this->rowCount();
} }
@@ -404,9 +404,9 @@ abstract class DibiResult implements IteratorAggregate, Countable
* Access to undeclared property * Access to undeclared property
* @throws Exception * @throws Exception
*/ */
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
/**#@-*/ /**#@-*/
} // class DibiResult } // class DibiResult
@@ -437,7 +437,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
* } * }
* </code> * </code>
*/ */
class DibiResultIterator implements Iterator final class DibiResultIterator implements Iterator
{ {
private private
$result, $result,

View File

@@ -21,7 +21,7 @@ if (!class_exists('dibi', FALSE)) die();
* dibi translator * dibi translator
* *
*/ */
class DibiTranslator final class DibiTranslator
{ {
private private
$driver, $driver,
@@ -381,9 +381,9 @@ class DibiTranslator
* Access to undeclared property * Access to undeclared property
* @throws Exception * @throws Exception
*/ */
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); } final function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
/**#@-*/ /**#@-*/
} // class DibiParser } // class DibiParser