make tests green again
This commit is contained in:
parent
136dbd3c6a
commit
bb5bab1b74
3 changed files with 21 additions and 14 deletions
|
|
@ -175,7 +175,7 @@ proc prepare*(db: DbConn; stmtName: string, query: SqlQuery;
|
|||
return SqlPrepared(stmtName)
|
||||
|
||||
proc setRow(res: PPGresult, r: var Row, line, cols: int32) =
|
||||
for col in 0..cols-1:
|
||||
for col in 0'i32..cols-1:
|
||||
setLen(r[col], 0)
|
||||
let x = pqgetvalue(res, line, col)
|
||||
if x.isNil:
|
||||
|
|
@ -191,7 +191,7 @@ iterator fastRows*(db: DbConn, query: SqlQuery,
|
|||
var res = setupQuery(db, query, args)
|
||||
var L = pqnfields(res)
|
||||
var result = newRow(L)
|
||||
for i in 0..pqntuples(res)-1:
|
||||
for i in 0'i32..pqntuples(res)-1:
|
||||
setRow(res, result, i, L)
|
||||
yield result
|
||||
pqclear(res)
|
||||
|
|
@ -202,7 +202,7 @@ iterator fastRows*(db: DbConn, stmtName: SqlPrepared,
|
|||
var res = setupQuery(db, stmtName, args)
|
||||
var L = pqNfields(res)
|
||||
var result = newRow(L)
|
||||
for i in 0..pqNtuples(res)-1:
|
||||
for i in 0'i32..pqNtuples(res)-1:
|
||||
setRow(res, result, i, L)
|
||||
yield result
|
||||
pqClear(res)
|
||||
|
|
@ -213,7 +213,7 @@ iterator instantRows*(db: DbConn, query: SqlQuery,
|
|||
## same as fastRows but returns a handle that can be used to get column text
|
||||
## on demand using []. Returned handle is valid only within iterator body.
|
||||
var res = setupQuery(db, query, args)
|
||||
for i in 0..pqNtuples(res)-1:
|
||||
for i in 0'i32..pqNtuples(res)-1:
|
||||
yield InstantRow(res: res, line: i)
|
||||
pqClear(res)
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ iterator instantRows*(db: DbConn, stmtName: SqlPrepared,
|
|||
## same as fastRows but returns a handle that can be used to get column text
|
||||
## on demand using []. Returned handle is valid only within iterator body.
|
||||
var res = setupQuery(db, stmtName, args)
|
||||
for i in 0..pqNtuples(res)-1:
|
||||
for i in 0'i32..pqNtuples(res)-1:
|
||||
yield InstantRow(res: res, line: i)
|
||||
pqClear(res)
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ proc getColumnType(res: PPGresult, col: int) : DbType =
|
|||
|
||||
proc setColumnInfo(columns: var DbColumns; res: PPGresult; L: int32) =
|
||||
setLen(columns, L)
|
||||
for i in 0..<L:
|
||||
for i in 0'i32..<L:
|
||||
columns[i].name = $pqfname(res, i)
|
||||
columns[i].typ = getColumnType(res, i)
|
||||
columns[i].tableName = $(pqftable(res, i)) ## Returns the OID of the table from which the given column was fetched.
|
||||
|
|
@ -377,7 +377,7 @@ iterator instantRows*(db: DbConn; columns: var DbColumns; query: SqlQuery;
|
|||
{.tags: [ReadDbEffect].} =
|
||||
var res = setupQuery(db, query, args)
|
||||
setColumnInfo(columns, res, pqnfields(res))
|
||||
for i in 0..<pqntuples(res):
|
||||
for i in 0'i32..<pqntuples(res):
|
||||
yield InstantRow(res: res, line: i)
|
||||
pqClear(res)
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ proc setupQuery(db: DbConn, query: SqlQuery,
|
|||
if prepare_v2(db, q, q.len.cint, result, nil) != SQLITE_OK: dbError(db)
|
||||
|
||||
proc setRow(stmt: Pstmt, r: var Row, cols: cint) =
|
||||
for col in 0..cols-1:
|
||||
for col in 0'i32..cols-1:
|
||||
setLen(r[col], column_bytes(stmt, col)) # set capacity
|
||||
setLen(r[col], 0)
|
||||
let x = column_text(stmt, col)
|
||||
|
|
|
|||
|
|
@ -2022,6 +2022,13 @@ when defined(nimNewRoof):
|
|||
yield res
|
||||
inc(res)
|
||||
|
||||
iterator `..`*(a, b: int32): int32 {.inline.} =
|
||||
## A special version of `..`` for ``int32`` only.
|
||||
var res = a
|
||||
while res <= b:
|
||||
yield res
|
||||
inc(res)
|
||||
|
||||
else:
|
||||
iterator countup*[S, T](a: S, b: T, step = 1): T {.inline.} =
|
||||
## Counts from ordinal value `a` up to `b` (inclusive) with the given
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue