1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-30 01:09:50 +02:00

SqlsrvDriver: Correct escaping of special characters (N prefix) (#332)

In case nvarchar type is used and e.g. chinese have to be saved, there have to be N in front of the value, this escaping works fine for varchar columns as well.
This commit is contained in:
Tomáš Kuthan
2019-07-12 14:33:38 +02:00
committed by David Grudl
parent e66cb84cb5
commit 7f22279333
5 changed files with 118 additions and 25 deletions

View File

@@ -134,7 +134,10 @@ $fluent = $conn->select('*')
->where(['x' => 'a', 'b', 'c']);
Assert::same(
reformat('SELECT * FROM [me] AS [t] WHERE col > 10 AND ([x] = \'a\') AND (b) AND (c)'),
reformat([
'sqlsrv' => "SELECT * FROM [me] AS [t] WHERE col > 10 AND ([x] = N'a') AND (b) AND (c)",
"SELECT * FROM [me] AS [t] WHERE col > 10 AND ([x] = 'a') AND (b) AND (c)",
]),
(string) $fluent
);