Merge branch 'jlp765-db_odbc2' into devel
This commit is contained in:
commit
27a7caf176
2 changed files with 23 additions and 24 deletions
|
|
@ -222,9 +222,8 @@ proc prepareFetch(db: var DbConn, query: SqlQuery,
|
||||||
var q = dbFormat(query, args)
|
var q = dbFormat(query, args)
|
||||||
db.sqlCheck(SQLPrepare(db.stmt, q.PSQLCHAR, q.len.TSqlSmallInt))
|
db.sqlCheck(SQLPrepare(db.stmt, q.PSQLCHAR, q.len.TSqlSmallInt))
|
||||||
db.sqlCheck(SQLExecute(db.stmt))
|
db.sqlCheck(SQLExecute(db.stmt))
|
||||||
var retcode = SQLFetch(db.stmt)
|
result = SQLFetch(db.stmt)
|
||||||
db.sqlCheck(retcode)
|
db.sqlCheck(result)
|
||||||
result=retcode
|
|
||||||
|
|
||||||
proc prepareFetchDirect(db: var DbConn, query: SqlQuery,
|
proc prepareFetchDirect(db: var DbConn, query: SqlQuery,
|
||||||
args: varargs[string, `$`]) {.
|
args: varargs[string, `$`]) {.
|
||||||
|
|
@ -250,8 +249,8 @@ proc tryExec*(db: var DbConn, query: SqlQuery, args: varargs[string, `$`]): bool
|
||||||
var
|
var
|
||||||
rCnt = -1
|
rCnt = -1
|
||||||
res = SQLRowCount(db.stmt, rCnt)
|
res = SQLRowCount(db.stmt, rCnt)
|
||||||
if res != SQL_SUCCESS: dbError(db)
|
|
||||||
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
||||||
|
if res != SQL_SUCCESS: dbError(db)
|
||||||
except: discard
|
except: discard
|
||||||
return res == SQL_SUCCESS
|
return res == SQL_SUCCESS
|
||||||
|
|
||||||
|
|
@ -308,8 +307,8 @@ iterator fastRows*(db: var DbConn, query: SqlQuery,
|
||||||
cCnt = tempcCnt
|
cCnt = tempcCnt
|
||||||
yield rowRes
|
yield rowRes
|
||||||
res = SQLFetch(db.stmt)
|
res = SQLFetch(db.stmt)
|
||||||
db.sqlCheck(res)
|
|
||||||
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
||||||
|
db.sqlCheck(res)
|
||||||
|
|
||||||
iterator instantRows*(db: var DbConn, query: SqlQuery,
|
iterator instantRows*(db: var DbConn, query: SqlQuery,
|
||||||
args: varargs[string, `$`]): InstantRow
|
args: varargs[string, `$`]): InstantRow
|
||||||
|
|
@ -317,7 +316,7 @@ iterator instantRows*(db: var DbConn, query: SqlQuery,
|
||||||
## Same as fastRows but returns a handle that can be used to get column text
|
## Same as fastRows but returns a handle that can be used to get column text
|
||||||
## on demand using []. Returned handle is valid only within the interator body.
|
## on demand using []. Returned handle is valid only within the interator body.
|
||||||
var
|
var
|
||||||
rowRes: Row
|
rowRes: Row = @[]
|
||||||
sz: TSqlSmallInt = 0
|
sz: TSqlSmallInt = 0
|
||||||
cCnt: TSqlSmallInt = 0.TSqlSmallInt
|
cCnt: TSqlSmallInt = 0.TSqlSmallInt
|
||||||
res: TSqlSmallInt = 0.TSqlSmallInt
|
res: TSqlSmallInt = 0.TSqlSmallInt
|
||||||
|
|
@ -343,8 +342,8 @@ iterator instantRows*(db: var DbConn, query: SqlQuery,
|
||||||
cCnt = tempcCnt
|
cCnt = tempcCnt
|
||||||
yield (row: rowRes, len: cCnt.int)
|
yield (row: rowRes, len: cCnt.int)
|
||||||
res = SQLFetch(db.stmt)
|
res = SQLFetch(db.stmt)
|
||||||
db.sqlCheck(res)
|
|
||||||
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
||||||
|
db.sqlCheck(res)
|
||||||
|
|
||||||
proc `[]`*(row: InstantRow, col: int): string {.inline.} =
|
proc `[]`*(row: InstantRow, col: int): string {.inline.} =
|
||||||
## Returns text for given column of the row
|
## Returns text for given column of the row
|
||||||
|
|
@ -385,8 +384,8 @@ proc getRow*(db: var DbConn, query: SqlQuery,
|
||||||
cCnt = tempcCnt
|
cCnt = tempcCnt
|
||||||
res = SQLFetch(db.stmt)
|
res = SQLFetch(db.stmt)
|
||||||
result = rowRes
|
result = rowRes
|
||||||
db.sqlCheck(res)
|
|
||||||
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
||||||
|
db.sqlCheck(res)
|
||||||
|
|
||||||
proc getAllRows*(db: var DbConn, query: SqlQuery,
|
proc getAllRows*(db: var DbConn, query: SqlQuery,
|
||||||
args: varargs[string, `$`]): seq[Row] {.
|
args: varargs[string, `$`]): seq[Row] {.
|
||||||
|
|
@ -421,8 +420,8 @@ proc getAllRows*(db: var DbConn, query: SqlQuery,
|
||||||
rows.add(rowRes)
|
rows.add(rowRes)
|
||||||
res = SQLFetch(db.stmt)
|
res = SQLFetch(db.stmt)
|
||||||
result = rows
|
result = rows
|
||||||
db.sqlCheck(res)
|
|
||||||
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
properFreeResult(SQL_HANDLE_STMT, db.stmt)
|
||||||
|
db.sqlCheck(res)
|
||||||
|
|
||||||
iterator rows*(db: var DbConn, query: SqlQuery,
|
iterator rows*(db: var DbConn, query: SqlQuery,
|
||||||
args: varargs[string, `$`]): Row {.
|
args: varargs[string, `$`]): Row {.
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -2,7 +2,6 @@
|
||||||
nim c --gc:v2 -r -d:useSysAssert -d:useGcAssert -d:smokeCycles -d:useRealtimeGc tests/gc/gctest
|
nim c --gc:v2 -r -d:useSysAssert -d:useGcAssert -d:smokeCycles -d:useRealtimeGc tests/gc/gctest
|
||||||
|
|
||||||
- document ``this`` pragma
|
- document ``this`` pragma
|
||||||
- document and stress test ``.partial`` object declarations
|
|
||||||
|
|
||||||
essential for 1.0
|
essential for 1.0
|
||||||
=================
|
=================
|
||||||
|
|
@ -24,6 +23,7 @@ essential for 1.0
|
||||||
Not critical for 1.0
|
Not critical for 1.0
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
- document and stress test ``.partial`` object declarations
|
||||||
- add "all threads are blocked" detection to 'spawn'
|
- add "all threads are blocked" detection to 'spawn'
|
||||||
- figure out why C++ bootstrapping is so much slower
|
- figure out why C++ bootstrapping is so much slower
|
||||||
- The bitwise 'not' operator cold be renamed to 'bnot' to
|
- The bitwise 'not' operator cold be renamed to 'bnot' to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue