malenki/desbaies

Some classes for create SQL query without SQL code.

Installs: 1

Dependents: 0

Watchers: 1

Open Issues: 1

Language: PHP

0.1.0 2013-04-23 21:30 UTC

README

Some classes for create SQL query without SQL code. Allow execution too, but there are not ORM layer.

Simple example:

use \Malenki\DesBaies;

$db = new DesBaies();
$db->select->add('foo');
$db->from->add('bar');

give:

SELECT `foo`
FROM `bar`;

More complex example:

use \Malenki\DesBaies;

$db = new DesBaies();
$db->select->add('foo', 'b')->add('foo2', 'b2');
$db->from->add('bar', 'b');
$db->from->add('bar2', 'b2');
$db->order->by('foo', 'b')->desc->by('foo2', 'b2');

give:

SELECT `b`.`foo`, `b2`.`foo2`
FROM `bar` AS `b`, `bar2` AS `b2`
ORDER BY `b`.`foo` DESC, `b2`.`foo2` ASC;