malenki/desbaies

Some classes for create SQL query without SQL code.

0.1.0 2013-04-23 21:30 UTC

This package is not auto-updated.

Last update: 2024-11-18 12:25: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;