summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSimon Hafner <hafnersimon@gmail.com>2014-07-14 14:03:10 -0500
committerSimon Hafner <hafnersimon@gmail.com>2014-07-14 14:03:10 -0500
commit8332e6e160b4b3b03dc77bb9a156c4724d580b47 (patch)
treee8a3edf6afa70766a4d86d2810d9e8b9fe48af99
parente01c1f1ab3d9d1d4d1bcd7676b85815aeda6f460 (diff)
parent089387c525ec7c8f89cff4d1a03d92ccc0e138d3 (diff)
downloadNim-8332e6e160b4b3b03dc77bb9a156c4724d580b47.tar.gz
Merge pull request #1358 from def-/db_mysql-sql
Add missing sql proc for db_mysql
-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