From ea5cc2b45c301f73a7a3043f6e03d0410f6837f6 Mon Sep 17 00:00:00 2001 From: Juanan Pereira Date: Fri, 15 Jan 2021 11:06:51 +0100 Subject: [PATCH] Fix escape_for_sql method --- lib/logging/sql.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/logging/sql.rb b/lib/logging/sql.rb index 25c0595f1..4e6b08819 100644 --- a/lib/logging/sql.rb +++ b/lib/logging/sql.rb @@ -45,11 +45,7 @@ def flatten_elements!(obj) def escape_for_sql(s) s = s.to_s - if s.nil? - "''" - else - "'" + s.tr("'", "\'") + "'" - end + "'" + s.gsub("'"){"\\'"} + "'" end def create_tables