diff options
author | Araq <rumpf_a@web.de> | 2012-10-10 01:03:04 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-10-10 01:03:04 +0200 |
commit | fe7dd31b61b95f1e6d4d8514a251d93644ef6e7a (patch) | |
tree | b6b8729b9eb00f8624a2ab523d4f4dbd4bb61786 /lib/impure/db_sqlite.nim | |
parent | 74acf05e0eea4fcf8911243d44cf8a4a6c3a6d99 (diff) | |
parent | 8f3dc6ebd37083f37e8b1081c324f50129c16c45 (diff) | |
download | Nim-fe7dd31b61b95f1e6d4d8514a251d93644ef6e7a.tar.gz |
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'lib/impure/db_sqlite.nim')
-rwxr-xr-x | lib/impure/db_sqlite.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/impure/db_sqlite.nim b/lib/impure/db_sqlite.nim index 29ff0693e..5196e4807 100755 --- a/lib/impure/db_sqlite.nim +++ b/lib/impure/db_sqlite.nim @@ -128,8 +128,10 @@ proc GetValue*(db: TDbConn, query: TSqlQuery, ## executes the query and returns the result dataset's the first column ## of the first row. Returns "" if the dataset contains no rows. var stmt = setupQuery(db, query, args) - if step(stmt) == SQLITE_ROW: - result = newStringOfCap(column_bytes(stmt, 0)) + if step(stmt) == SQLITE_ROW: + let cb = column_bytes(stmt, 0) + if cb == 0: return "" + result = newStringOfCap(cb) add(result, column_text(stmt, 0)) if finalize(stmt) != SQLITE_OK: dbError(db) else: |