summary refs log tree commit diff stats
path: root/lib/impure/db_odbc.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-09-29 11:23:29 +0200
committerAraq <rumpf_a@web.de>2018-09-29 11:23:29 +0200
commit4f8cf945fb2dc9292af97a0b88eff658263d3325 (patch)
tree6f7bce08540754dc31b9fcda252fc5292ce6e85f /lib/impure/db_odbc.nim
parentc404163bbf39d8d8311c516d6e89d531ffea151c (diff)
downloadNim-4f8cf945fb2dc9292af97a0b88eff658263d3325.tar.gz
docs: remove most stale links; refs #9109
Diffstat (limited to 'lib/impure/db_odbc.nim')
-rw-r--r--lib/impure/db_odbc.nim15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/impure/db_odbc.nim b/lib/impure/db_odbc.nim
index d6343acc7..224bcbb50 100644
--- a/lib/impure/db_odbc.nim
+++ b/lib/impure/db_odbc.nim
@@ -183,7 +183,7 @@ proc sqlGetDBMS(db: var DbConn): string {.
     db.sqlCheck(SQLGetInfo(db.hDb, SQL_DBMS_NAME, cast[SqlPointer](buf.addr),
                         4095.TSqlSmallInt, sz.addr))
   except: discard
-  return $buf.cstring
+  return $(addr buf)
 
 proc dbQuote*(s: string): string {.noSideEffect.} =
   ## DB quotes the string.
@@ -201,10 +201,7 @@ proc dbFormat(formatstr: SqlQuery, args: varargs[string]): string {.
   var a = 0
   for c in items(string(formatstr)):
     if c == '?':
-      if args[a] == nil:
-        add(result, "NULL")
-      else:
-        add(result, dbQuote(args[a]))
+      add(result, dbQuote(args[a]))
       inc(a)
     else:
       add(result, c)
@@ -303,7 +300,7 @@ iterator fastRows*(db: var DbConn, query: SqlQuery,
         buf[0] = '\0'
         db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
                                  cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
-        rowRes[colId-1] = $buf.cstring
+        rowRes[colId-1] = $(addr buf)
         cCnt = tempcCnt
       yield rowRes
       res = SQLFetch(db.stmt)
@@ -338,7 +335,7 @@ iterator instantRows*(db: var DbConn, query: SqlQuery,
         buf[0] = '\0'
         db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
                                  cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
-        rowRes[colId-1] = $buf.cstring
+        rowRes[colId-1] = $(addr buf)
         cCnt = tempcCnt
       yield (row: rowRes, len: cCnt.int)
       res = SQLFetch(db.stmt)
@@ -380,7 +377,7 @@ proc getRow*(db: var DbConn, query: SqlQuery,
       buf[0] = '\0'
       db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
                                cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
-      rowRes[colId-1] = $buf.cstring
+      rowRes[colId-1] = $(addr buf)
       cCnt = tempcCnt
     res = SQLFetch(db.stmt)
     result = rowRes
@@ -415,7 +412,7 @@ proc getAllRows*(db: var DbConn, query: SqlQuery,
         buf[0] = '\0'
         db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
                                  cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
-        rowRes[colId-1] = $buf.cstring
+        rowRes[colId-1] = $(addr buf)
         cCnt = tempcCnt
       rows.add(rowRes)
       res = SQLFetch(db.stmt)