added db_*.getRow

This commit is contained in:
Araq
2012-04-24 08:44:36 +02:00
committed by ringabout
parent 910dd6bcc9
commit 512d1d0bb2

View File

@@ -103,6 +103,15 @@ iterator FastRows*(db: TDbConn, query: TSqlQuery,
yield result
PQclear(res)
proc getRow*(db: TDbConn, query: TSqlQuery,
args: openarray[string]): TRow =
## retrieves a single row.
var res = setupQuery(db, query, args)
var L = int(PQnfields(res))
var result = newRow(L)
setRow(res, result, 0, L)
PQclear(res)
proc GetAllRows*(db: TDbConn, query: TSqlQuery,
args: openarray[string]): seq[TRow] =
## executes the query and returns the whole result dataset.