diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-11-18 20:24:52 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-11-18 21:57:48 +0100 |
| commit | 62123e577ee5d4066d53f8ad7e5ac3d2eb190430 (patch) | |
| tree | f569686630681a9eceb2685f69b55fe5a2bac17c /lib/common | |
| parent | 7087a0c2c84e796e474784cbd28d4a4e574cf2c0 (diff) | |
Securized the queries in the database with a dedicated type for the Identifiers
Diffstat (limited to 'lib/common')
| -rw-r--r-- | lib/common/sql.ml | 8 |
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) ^ "'" |
