Commit 92c0fbf2 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-231' into 2.1.x

parents 148a049d 55fc886c
......@@ -61,7 +61,7 @@ class SQLParserUtils
} else {
$name = "";
// 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];
}
$paramMap[$name][] = $i; // named parameters can be duplicated!
......@@ -140,4 +140,4 @@ class SQLParserUtils
return array($query, $params, $types);
}
}
\ No newline at end of file
}
......@@ -33,6 +33,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 ":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
);
}
......@@ -116,4 +117,4 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
$this->assertEquals($expectedParams, $params, "Params 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