mirror of
https://github.com/dg/dibi.git
synced 2025-08-09 23:56:58 +02:00
Driver's reflection capabilities moved to IDibiReflector
This commit is contained in:
@@ -89,7 +89,7 @@ class DibiConnection extends DibiObject
|
||||
$this->config = $config;
|
||||
$this->driver = new $class;
|
||||
|
||||
// profiler
|
||||
// profiler
|
||||
$profilerCfg = & $config['profiler'];
|
||||
if (is_numeric($profilerCfg) || is_bool($profilerCfg)) { // back compatibility
|
||||
$profilerCfg = array('run' => (bool) $profilerCfg);
|
||||
@@ -717,6 +717,9 @@ class DibiConnection extends DibiObject
|
||||
*/
|
||||
public function getDatabaseInfo()
|
||||
{
|
||||
if (!($this->driver instanceof IDibiReflector)) {
|
||||
throw new NotSupportedException('Driver '. get_class($this->driver) . ' has not reflection capabilities.');
|
||||
}
|
||||
$this->connect();
|
||||
return new DibiDatabaseInfo($this->driver, isset($this->config['database']) ? $this->config['database'] : NULL);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
class DibiDatabaseInfo extends DibiObject
|
||||
{
|
||||
/** @var IDibiDriver */
|
||||
/** @var IDibiReflector */
|
||||
private $driver;
|
||||
|
||||
/** @var string */
|
||||
@@ -35,7 +35,7 @@ class DibiDatabaseInfo extends DibiObject
|
||||
|
||||
|
||||
|
||||
public function __construct(IDibiDriver $driver, $name)
|
||||
public function __construct(IDibiReflector $driver, $name)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
$this->name = $name;
|
||||
@@ -145,7 +145,7 @@ class DibiDatabaseInfo extends DibiObject
|
||||
*/
|
||||
class DibiTableInfo extends DibiObject
|
||||
{
|
||||
/** @var IDibiDriver */
|
||||
/** @var IDibiReflector */
|
||||
private $driver;
|
||||
|
||||
/** @var string */
|
||||
@@ -168,7 +168,7 @@ class DibiTableInfo extends DibiObject
|
||||
|
||||
|
||||
|
||||
public function __construct(IDibiDriver $driver, array $info)
|
||||
public function __construct(IDibiReflector $driver, array $info)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
$this->name = $info['name'];
|
||||
@@ -349,7 +349,7 @@ class DibiTableInfo extends DibiObject
|
||||
*/
|
||||
class DibiResultInfo extends DibiObject
|
||||
{
|
||||
/** @var IDibiDriver */
|
||||
/** @var IDibiReflector */
|
||||
private $driver;
|
||||
|
||||
/** @var array */
|
||||
@@ -360,7 +360,7 @@ class DibiResultInfo extends DibiObject
|
||||
|
||||
|
||||
|
||||
public function __construct(IDibiDriver $driver)
|
||||
public function __construct(IDibiReflector $driver)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ class DibiColumnInfo extends DibiObject
|
||||
/** @var array */
|
||||
private static $types;
|
||||
|
||||
/** @var IDibiDriver */
|
||||
/** @var IDibiReflector */
|
||||
private $driver;
|
||||
|
||||
/** @var array (name, nativetype, [table], [fullname], [size], [nullable], [default], [autoincrement], [vendor]) */
|
||||
@@ -477,7 +477,7 @@ class DibiColumnInfo extends DibiObject
|
||||
|
||||
|
||||
|
||||
public function __construct(IDibiDriver $driver, array $info)
|
||||
public function __construct(IDibiReflector $driver, array $info)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
$this->info = $info;
|
||||
|
@@ -127,7 +127,7 @@ class DibiFluent extends DibiObject implements IDataSource
|
||||
$this->command = $clause;
|
||||
}
|
||||
|
||||
// auto-switch to a clause
|
||||
// auto-switch to a clause
|
||||
if (isset(self::$clauseSwitches[$clause])) {
|
||||
$this->cursor = & $this->clauses[self::$clauseSwitches[$clause]];
|
||||
}
|
||||
|
@@ -231,12 +231,20 @@ interface IDibiDriver
|
||||
* @return mixed
|
||||
*/
|
||||
function getResultResource();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* dibi driver reflection.
|
||||
*
|
||||
* @copyright Copyright (c) 2005, 2010 David Grudl
|
||||
* @package dibi
|
||||
*/
|
||||
interface IDibiReflector
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns list of tables.
|
||||
|
Reference in New Issue
Block a user