From a9d421e40f2fe40315219a05fef8b0ead2b0939e Mon Sep 17 00:00:00 2001 From: Simon Hafner Date: Mon, 14 Jul 2014 14:03:10 -0500 Subject: [PATCH] Merge pull request #1358 from def-/db_mysql-sql Add missing sql proc for db_mysql --- src/db_mysql.nim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/db_mysql.nim b/src/db_mysql.nim index 32cda3e4dc..eec4daf00d 100644 --- a/src/db_mysql.nim +++ b/src/db_mysql.nim @@ -24,6 +24,15 @@ type FReadDb* = object of FDb ## effect that denotes a read operation FWriteDb* = object of FDb ## effect that denotes a write operation +proc sql*(query: string): TSqlQuery {.noSideEffect, inline.} = + ## constructs a TSqlQuery from the string `query`. This is supposed to be + ## used as a raw-string-literal modifier: + ## ``sql"update user set counter = counter + 1"`` + ## + ## If assertions are turned off, it does nothing. If assertions are turned + ## on, later versions will check the string for valid syntax. + result = TSqlQuery(query) + proc dbError(db: TDbConn) {.noreturn.} = ## raises an EDb exception. var e: ref EDb