Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Clockwork/DataSource/EloquentDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,9 @@ protected function quoteBinding($binding, $connection)

$pdo = $connection->getPdo();

if ($pdo === null) return;

if ($pdo->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'odbc' || $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'crate') {
// PDO_ODBC and PDO Crate driver doesn't support the quote method, apply simple MSSQL style quoting instead - Crate sometimes uses a object as a binding - for json support
// In case of non-PDO connections or known drivers without quote support (ODBC, Crate), we apply our own simple MSSQL style quoting instead.
// Some drivers use object bindings (eg. Crate), in this case we try to JSON encode the value.
if ($pdo === null || $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'odbc' || $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'crate') {
$binding = is_object($binding) ? json_encode($binding) : $binding;
return "'" . str_replace("'", "''", $binding) . "'";
}
Expand Down