summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2014-07-14 03:49:15 +0200
committerdef <dennis@felsin9.de>2014-07-14 03:49:15 +0200
commit089387c525ec7c8f89cff4d1a03d92ccc0e138d3 (patch)
treee2a48b4c41166068c4b087d3f5df1b393fe6054f /lib
parentc260b22fbca0e8a3be903c1c6db2027cfcf1c7f2 (diff)
downloadNim-089387c525ec7c8f89cff4d1a03d92ccc0e138d3.tar.gz
Add missing sql proc for db_mysql
Diffstat (limited to 'lib')
-rw-r--r--lib/impure/db_mysql.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/impure/db_mysql.nim b/lib/impure/db_mysql.nim
index 32cda3e4d..eec4daf00 100644
--- a/lib/impure/db_mysql.nim
+++ b/lib/impure/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