Skip to content

Commit e6e44e4

Browse files
committed
Declare '\' as ESCAPE for LIKE on sqlite
1 parent bb95f1d commit e6e44e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/conditional.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ impl<'a> BuildCondition<'a> for BinaryCondition<'a> {
125125
lhs.build_to_writer(writer, dialect, lookup)?;
126126
write!(writer, " {keyword} ")?;
127127
rhs.build_to_writer(writer, dialect, lookup)?;
128+
if matches!(dialect, DBImpl::SQLite) && matches!(keyword, "LIKE" | "NOT LIKE") {
129+
// Sqlite does not default it
130+
write!(writer, " ESCAPE '\'")?;
131+
}
128132
write!(writer, ")")?;
129133
Ok(())
130134
}

0 commit comments

Comments
 (0)