diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2012-10-07 15:37:12 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2012-10-07 15:37:12 +0100 |
commit | 8f3dc6ebd37083f37e8b1081c324f50129c16c45 (patch) | |
tree | 173f7f8ee1349b7f150b8d1c52bdf8fabf116297 /lib/impure | |
parent | 5a83bd8812eb10a9c7a9d18f060f8ad7cb902e90 (diff) | |
download | Nim-8f3dc6ebd37083f37e8b1081c324f50129c16c45.tar.gz |
Fixes segfault in db_sqlite. Fixes problems with times.format.
Diffstat (limited to 'lib/impure')
-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: |