Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
a300634b
Commit
a300634b
authored
Oct 19, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DQL UPDATE / DELETE statement docs added
parent
8b87b3ea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
40 deletions
+86
-40
DQL (Doctrine Query Language) - DELETE queries.php
.../codes/DQL (Doctrine Query Language) - DELETE queries.php
+15
-0
DQL (Doctrine Query Language) - UPDATE queries.php
.../codes/DQL (Doctrine Query Language) - UPDATE queries.php
+16
-0
DQL (Doctrine Query Language) - DELETE queries.php
...l/docs/DQL (Doctrine Query Language) - DELETE queries.php
+20
-0
DQL (Doctrine Query Language) - Introduction.php
manual/docs/DQL (Doctrine Query Language) - Introduction.php
+4
-28
DQL (Doctrine Query Language) - UPDATE queries.php
...l/docs/DQL (Doctrine Query Language) - UPDATE queries.php
+24
-0
documentation.php
manual/documentation.php
+7
-12
No files found.
manual/codes/DQL (Doctrine Query Language) - DELETE queries.php
0 → 100644
View file @
a300634b
<?php
$q
=
'DELETE FROM Account WHERE id > ?'
;
$rows
=
$this
->
conn
->
query
(
$q
,
array
(
3
));
// the same query using the query interface
$q
=
new
Doctrine_Query
();
$rows
=
$q
->
update
(
'Account'
)
->
where
(
'id > ?'
)
->
execute
(
array
(
3
));
print
$rows
;
// the number of affected rows
?>
manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php
0 → 100644
View file @
a300634b
<?php
$q
=
'UPDATE Account SET amount = amount + 200 WHERE id > 200'
;
$rows
=
$this
->
conn
->
query
(
$q
);
// the same query using the query interface
$q
=
new
Doctrine_Query
();
$rows
=
$q
->
update
(
'Account'
)
->
set
(
'amount'
,
'amount + 200'
)
->
where
(
'id > 200'
)
->
execute
();
print
$rows
;
// the number of affected rows
?>
manual/docs/DQL (Doctrine Query Language) - DELETE queries.php
0 → 100644
View file @
a300634b
<div
class=
'sql'
>
<pre>
DELETE FROM
<i>
component_name
</i>
[WHERE
<i>
where_condition
</i>
]
[ORDER BY ...]
[LIMIT
<i>
record_count
</i>
]
</pre>
</div>
<ul>
<li
\
>
The DELETE statement deletes records from
<i>
component_name
</i>
and returns the number of records deleted.
<li
\
>
The optional WHERE clause specifies the conditions that identify which records to delete.
Without WHERE clause, all records are deleted.
<li
\
>
If the ORDER BY clause is specified, the records are deleted in the order that is specified.
<li
\
>
The LIMIT clause places a limit on the number of rows that can be deleted.
The statement will stop as soon as it has deleted
<i>
record_count
</i>
records.
</ul>
manual/docs/DQL (Doctrine Query Language) - Introduction.php
View file @
a300634b
...
...
@@ -9,39 +9,15 @@ When compared to using raw SQL, DQL has several benefits: <br \>
<
li
\
>
DQL
understands
relations
so
you
don
't have to type manually sql joins and join conditions
</ul>
<ul>
<li \>DQL is portable on different databases
</ul>
<ul>
<li \>DQL has some very complex built-in algorithms like (the record limit algorithm) which can help
developer to efficiently retrieve objects
</ul>
<ul>
<li \>It supports some
many functions that help
dealing with one-to-many, many-to-many relational data with conditional fetching.
<li \>It supports some
functions that can save time when
dealing with one-to-many, many-to-many relational data with conditional fetching.
</ul>
If the power of DQL isn'
t
enough
,
you
should
consider
using
the
rawSql
API
for
object
population
.
Standard
DQL
query
consists
of
the
following
parts
:
<
ul
>
<
li
\
>
a
FROM
clause
,
which
provides
declarations
that
designate
the
domain
to
which
the
expressions
specified
in
the
other
clauses
of
the
query
apply
.
</
ul
>
<
ul
>
<
li
\
>
an
optional
WHERE
clause
,
which
may
be
used
to
restrict
the
results
that
are
returned
by
the
query
.
</
ul
>
<
ul
>
<
li
\
>
an
optional
GROUP
BY
clause
,
which
allows
query
results
to
be
aggregated
in
terms
of
groups
.
</
ul
>
<
ul
>
<
li
\
>
an
optional
HAVING
clause
,
which
allows
filtering
over
aggregated
groups
.
</
ul
>
<
ul
>
<
li
\
>
an
optional
ORDER
BY
clause
,
which
may
be
used
to
order
the
results
that
are
returned
by
the
query
.
</
ul
>
<
br
\
>
In
BNF
syntax
,
a
select
statement
is
defined
as
:
select_statement
::
=
select_clause
from_clause
[
where_clause
]
[
groupby_clause
]
[
having_clause
]
[
orderby_clause
]
<
br
\
>
A
select
statement
must
always
have
a
SELECT
and
a
FROM
clause
.
The
square
brackets
[]
indicate
that
the
other
clauses
are
optional
.
manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php
0 → 100644
View file @
a300634b
UPDATE
statement
syntax
:
<
div
class
='
sql
'
>
<
pre
>
UPDATE
<
i
>
component_name
</
i
>
SET
<
i
>
col_name1
</
i
>=<
i
>
expr1
</
i
>
[,
<
i
>
col_name2
</
i
>=<
i
>
expr2
</
i
>
...
]
[
WHERE
<
i
>
where_condition
</
i
>
]
[
ORDER
BY
...
]
[
LIMIT
<
i
>
record_count
</
i
>
]
</
pre
>
</
div
>
<
ul
>
<
li
\
>
The
UPDATE
statement
updates
columns
of
existing
records
in
<
i
>
component_name
</
i
>
with
new
values
and
returns
the
number
of
affected
records
.
<
li
\
>
The
SET
clause
indicates
which
columns
to
modify
and
the
values
they
should
be
given
.
<
li
\
>
The
optional
WHERE
clause
specifies
the
conditions
that
identify
which
records
to
update
.
Without
WHERE
clause
,
all
records
are
updated
.
<
li
\
>
The
optional
ORDER
BY
clause
specifies
the
order
in
which
the
records
are
being
updated
.
<
li
\
>
The
LIMIT
clause
places
a
limit
on
the
number
of
records
that
can
be
updated
.
You
can
use
LIMIT
row_count
to
restrict
the
scope
of
the
UPDATE
.
A
LIMIT
clause
is
a
<
b
>
rows
-
matched
restriction
</
b
>
not
a
rows
-
changed
restriction
.
The
statement
stops
as
soon
as
it
has
found
<
i
>
record_count
</
i
>
rows
that
satisfy
the
WHERE
clause
,
whether
or
not
they
actually
were
changed
.
</
ul
>
manual/documentation.php
View file @
a300634b
...
...
@@ -304,9 +304,14 @@ $menu = array("Getting started" =>
"OffsetIterator")
*/
),
"DQL (Doctrine Query Language)"
=>
array
(
'Introduction'
,
array
(
'Introduction'
,
'SELECT queries'
,
'UPDATE queries'
,
'DELETE queries'
,
'FROM clause'
,
'WHERE clause'
,
'Conditional expressions'
=>
...
...
@@ -323,7 +328,7 @@ $menu = array("Getting started" =>
'Empty Collection Comparison Expressions'
,
'Collection Member Expressions'
,
'Exists Expressions'
,
'All
or
Any Expressions'
,
'All
and
Any Expressions'
,
'Subqueries'
),
'Functional Expressions'
=>
array
(
'String functions'
,
...
...
@@ -336,16 +341,6 @@ $menu = array("Getting started" =>
'LIMIT and OFFSET clauses'
,
'Examples'
,
'BNF'
),
/**
'Functions' => array(
'Contains',
'Regexp',
'Like'),
'Operators' => array(
'Logical operators')
*/
"Transactions"
=>
array
(
"Introduction"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment