Commit 54f82879 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-231' into 2.2

parents e4d64434 97df24fc
...@@ -61,7 +61,7 @@ class SQLParserUtils ...@@ -61,7 +61,7 @@ class SQLParserUtils
} else { } else {
$name = ""; $name = "";
// TODO: Something faster/better to match this than regex? // TODO: Something faster/better to match this than regex?
for ($j = $i; ($j < $stmtLen && preg_match('(([:a-zA-Z0-9]{1}))', $statement[$j])); $j++) { for ($j = $i; ($j < $stmtLen && preg_match('(([:a-zA-Z0-9_]{1}))', $statement[$j])); $j++) {
$name .= $statement[$j]; $name .= $statement[$j];
} }
$paramMap[$name][] = $i; // named parameters can be duplicated! $paramMap[$name][] = $i; // named parameters can be duplicated!
...@@ -176,4 +176,4 @@ class SQLParserUtils ...@@ -176,4 +176,4 @@ class SQLParserUtils
return array($query, $params, $types); return array($query, $params, $types);
} }
} }
\ No newline at end of file
...@@ -34,6 +34,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase ...@@ -34,6 +34,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array('SELECT * FROM Foo WHERE bar IN (:name1, :name2)', false, array(':name1' => array(32), ':name2' => array(40))), array('SELECT * FROM Foo WHERE bar IN (:name1, :name2)', false, array(':name1' => array(32), ':name2' => array(40))),
array('SELECT ":foo" FROM Foo WHERE bar IN (:name1, :name2)', false, array(':name1' => array(37), ':name2' => array(45))), array('SELECT ":foo" FROM Foo WHERE bar IN (:name1, :name2)', false, array(':name1' => array(37), ':name2' => array(45))),
array("SELECT ':foo' FROM Foo WHERE bar IN (:name1, :name2)", false, array(':name1' => array(37), ':name2' => array(45))), array("SELECT ':foo' FROM Foo WHERE bar IN (:name1, :name2)", false, array(':name1' => array(37), ':name2' => array(45))),
array('SELECT :foo_id', false, array(':foo_id' => array(7))), // Ticket DBAL-231
); );
} }
...@@ -200,4 +201,4 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase ...@@ -200,4 +201,4 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
$this->assertEquals($expectedParams, $params, "Params dont match"); $this->assertEquals($expectedParams, $params, "Params dont match");
$this->assertEquals($expectedTypes, $types, "Types dont match"); $this->assertEquals($expectedTypes, $types, "Types dont match");
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment