diff options
author | cooldome <ariabushenko@gmail.com> | 2020-08-07 21:37:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 22:37:54 +0200 |
commit | a528382e057780845585f0befa6da505462a622e (patch) | |
tree | 2a5f5a5db1457f21da140c92c3282505e0c3f063 /lib/impure | |
parent | d9ed816b10a67e802817daa07b5b823c79bcd13e (diff) | |
download | Nim-a528382e057780845585f0befa6da505462a622e.tar.gz |
fix sqlgetdata regression in odbc (#15161)
* fix sqlgetdata import * fix db_odbc * more fixes * fix style
Diffstat (limited to 'lib/impure')
-rw-r--r-- | lib/impure/db_odbc.nim | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/impure/db_odbc.nim b/lib/impure/db_odbc.nim index 863cf6c8c..8aadfae73 100644 --- a/lib/impure/db_odbc.nim +++ b/lib/impure/db_odbc.nim @@ -279,7 +279,7 @@ iterator fastRows*(db: var DbConn, query: SqlQuery, ## Rows are retrieved from the server at each iteration. var rowRes: Row - sz: TSqlInteger = 0 + sz: TSqlLen = 0 cCnt: TSqlSmallInt = 0 res: TSqlSmallInt = 0 res = db.prepareFetch(query, args) @@ -293,8 +293,7 @@ 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, sz.addr)) rowRes[colId-1] = $(addr buf) yield rowRes res = SQLFetch(db.stmt) @@ -308,7 +307,7 @@ iterator instantRows*(db: var DbConn, query: SqlQuery, ## on demand using []. Returned handle is valid only within the iterator body. var rowRes: Row = @[] - sz: TSqlInteger = 0 + sz: TSqlLen = 0 cCnt: TSqlSmallInt = 0 res: TSqlSmallInt = 0 res = db.prepareFetch(query, args) @@ -322,8 +321,7 @@ 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, sz.addr)) rowRes[colId-1] = $(addr buf) yield (row: rowRes, len: cCnt.int) res = SQLFetch(db.stmt) @@ -349,7 +347,7 @@ proc getRow*(db: var DbConn, query: SqlQuery, ## will return a Row with empty strings for each column. var rowRes: Row - sz: TSqlInteger = 0 + sz: TSqlLen = 0 cCnt: TSqlSmallInt = 0 res: TSqlSmallInt = 0 res = db.prepareFetch(query, args) @@ -362,8 +360,7 @@ 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, sz.addr)) rowRes[colId-1] = $(addr buf) res = SQLFetch(db.stmt) result = rowRes @@ -377,7 +374,7 @@ proc getAllRows*(db: var DbConn, query: SqlQuery, var rows: seq[Row] = @[] rowRes: Row - sz: TSqlInteger = 0 + sz: TSqlLen = 0 cCnt: TSqlSmallInt = 0 res: TSqlSmallInt = 0 res = db.prepareFetch(query, args) @@ -391,8 +388,7 @@ 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, sz.addr)) rowRes[colId-1] = $(addr buf) rows.add(rowRes) res = SQLFetch(db.stmt) |