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
34ecd304
Commit
34ecd304
authored
Nov 08, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doctrine_Query::where() now accepts prepared statement parameters
parent
188520e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
10 deletions
+33
-10
Query.php
lib/Doctrine/Query.php
+7
-0
QueryWhereTestCase.php
tests/QueryWhereTestCase.php
+20
-0
run.php
tests/run.php
+6
-10
No files found.
lib/Doctrine/Query.php
View file @
34ecd304
...
...
@@ -349,6 +349,13 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$parser
->
parse
(
$args
[
0
]);
break
;
case
'where'
:
if
(
isset
(
$args
[
1
]))
{
if
(
is_array
(
$args
[
1
]))
{
$this
->
params
=
$args
[
1
];
}
else
{
$this
->
params
=
array
(
$args
[
1
]);
}
}
case
'having'
:
case
'orderby'
:
case
'groupby'
:
...
...
tests/QueryWhereTestCase.php
View file @
34ecd304
...
...
@@ -22,6 +22,7 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$users
->
count
(),
1
);
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
}
public
function
testDirectMultipleParameterSetting
()
{
$user
=
new
User
();
$user
->
name
=
'someone.2'
;
...
...
@@ -37,7 +38,26 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
$this
->
assertEqual
(
$users
[
1
]
->
name
,
'someone.2'
);
}
public
function
testDirectMultipleParameterSetting2
()
{
$q
=
new
Doctrine_Query
();
$q
->
from
(
'User(id)'
)
->
where
(
'User.id IN (?, ?)'
,
array
(
1
,
2
));
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
->
count
(),
2
);
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
$this
->
assertEqual
(
$users
[
1
]
->
name
,
'someone.2'
);
// the parameters and where part should be reseted
$q
->
where
(
'User.id IN (?, ?)'
,
array
(
1
,
2
));
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
->
count
(),
2
);
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
$this
->
assertEqual
(
$users
[
1
]
->
name
,
'someone.2'
);
}
public
function
testNotInExpression
()
{
$q
=
new
Doctrine_Query
();
...
...
tests/run.php
View file @
34ecd304
...
...
@@ -66,12 +66,11 @@ error_reporting(E_ALL);
print
'<pre>'
;
$test
=
new
GroupTest
(
'Doctrine Framework Unit Tests'
);
$test
->
addTestCase
(
new
Doctrine_Db_Profiler_TestCase
());
/**
$test->addTestCase(new Doctrine_Db_TestCase());
$test->addTestCase(new Doctrine_Db_Profiler_TestCase());
$test->addTestCase(new Doctrine_Query_MultiJoin_TestCase());
$test->addTestCase(new Doctrine_Record_TestCase());
...
...
@@ -92,12 +91,10 @@ $test->addTestCase(new Doctrine_SchemaTestCase());
$test->addTestCase(new Doctrine_ValidatorTestCase());
$test->addTestCase(new Doctrine_EventListenerTestCase());
$test->addTestCase(new Doctrine_Connection_Transaction_TestCase());
$test->addTestCase(new Doctrine_AccessTestCase());
$test->addTestCase(new Doctrine_TableTestCase());
...
...
@@ -136,7 +133,7 @@ $test->addTestCase(new Doctrine_CustomResultSetOrderTestCase());
$test->addTestCase(new Doctrine_BooleanTestCase());
$test->addTestCase(new Doctrine_Record_Filter_TestCase());
//
$test->addTestCase(new Doctrine_Record_Filter_TestCase());
$test->addTestCase(new Doctrine_Query_Condition_TestCase());
...
...
@@ -148,19 +145,18 @@ $test->addTestCase(new Doctrine_EnumTestCase());
$test->addTestCase(new Doctrine_Query_TestCase());
$test->addTestCase(new Doctrine_Query_ShortAliases_TestCase());
$test->addTestCase(new Doctrine_Query_Where_TestCase());
$test->addTestCase(new Doctrine_Query_ShortAliases_TestCase());
$test->addTestCase(new Doctrine_Query_From_TestCase());
$test->addTestCase(new Doctrine_Query_Delete_TestCase());
$test->addTestCase(new Doctrine_Query_Update_TestCase());
*/
$test
->
addTestCase
(
new
Doctrine_Query_Where_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Limit_TestCase
());
*/
$test
->
addTestCase
(
new
Doctrine_Query_Select_TestCase
());
...
...
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