Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/9e52b6f489b9d472#

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

  • No labels