summary refs log tree commit diff stats
path: root/lib/impure/db_odbc.nim
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2019-01-22 11:17:20 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-01-22 11:17:20 +0100
commit68254308312ce352612b11af164d82d930a1bf68 (patch)
tree5ece3b0c299c4ecad416a4a65d7ad3df3bc197d4 /lib/impure/db_odbc.nim
parent39e1cd2bf60a3626f73ee34e91127a8ea4f18a58 (diff)
downloadNim-68254308312ce352612b11af164d82d930a1bf68.tar.gz
Restrict ptr/ref to ptr/ref implicit conversion (#10411)
* Restrict ptr/ref to ptr/ref implicit conversion

Fixes #10409

* Make the ptr conversions explicit in db_odbc
Diffstat (limited to 'lib/impure/db_odbc.nim')
-rw-r--r--lib/impure/db_odbc.nim14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/impure/db_odbc.nim b/lib/impure/db_odbc.nim
index b7af5128a..a533a28ff 100644
--- a/lib/impure/db_odbc.nim
+++ b/lib/impure/db_odbc.nim
@@ -128,7 +128,7 @@ proc getErrInfo(db: var DbConn): tuple[res: int, ss, ne, msg: string] {.
               cast[PSQLCHAR](sqlState.addr),
               cast[PSQLCHAR](nativeErr.addr),
               cast[PSQLCHAR](errMsg.addr),
-              511.TSqlSmallInt, retSz.addr.PSQLSMALLINT)
+              511.TSqlSmallInt, retSz.addr.PSQLINTEGER)
   except:
     discard
   return (res.int, $(addr sqlState), $(addr nativeErr), $(addr errMsg))
@@ -297,7 +297,8 @@ iterator fastRows*(db: var DbConn, query: SqlQuery,
       for colId in 1..cCnt:
         buf[0] = '\0'
         db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
-                                 cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
+                                 cast[cstring](buf.addr), 4095.TSqlSmallInt, 
+                                 sz.addr.PSQLINTEGER))
         rowRes[colId-1] = $(addr buf)
         cCnt = tempcCnt
       yield rowRes
@@ -332,7 +333,8 @@ iterator instantRows*(db: var DbConn, query: SqlQuery,
       for colId in 1..cCnt:
         buf[0] = '\0'
         db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
-                                 cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
+                                 cast[cstring](buf.addr), 4095.TSqlSmallInt,
+                                 sz.addr.PSQLINTEGER))
         rowRes[colId-1] = $(addr buf)
         cCnt = tempcCnt
       yield (row: rowRes, len: cCnt.int)
@@ -374,7 +376,8 @@ proc getRow*(db: var DbConn, query: SqlQuery,
     for colId in 1..cCnt:
       buf[0] = '\0'
       db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
-                               cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
+                               cast[cstring](buf.addr), 4095.TSqlSmallInt,
+                               sz.addr.PSQLINTEGER))
       rowRes[colId-1] = $(addr buf)
       cCnt = tempcCnt
     res = SQLFetch(db.stmt)
@@ -409,7 +412,8 @@ proc getAllRows*(db: var DbConn, query: SqlQuery,
       for colId in 1..cCnt:
         buf[0] = '\0'
         db.sqlCheck(SQLGetData(db.stmt, colId.SqlUSmallInt, SQL_C_CHAR,
-                                 cast[cstring](buf.addr), 4095.TSqlSmallInt, sz.addr))
+                                 cast[cstring](buf.addr), 4095.TSqlSmallInt,
+                                 sz.addr.PSQLINTEGER))
         rowRes[colId-1] = $(addr buf)
         cCnt = tempcCnt
       rows.add(rowRes)