diff options
author | KeMeGe <chaoskmg@gmail.com> | 2015-03-14 15:21:38 +0800 |
---|---|---|
committer | KeMeGe <chaoskmg@gmail.com> | 2015-03-14 15:21:38 +0800 |
commit | ca8102b96d086bcf95d8859eafe4021f334b5542 (patch) | |
tree | 48074c539313a4d62a7f716c4439a0d781e10e63 /lib/impure/db_sqlite.nim | |
parent | 2f4472963fca55de312c962cdc648f37bd6838e1 (diff) | |
download | Nim-ca8102b96d086bcf95d8859eafe4021f334b5542.tar.gz |
Add character set options when opening DB connection
Diffstat (limited to 'lib/impure/db_sqlite.nim')
-rw-r--r-- | lib/impure/db_sqlite.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/impure/db_sqlite.nim b/lib/impure/db_sqlite.nim index bf1ce75ef..6873e35f7 100644 --- a/lib/impure/db_sqlite.nim +++ b/lib/impure/db_sqlite.nim @@ -183,13 +183,14 @@ proc close*(db: TDbConn) {.tags: [FDb].} = ## closes the database connection. if sqlite3.close(db) != SQLITE_OK: dbError(db) -proc open*(connection, user, password, database: string): TDbConn {. - tags: [FDb].} = +proc open*(connection, user, password, database: string, + charset: string = "UTF-8"): TDbConn {.tags: [FDb].} = ## opens a database connection. Raises `EDb` if the connection could not ## be established. Only the ``connection`` parameter is used for ``sqlite``. var db: TDbConn if sqlite3.open(connection, db) == SQLITE_OK: result = db + exec(result, sql"PRAGMA encoding = ?", [charset]) else: dbError(db) |