Skip to content

Commit 246698b

Browse files
committed
Use speech marks to escape strings
This allows column names to be escaped.
1 parent 9cb2b4a commit 246698b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SQLiteSharp/Globals.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ namespace SQLiteSharp;
1212
public static class Globals {
1313
/// <summary>
1414
/// Convert an input string to a quoted SQL string that can be safely used in queries.<br/>
15-
/// For example, <c>red 'blue' green</c> becomes <c>'red ''blue'' green'</c>.
15+
/// For example, <c>red "blue" green</c> becomes <c>"red ""blue"" green"</c>.
1616
/// </summary>
1717
public static string Quote(string? unsafeString) {
1818
if (unsafeString is null) {
1919
return "null";
2020
}
21-
return $"'{unsafeString.Replace("'", "''")}'";
21+
return $"\"{unsafeString.Replace("\"", "\"\"")}\"";
2222
}
2323
public static Expression? AndAlso(Expression? left, Expression? right) {
2424
if (left is not null && right is not null) {

0 commit comments

Comments
 (0)