From 42f7cb706ff58c00edfa1e61be046da74926d6b7 Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 10 Oct 2006 20:52:10 +0000 Subject: [PATCH] new DQL docs --- ...ional expressions - Exists Expressions.php | 26 ++++++++++ ...nditional expressions - In expressions.php | 6 ++- ...) - Conditional expressions - Literals.php | 50 +++++++++++++++++++ ...- Conditional expressions - Subqueries.php | 11 ++++ 4 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php create mode 100644 manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php create mode 100644 manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php new file mode 100644 index 000000000..f8e2ebcc7 --- /dev/null +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php @@ -0,0 +1,26 @@ +Syntax: +
+
+operand [NOT ]EXISTS (subquery)
+
+
+The EXISTS operator returns TRUE if the subquery returns one or more rows and FALSE otherwise.
+
+The NOT EXISTS operator returns TRUE if the subquery returns 0 rows and FALSE otherwise.
+
+Finding all articles which have readers: +
+
+FROM Article
+  WHERE EXISTS (FROM ReaderLog(id)
+                WHERE ReaderLog.article_id = Article.id)
+
+
+Finding all articles which don't have readers: +
+
+FROM Article
+  WHERE NOT EXISTS (FROM ReaderLog(id)
+                WHERE ReaderLog.article_id = Article.id)
+
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php index 040c28d9d..ba8406719 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php @@ -1,13 +1,15 @@ Syntax:
-operand IN (subquery|valuelist)
+operand IN (subquery|value list)
 
An IN conditional expression returns true if the operand is found from result of the subquery -or if its in the specificied comma separated valuelist, hence the IN expression is always false if the result of the subquery +or if its in the specificied comma separated value list, hence the IN expression is always false if the result of the subquery is empty. +When value list is being used there must be at least one element in that list. +
 FROM C1 WHERE C1.col1 IN (FROM C2(col1));
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php
new file mode 100644
index 000000000..29fd3a35a
--- /dev/null
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php	
@@ -0,0 +1,50 @@
+Strings
+ +A string literal is enclosed in single quotes—for example: 'literal'. A string literal that includes a single +quote is represented by two single quotes—for example: 'literal''s'. +
+
+FROM User WHERE User.name = 'Vincent'
+
+
+ +Integers
+Integer literals support the use of PHP integer literal syntax. +
+
+FROM User WHERE User.id = 4
+
+
+ +Floats
+Float literals support the use of PHP float literal syntax. +
+
+FROM Account WHERE Account.amount = 432.123
+
+
+ +
+Booleans
+The boolean literals are true and false. + +
+
+FROM User WHERE User.admin = true
+
+FROM Session WHERE Session.is_authed = false
+
+
+ +
+Enums
+The enumerated values work in the same way as string literals. + +
+
+FROM User WHERE User.type = 'admin'
+
+
+ +
+Predefined reserved literals are case insensitive, although its a good standard to write them in uppercase. diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php new file mode 100644 index 000000000..54a4c4f1c --- /dev/null +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php @@ -0,0 +1,11 @@ +A subquery can contain any of the keywords or clauses that an ordinary SELECT query can contain. +

+Some advantages of the subqueries: +
    +
  • They allow queries that are structured so that it is possible to isolate each part of a statement. + +
  • They provide alternative ways to perform operations that would otherwise require complex joins and unions. + +
  • They are, in many people's opinion, readable. Indeed, it was the innovation of subqueries that gave people the original idea of calling the early SQL “Structured Query Language.” + +