The Elgg Community: SimpleQuery Classes

http://community.elgg.org/mod/groups/topicposts.php?topic=195749&group_guid=7

I was browsing through some of Elgg's code and an undocumented class that isn't mentioned or used anywhere is the Query class abstraction for simple queries as well as complex queries.

I haven't seen any mods that are using this class, so I might start up a small tutorial to show how to query certain things with it. SimpleQuery extension of the Query class makes writing safe queries easier.

What I'm trying to reason though is why the Elgg community didn't use PHP's prepared statements instead of writing this Query abstraction? Take a look at it here:

http://us3.php.net/manual/en/pdo.prepare.php

<!-- end the topic_post --> <!-- start the topic_post -->

mahmoudimus
yesterday

Very cool!

Check this code out:

$query  = new SimpleQuery();
$query->simpleTable("annotations");
$query->simpleSelectField("annotations", "id");
$query->simpleWhereOnValue("annotations", "id", "=", "2");
$row = get_data($query); // or optionally echo $query;

Very nice and easy:)

Georg Westphalen

a former physician specializing in creative concepts, outrageous comics, hilarious character designs and urban philosophy.