fix generation for string literal

This commit is contained in:
pedrocarlo
2025-06-03 15:23:08 -03:00
parent b30718ca4b
commit 470093ca03
3 changed files with 3 additions and 9 deletions

View File

@@ -369,12 +369,6 @@ impl Display for ast::LikeOperator {
}
}
/// Sanitaizes a string literal by removing single quote at front and back
/// and escaping double single quotes
pub fn sanitize_string(input: &str) -> String {
input[1..input.len() - 1].replace("''", "'").to_string()
}
impl Display for ast::Literal {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
@@ -388,7 +382,7 @@ impl Display for ast::Literal {
Self::Keyword(keyword) => keyword.clone(),
Self::Null => "NULL".to_string(),
Self::Numeric(num) => num.clone(),
Self::String(s) => format!("'{}'", sanitize_string(s)),
Self::String(s) => s.clone(),
}
)
}