Experimental chainable database query building class
I've tried to implement database query building class, that uses chainable
pattern (will only work in PHP5). Following code will work in any place,
where "$this->Conn" is available.
$sql = $this->Conn->dbQuery(DB_QUERY_TYPE_SELECT, TABLE_PREFIX .
'PortalUser u')
->field('u.PortalUserId')->field('u.Login')->field(Array ('u.dob',
'u.Status'))
->join(TABLE_PREFIX . 'Images i', 'i.ResourceId =
u.ResourceId')->limit(15, 10)
->finish();
echo 'SQL: [' . $sql . ']' . "\n\n\n";
Works really quick actually. Only SELECT queries are supported, but if such
approach proves useful, then other database query types support will be
added as well.
Also such indirect query building code allows us to use other, then MySQL
database in future.
See kDBQuery class for more details.
--
Best Regards,
http://www.in-portal.com
http://www.alex-time.com