1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
zYne 2007-11-20 19:22:33 +00:00
parent 050c76bfdc
commit 3fe787972a
2 changed files with 15 additions and 8 deletions

View File

@ -1,3 +1,15 @@
DQL GROUP BY syntax:
<code>
GROUP BY groupby_item {, groupby_item}*
</code>
DQL HAVING syntax:
<code>
HAVING conditional_expression
</code>
* GROUP BY and HAVING clauses can be used for dealing with aggregate functions
* Following aggregate functions are available on DQL: COUNT, MAX, MIN, AVG, SUM

View File

@ -1,3 +1,5 @@
Propably the most complex feature DQL parser has to offer is its LIMIT clause parser. Not only does the DQL LIMIT clause parser take care of LIMIT database portability it is capable of limiting the number of records instead of rows by using complex query analysis and subqueries.
<code type="php">
// retrieve the first 20 users and all their associated phonenumbers
@ -12,12 +14,6 @@ foreach($users as $user) {
}
</code>
+++ Introduction
Propably the most complex feature DQL parser has to offer is its LIMIT clause parser. Not only does the DQL LIMIT clause parser take care of LIMIT database portability it is capable of limiting the number of records instead of rows by using complex query analysis and subqueries.
+++ Driver portability
DQL LIMIT clause is portable on all supported databases. Special attention have been paid to following facts:
@ -25,10 +21,9 @@ DQL LIMIT clause is portable on all supported databases. Special attention have
* Only Mysql, Pgsql and Sqlite implement LIMIT / OFFSET clauses natively
* In Oracle / Mssql / Firebird LIMIT / OFFSET clauses need to be emulated in driver specific way
* The limit-subquery-algorithm needs to execute to subquery separately in mysql, since mysql doesn't yet support LIMIT clause in subqueries
* Pgsql needs the order by fields to be preserved in SELECT clause, hence LS-algorithm needs to take this into consideration when pgsql driver is used
* Pgsql needs the order by fields to be preserved in SELECT clause, hence limit-subquery-algorithm needs to take this into consideration when pgsql driver is used
* Oracle only allows < 30 object identifiers (= table/column names/aliases), hence the limit subquery must use as short aliases as possible and it must avoid alias collisions with the main query.
+++ The limit-subquery-algorithm
The limit-subquery-algorithm is an algorithm that DQL parser uses internally when one-to-many / many-to-many relational data is being fetched simultaneously. This kind of special algorithm is needed for the LIMIT clause to limit the number of records instead of sql result set rows.