mirror of
https://github.com/dg/dibi.git
synced 2025-08-02 04:10:24 +02:00
@@ -217,17 +217,21 @@ class PdoDriver implements Dibi\Driver
|
||||
*/
|
||||
public function escapeText(string $value): string
|
||||
{
|
||||
return $this->driverName === 'odbc'
|
||||
? "'" . str_replace("'", "''", $value) . "'"
|
||||
: $this->connection->quote($value, PDO::PARAM_STR);
|
||||
return match ($this->driverName) {
|
||||
'odbc' => "'" . str_replace("'", "''", $value) . "'",
|
||||
'sqlsrv' => "N'" . str_replace("'", "''", $value) . "'",
|
||||
default => $this->connection->quote($value, PDO::PARAM_STR),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public function escapeBinary(string $value): string
|
||||
{
|
||||
return $this->driverName === 'odbc'
|
||||
? "'" . str_replace("'", "''", $value) . "'"
|
||||
: $this->connection->quote($value, PDO::PARAM_LOB);
|
||||
return match ($this->driverName) {
|
||||
'odbc' => "'" . str_replace("'", "''", $value) . "'",
|
||||
'sqlsrv' => '0x' . bin2hex($value),
|
||||
default => $this->connection->quote($value, PDO::PARAM_LOB),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@@ -33,7 +33,7 @@ enum PureEnum
|
||||
|
||||
Assert::equal('1', $translator->formatValue(EnumInt::One, null));
|
||||
|
||||
Assert::equal(match ($config['driver']) {
|
||||
Assert::equal(match ($config['system']) {
|
||||
'sqlsrv' => "N'one'",
|
||||
default => "'one'",
|
||||
}, $translator->formatValue(EnumString::One, null));
|
||||
|
Reference in New Issue
Block a user