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