1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-29 16:59:49 +02:00

* better datetime converting in DibiResult (see http://forum.dibiphp.com/viewtopic.php?pid=2331)

* added support for Nette_Debug
* renamed NObject -> Nette_Object (Nette::Object in PHP 5.3)
This commit is contained in:
David Grudl
2008-04-03 12:40:04 +00:00
parent 2632953541
commit 24bf999cd9
23 changed files with 121 additions and 35 deletions

View File

@@ -32,8 +32,8 @@ if (version_compare(PHP_VERSION, '5.1.0', '<')) {
// nette libraries
if (!class_exists('NotImplementedException', FALSE)) { require_once dirname(__FILE__) . '/Nette/exceptions.php'; }
if (!class_exists('NObject', FALSE)) { require_once dirname(__FILE__) . '/Nette/Object.php'; }
if (!interface_exists('IDebuggable', FALSE)) { require_once dirname(__FILE__) . '/Nette/IDebuggable.php'; }
if (!class_exists('Nette_Object', FALSE)) { require_once dirname(__FILE__) . '/Nette/Object.php'; }
if (!interface_exists('Nette_IDebuggable', FALSE)) { require_once dirname(__FILE__) . '/Nette/IDebuggable.php'; }
// dibi libraries
require_once dirname(__FILE__) . '/libs/interfaces.php';
@@ -154,6 +154,10 @@ class dibi
/********************* connections handling ****************d*g**/
/**
* Creates a new DibiConnection object and connects it to specified database.
*
@@ -164,7 +168,11 @@ class dibi
*/
public static function connect($config = array(), $name = 0)
{
if (is_array($config) || $config instanceof IMap) {
if (class_exists('Nette_Debug', FALSE) && Nette_Debug::isEnabled()) {
Nette_Debug::addColophon(array(__CLASS__, 'getColophon'));
}
if (is_array($config) || $config instanceof Nette_Collections_IMap) {
$config['name'] = $name;
} else {
$config .= '&name=' . urlencode($name);
@@ -238,6 +246,10 @@ class dibi
/********************* monostate for active connection ****************d*g**/
/**
* Generates and executes SQL query - Monostate for DibiConnection::query().
*
@@ -413,6 +425,10 @@ class dibi
/********************* data types ****************d*g**/
/**
* Pseudotype for timestamp representation.
*
@@ -448,6 +464,10 @@ class dibi
/********************* substitutions ****************d*g**/
/**
* Create a new substitution pair for indentifiers.
*
@@ -491,6 +511,10 @@ class dibi
/********************* event handling ****************d*g**/
/**
* Add new event handler.
*
@@ -543,6 +567,10 @@ class dibi
/********************* misc tools ****************d*g**/
/**
* Prints out a syntax highlighted version of the SQL command or DibiResult.
*
@@ -604,4 +632,17 @@ class dibi
}
/**
* Returns brief descriptions.
* @return array
*/
public static function getColophon()
{
return array(
'dibi version: ' . dibi::VERSION,
'Number or queries: ' . dibi::$numOfQueries . (dibi::$totalTime === NULL ? '' : ' (elapsed time: ' . sprintf('%0.3f', dibi::$totalTime * 1000) . ' ms)'),
);
}
}