From 45e9bc8420b82006b24e82d615cb198b06ccfbec Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 20 Oct 2006 19:31:37 +0000 Subject: [PATCH] DQL new docs, refs #181 --- ... expressions - All and Any Expressions.php | 0 ...l expressions - All or Any Expressions.php | 0 ...onal expressions - Between expressions.php | 1 + ...ional expressions - Exists Expressions.php | 0 ...nditional expressions - In expressions.php | 0 ...itional expressions - Input parameters.php | 14 ++++++++++++++ ...itional expressions - Like Expressions.php | 8 ++++++++ ...) - Conditional expressions - Literals.php | 0 ...ns - Operators and operator precedence.php | 0 ...itional expressions - Path expressions.php | 0 ...- Conditional expressions - Subqueries.php | 19 +++++++++++++++++++ ...L (Doctrine Query Language) - Examples.php | 0 ...Doctrine Query Language) - FROM clause.php | 0 ...nal Expressions - Arithmetic Functions.php | 0 ...nal Expressions - Collection functions.php | 0 ...ional Expressions - Datetime Functions.php | 0 ...ctional Expressions - String Functions.php | 0 ...y Language) - GROUP BY, HAVING clauses.php | 10 ++++++++++ ...y Language) - LIMIT and OFFSET clauses.php | 14 ++++++++++++++ ...trine Query Language) - SELECT queries.php | 0 ...octrine Query Language) - WHERE clause.php | 0 21 files changed, 66 insertions(+) create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Literals.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Examples.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - FROM clause.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic Functions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Datetime Functions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - String Functions.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - SELECT queries.php create mode 100644 manual/codes/DQL (Doctrine Query Language) - WHERE clause.php diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php new file mode 100644 index 000000000..d3f5a12fa --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php @@ -0,0 +1 @@ + diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php new file mode 100644 index 000000000..48eac3fca --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php @@ -0,0 +1,14 @@ +query("FROM User WHERE User.name = ?", array('Arnold')); + +$users = $conn->query("FROM User WHERE User.id > ? AND User.name LIKE ?", array(50, 'A%')); + + +// NAMED PARAMETERS: + +$users = $conn->query("FROM User WHERE User.name = :name", array(':name' => 'Arnold')); + +$users = $conn->query("FROM User WHERE User.id > :id AND User.name LIKE :name", array(':id' => 50, ':name' => 'A%')); +?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php new file mode 100644 index 000000000..7312d7452 --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php @@ -0,0 +1,8 @@ +query("FROM User u, u.Email e WHERE e.address LIKE '%@gmail.com'"); + +// finding all users whose name starts with letter 'A' +$users = $conn->query("FROM User u WHERE u.name LIKE 'A%'"); +?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Literals.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Literals.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php new file mode 100644 index 000000000..e9ddef1da --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php @@ -0,0 +1,19 @@ +query($query, array(1)); + +// finding all users which don't belong to any groups +// Notice: +// the usage of INNER JOIN +// the usage of empty brackets preceding the Group component + +$query = "FROM User WHERE User.id NOT IN + (SELECT u.id FROM User u + INNER JOIN u.Group g)"; + +$users = $conn->query($query); +?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Examples.php b/manual/codes/DQL (Doctrine Query Language) - Examples.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - FROM clause.php b/manual/codes/DQL (Doctrine Query Language) - FROM clause.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic Functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic Functions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Datetime Functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Datetime Functions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - String Functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - String Functions.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php b/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php new file mode 100644 index 000000000..c2e952ecb --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php @@ -0,0 +1,10 @@ +query("SELECT u.*, COUNT(p.id) count FROM User u, u.Phonenumber p GROUP BY u.id"); + +foreach($users as $user) { + print $user->name . ' has ' . $user->Phonenumber->getAggregateValue('count') . ' phonenumbers'; +} +?> diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php new file mode 100644 index 000000000..b9dc2e986 --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php @@ -0,0 +1,14 @@ +query("SELECT u.*, p.* FROM User u, u.Phonenumber p LIMIT 20"); + +foreach($users as $user) { + print ' --- '.$user->name.' --- \n'; + + foreach($user->Phonenumber as $p) { + print $p->phonenumber.'\n'; + } +} +?> diff --git a/manual/codes/DQL (Doctrine Query Language) - SELECT queries.php b/manual/codes/DQL (Doctrine Query Language) - SELECT queries.php new file mode 100644 index 000000000..e69de29bb diff --git a/manual/codes/DQL (Doctrine Query Language) - WHERE clause.php b/manual/codes/DQL (Doctrine Query Language) - WHERE clause.php new file mode 100644 index 000000000..e69de29bb