1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 13:47:33 +02:00

- added fetch() methods into DibiConnection

- public $useFirebug
This commit is contained in:
David Grudl
2008-12-07 23:59:04 +00:00
parent 9244a1b1b5
commit 781274ba65
2 changed files with 62 additions and 1 deletions

View File

@@ -570,6 +570,66 @@ class DibiConnection extends DibiObject
/********************* shortcuts ****************d*g**/
/**
* Executes SQL query and fetch result - shortcut for query() & fetch().
* @param array|mixed one or more arguments
* @return DibiRow
* @throws DibiException
*/
public function fetch($args)
{
$args = func_get_args();
return $this->query($args)->fetch();
}
/**
* Executes SQL query and fetch results - shortcut for query() & fetchAll().
* @param array|mixed one or more arguments
* @return array of DibiRow
* @throws DibiException
*/
public function fetchAll($args)
{
$args = func_get_args();
return $this->query($args)->fetchAll();
}
/**
* Executes SQL query and fetch first column - shortcut for query() & fetchSingle().
* @param array|mixed one or more arguments
* @return string
* @throws DibiException
*/
public function fetchSingle($args)
{
$args = func_get_args();
return $this->query($args)->fetchSingle();
}
/**
* Executes SQL query and fetch pairs - shortcut for query() & fetchPairs().
* @param array|mixed one or more arguments
* @return string
* @throws DibiException
*/
public function fetchPairs($args)
{
$args = func_get_args();
return $this->query($args)->fetchPairs();
}
/********************* misc ****************d*g**/ /********************* misc ****************d*g**/
@@ -613,6 +673,7 @@ class DibiConnection extends DibiObject
*/ */
public function getDatabaseInfo() public function getDatabaseInfo()
{ {
$this->connect();
return new DibiDatabaseInfo($this->driver, isset($this->config['database']) ? $this->config['database'] : NULL); return new DibiDatabaseInfo($this->driver, isset($this->config['database']) ? $this->config['database'] : NULL);
} }

View File

@@ -33,7 +33,7 @@ class DibiProfiler extends DibiObject implements IDibiProfiler
private $file; private $file;
/** @var bool log to firebug? */ /** @var bool log to firebug? */
private $useFirebug; public $useFirebug;
/** @var int */ /** @var int */
private $filter = self::ALL; private $filter = self::ALL;