Skip to content

Commit

Permalink
Merge branch 'bindDoubles' of https://github.com/themsaid/framework i…
Browse files Browse the repository at this point in the history
…nto themsaid-bindDoubles
  • Loading branch information
taylorotwell committed Oct 31, 2016
2 parents 174490b + de950df commit 47480d7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Illuminate/Database/MySqlConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Database;

use PDO;
use Illuminate\Database\Schema\MySqlBuilder;
use Illuminate\Database\Query\Processors\MySqlProcessor;
use Doctrine\DBAL\Driver\PDOMySql\Driver as DoctrineDriver;
Expand Down Expand Up @@ -63,4 +64,21 @@ protected function getDoctrineDriver()
{
return new DoctrineDriver;
}

/**
* Bind values to their parameters in the given statement.
*
* @param \PDOStatement $statement
* @param array $bindings
* @return void
*/
public function bindValues($statement, $bindings)
{
foreach ($bindings as $key => $value) {
$statement->bindValue(
is_string($key) ? $key : $key + 1, $value,
is_int($value) || is_float($value) ? PDO::PARAM_INT : PDO::PARAM_STR
);
}
}
}

0 comments on commit 47480d7

Please sign in to comment.