]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3765 backslash character '\' is duplicated on H2
authorDavid Gageot <david@gageot.net>
Fri, 5 Oct 2012 23:31:08 +0000 (01:31 +0200)
committerDavid Gageot <david@gageot.net>
Fri, 5 Oct 2012 23:32:43 +0000 (01:32 +0200)
sonar-server/src/main/webapp/WEB-INF/config/initializers/better_quoting.rb [new file with mode: 0644]

diff --git a/sonar-server/src/main/webapp/WEB-INF/config/initializers/better_quoting.rb b/sonar-server/src/main/webapp/WEB-INF/config/initializers/better_quoting.rb
new file mode 100644 (file)
index 0000000..60071f6
--- /dev/null
@@ -0,0 +1,14 @@
+# Override quoting for database without a specific jdbc adapter
+# for example, H2
+#
+# Default quoting leads to bugs, see SONAR-3765
+#
+module ActiveRecord
+  module ConnectionAdapters # :nodoc:
+    module Quoting
+      def quote_string(s)
+        s.gsub(/'/, "''") # ' (for ruby-mode)
+      end
+    end
+  end
+end