diff options
author | Hitesh Jasani <hitesh@grokken.com> | 2013-12-03 20:13:40 -0500 |
---|---|---|
committer | Hitesh Jasani <hitesh@grokken.com> | 2013-12-04 14:01:25 -0500 |
commit | 20661c9c46028b9a937bd79ec5b06c96618ddd39 (patch) | |
tree | 5350023fd8e9335920a638efeaaf3865f658103c /lib | |
parent | 32d2327be025f62bd1b51a98322879cc7e8d218f (diff) | |
download | Nim-20661c9c46028b9a937bd79ec5b06c96618ddd39.tar.gz |
Add docs for connecting to postgres with keyword/value connection
strings.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/impure/db_postgres.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/impure/db_postgres.nim b/lib/impure/db_postgres.nim index 2dd55e05f..157d58c7c 100644 --- a/lib/impure/db_postgres.nim +++ b/lib/impure/db_postgres.nim @@ -180,6 +180,21 @@ proc Open*(connection, user, password, database: string): TDbConn {. tags: [FDb].} = ## opens a database connection. Raises `EDb` if the connection could not ## be established. + ## + ## Clients can also use Postgres keyword/value connection strings to + ## connect. + ## + ## Example: + ## + ## .. code-block:: nimrod + ## + ## con = Open("", "", "", "host=localhost port=5432 dbname=mydb") + ## + ## See http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING + ## for more information. + ## + ## Note that the connection parameter is not used but exists to maintain + ## the nimrod db api. result = PQsetdbLogin(nil, nil, nil, nil, database, user, password) if PQStatus(result) != CONNECTION_OK: dbError(result) # result = nil |