Skip to content

Commit 427fb1b

Browse files
committed
Handle NoBackslashEscapes for binay parameter values.
See #999 Signed-off-by: kpreisser <[email protected]>
1 parent e846845 commit 427fb1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MySqlConnector/MySqlParameter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ internal void AppendSqlString(ByteBufferWriter writer, StatementPreparerOptions
305305
var length = inputSpan.Length + BinaryBytes.Length + 1;
306306
foreach (var by in inputSpan)
307307
{
308-
if (by is 0x27 or 0x5C)
308+
if (by is 0x27 || by is 0x5C && !noBackslashEscapes)
309309
length++;
310310
}
311311

@@ -314,8 +314,8 @@ internal void AppendSqlString(ByteBufferWriter writer, StatementPreparerOptions
314314
var index = BinaryBytes.Length;
315315
foreach (var by in inputSpan)
316316
{
317-
if (by is 0x27 or 0x5C)
318-
outputSpan[index++] = 0x5C;
317+
if (by is 0x27 || by is 0x5C && !noBackslashEscapes)
318+
outputSpan[index++] = by;
319319
outputSpan[index++] = by;
320320
}
321321
outputSpan[index++] = 0x27;

0 commit comments

Comments
 (0)