summaryrefslogtreecommitdiff
path: root/lib/common/sql.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/sql.ml')
-rw-r--r--lib/common/sql.ml8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/common/sql.ml b/lib/common/sql.ml
new file mode 100644
index 0000000..1c0e2bb
--- /dev/null
+++ b/lib/common/sql.ml
@@ -0,0 +1,8 @@
+(** Helper to embed an SQL string literal into a query string.
+
+ Identifiers are not handled here: they have the abstract type
+ [Model.Identifier.t], whose only constructor validates the string, and are
+ quoted with [Model.Identifier.quote]. *)
+
+let quote_literal : string -> string =
+ fun s -> "'" ^ String.concat "''" (String.split_on_char '\'' s) ^ "'"