Commit 531b65c0 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-80' into 2.0.x

parents e97fbbf7 d057f6b0
......@@ -1007,7 +1007,7 @@ class Connection implements DriverConnection
// Check whether parameters are positional or named. Mixing is not allowed, just like in PDO.
if (is_int(key($params))) {
// Positional parameters
$typeOffset = isset($types[0]) ? -1 : 0;
$typeOffset = array_key_exists(0, $types) ? -1 : 0;
$bindIndex = 1;
foreach ($params as $position => $value) {
$typeIndex = $bindIndex + $typeOffset;
......
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Types\Type;
use PDO;
require_once __DIR__ . '/../../TestInit.php';
......@@ -25,6 +26,18 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->executeUpdate('DELETE FROM write_table');
}
/**
* @group DBAL-80
*/
public function testExecuteUpdateFirstTypeIsNull()
{
$sql = "INSERT INTO write_table (test_string, test_int) VALUES (?, ?)";
$this->_conn->executeUpdate($sql, array("text", 1111), array(null, PDO::PARAM_INT));
$sql = "SELECT * FROM write_table WHERE test_string = ? AND test_int = ?";
$this->assertTrue((bool)$this->_conn->fetchColumn($sql, array("text", 1111)));
}
public function testExecuteUpdate()
{
$sql = "INSERT INTO write_table (test_int) VALUES ( " . $this->_conn->quote(1) . ")";
......
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