summary refs log tree commit diff stats
path: root/lib/impure/db_postgres.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/impure/db_postgres.nim')
-rwxr-xr-xlib/impure/db_postgres.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/impure/db_postgres.nim b/lib/impure/db_postgres.nim
index 7e2cef525..dff607081 100755
--- a/lib/impure/db_postgres.nim
+++ b/lib/impure/db_postgres.nim
@@ -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.