This package is abandoned and no longer maintained. No replacement package was suggested.

Chain-able asynchronous query builder for MySQL PDO

v1.0.1 2012-12-02 18:30 UTC


Created and Copyright 2012-2013 by Jarvis Badgley, chiper at chipersoft dot com.

Primal.Query is a chain-able asynchronous query builder class which allows for easy construction and execution of complex queries with data escapement.

Primal PHP is a collection of independent PHP micro-libraries.


Primal.Query requires PHP 5.3 (tested under 5.3.10). Use of the built in execution methods (select(), insert(), delete(), etc) requires the PHP Data Objects (PDO) extension be installed and configured.


A Query object can be initialized directly via the new operator, but the intended implementation is for initial properties to be chained off of a static initialization method. Example:

$q=Primal\Query\MySQL::Make($pdo) //$pdo contains your PDO link object
   ->leftJoin("user_billing b USING (user_id)")
   ->returns('', '', 'b.start_date')
   ->whereDateInRange('b.start_date', new DateTime('yesterday'));
$results = $q->select();

If you wish to run the query yourself instead of using the built in execution functions, the build* functions will return a tuple array containing the query text and an array of all named parameters.


Method documentation is still forthcoming. In the meantime please use the doc comments in the class itself.