Query Builder internals
"Jukka Zitting" <[email protected]> Thu, 23 Feb 2006 14:57:29 +0200
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
The query_builder.c source file has seen almost a hundred changes
since it was created in April last year. Despite a number of
discussions there hasn't been a very clear roadmap or shared
understanding of what the QB should look like, and as a result the QB
internals are already showing signs of software rot (see for example
the _mqb_get_new_property function).
I'd like to start an effort to clean up and document the QB internals
in order to build a stronger base for Midgard 2.0 and to solve the
current performance issues that are more caused by the implementation
than any inherent design defect.
To start with I'm planning to set up some unit tests that would be
able to check the SQL queries generated by the QB for a number of
common cases. For example the ideal queries for a non-multilang schema
"foo" would look something like this:
$qb = new midgard_query_builder("foo");
...
$qb->execute():
SELECT ... FROM foo WHERE ...
$qb->count():
SELECT count(*) FROM foo WHERE ...
$qb->distinct("bar"):
SELECT DISTINCT bar FROM foo WHERE ...
I'm also hoping to extend the PHP unit test suite created by Tarjei to
more completely cover of the various QB corner cases. Once this is
done we can feel a lot safer about refactoring the QB internals.
BR,
Jukka Zitting
--
Yukatan - http://yukatan.fi/ - [email protected]
Software craftsmanship, JCR consulting, and Java development