1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-18 03:41:30 +02:00

- added fluent SQL builders support in DibiConnection and DibiTable

This commit is contained in:
David Grudl
2008-09-13 16:38:59 +00:00
parent 96c69f5bed
commit 8c4211d5be
10 changed files with 124 additions and 17 deletions

View File

@@ -456,6 +456,72 @@ class DibiConnection extends DibiObject
/********************* fluent SQL builders ****************d*g**/
/**
* @return DibiFluent
*/
public function command()
{
return new DibiFluent($this);
}
/**
* @param string column name
* @return DibiFluent
*/
public function select($args)
{
$args = func_get_args();
return $this->command()->__call('select', $args);
}
/**
* @param string table
* @param array
* @return DibiFluent
*/
public function update($table, array $args)
{
return $this->command()->update('%n', $table)->set($args);
}
/**
* @param string table
* @param array
* @return DibiFluent
*/
public function insert($table, array $args)
{
return $this->command()->insert()
->into('%n', $table, '(%n)', array_keys($args))->values('%l', array_values($args));
}
/**
* @param string table
* @return DibiFluent
*/
public function delete($table)
{
return $this->command()->delete()->from('%n', $table);
}
/********************* misc ****************d*g**/
/**
* Import SQL dump from file - extreme fast!
*