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
f3844dc2
Commit
f3844dc2
authored
Apr 20, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fixing issue when number of positional parameters != number of given types"
This reverts commit
0b6a6aef
.
parent
10be52ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
22 deletions
+6
-22
SQLParserUtils.php
lib/Doctrine/DBAL/SQLParserUtils.php
+6
-6
SQLParserUtilsTest.php
tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
+0
-16
No files found.
lib/Doctrine/DBAL/SQLParserUtils.php
View file @
f3844dc2
...
@@ -80,7 +80,7 @@ class SQLParserUtils
...
@@ -80,7 +80,7 @@ class SQLParserUtils
* @param string $query The SQL query to execute.
* @param string $query The SQL query to execute.
* @param array $params The parameters to bind to the query.
* @param array $params The parameters to bind to the query.
* @param array $types The types the previous parameters are in.
* @param array $types The types the previous parameters are in.
*
*
* @return array
* @return array
*/
*/
static
public
function
expandListParameters
(
$query
,
$params
,
$types
)
static
public
function
expandListParameters
(
$query
,
$params
,
$types
)
...
@@ -103,7 +103,7 @@ class SQLParserUtils
...
@@ -103,7 +103,7 @@ class SQLParserUtils
$arrayPositions
[
$name
]
=
false
;
$arrayPositions
[
$name
]
=
false
;
}
}
if
((
!
$arrayPositions
&&
$isPositional
))
{
if
((
!
$arrayPositions
&&
$isPositional
)
||
(
count
(
$params
)
!=
count
(
$types
))
)
{
return
array
(
$query
,
$params
,
$types
);
return
array
(
$query
,
$params
,
$types
);
}
}
...
@@ -130,9 +130,9 @@ class SQLParserUtils
...
@@ -130,9 +130,9 @@ class SQLParserUtils
$types
=
array_merge
(
$types
=
array_merge
(
array_slice
(
$types
,
0
,
$needle
),
array_slice
(
$types
,
0
,
$needle
),
$count
?
$count
?
array_fill
(
0
,
$count
,
$types
[
$needle
]
-
Connection
::
ARRAY_PARAM_OFFSET
)
:
// array needles are at PDO::PARAM_* + 100
array_fill
(
0
,
$count
,
$types
[
$needle
]
-
Connection
::
ARRAY_PARAM_OFFSET
)
:
// array needles are at PDO::PARAM_* + 100
array
(),
array
(),
array_slice
(
$types
,
$needle
+
1
)
array_slice
(
$types
,
$needle
+
1
)
);
);
...
@@ -159,9 +159,9 @@ class SQLParserUtils
...
@@ -159,9 +159,9 @@ class SQLParserUtils
$pos
+=
$queryOffset
;
$pos
+=
$queryOffset
;
$queryOffset
-=
(
$paramLen
-
1
);
$queryOffset
-=
(
$paramLen
-
1
);
$paramsOrd
[]
=
$value
;
$paramsOrd
[]
=
$value
;
$typesOrd
[]
=
isset
(
$types
[
$paramName
])
?
$types
[
$paramName
]
:
\PDO
::
PARAM_STR
;
$typesOrd
[]
=
$types
[
$paramName
]
;
$query
=
substr
(
$query
,
0
,
$pos
)
.
'?'
.
substr
(
$query
,
(
$pos
+
$paramLen
));
$query
=
substr
(
$query
,
0
,
$pos
)
.
'?'
.
substr
(
$query
,
(
$pos
+
$paramLen
));
continue
;
continue
;
}
}
...
...
tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
View file @
f3844dc2
...
@@ -237,22 +237,6 @@ SQLDATA
...
@@ -237,22 +237,6 @@ SQLDATA
array
(),
array
(),
array
()
array
()
),
),
array
(
"SELECT * FROM Foo WHERE foo IN (:foo) OR bar = :bar OR baz = :baz"
,
array
(
'foo'
=>
array
(
1
,
2
),
'bar'
=>
'bar'
,
'baz'
=>
'baz'
),
array
(
'foo'
=>
Connection
::
PARAM_INT_ARRAY
,
'baz'
=>
'string'
),
'SELECT * FROM Foo WHERE foo IN (?, ?) OR bar = ? OR baz = ?'
,
array
(
1
,
2
,
'bar'
,
'baz'
),
array
(
\PDO
::
PARAM_INT
,
\PDO
::
PARAM_INT
,
\PDO
::
PARAM_STR
,
'string'
)
),
array
(
"SELECT * FROM Foo WHERE foo IN (:foo) OR bar = :bar"
,
array
(
'foo'
=>
array
(
1
,
2
),
'bar'
=>
'bar'
),
array
(
'foo'
=>
Connection
::
PARAM_INT_ARRAY
),
'SELECT * FROM Foo WHERE foo IN (?, ?) OR bar = ?'
,
array
(
1
,
2
,
'bar'
),
array
(
\PDO
::
PARAM_INT
,
\PDO
::
PARAM_INT
,
\PDO
::
PARAM_STR
)
),
);
);
}
}
...
...
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