From 6ca9e5cbcc940ad86045884840770415d1759f56 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 18 Jan 2016 13:34:26 +0000 Subject: Improved documentation for all db modules. --- lib/impure/db_odbc.nim | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'lib/impure/db_odbc.nim') diff --git a/lib/impure/db_odbc.nim b/lib/impure/db_odbc.nim index 6af69d842..4f0b0469d 100644 --- a/lib/impure/db_odbc.nim +++ b/lib/impure/db_odbc.nim @@ -11,12 +11,54 @@ ## ## This is the same interface that is implemented for other databases. ## -## This has NOT yet been (extensively) tested agains ODBC drivers for -## Teradata, Oracle, Sybase, MSSqlvSvr, et. al. databases +## This has NOT yet been (extensively) tested against ODBC drivers for +## Teradata, Oracle, Sybase, MSSqlvSvr, et. al. databases. ## ## Currently all queries are ANSI calls, not Unicode. ## -## Example: +## See also: `db_postgres `_, `db_sqlite `_, +## `db_mysql `_. +## +## Parameter substitution +## ---------------------- +## +## All ``db_*`` modules support the same form of parameter substitution. +## That is, using the ``?`` (question mark) to signify the place where a +## value should be placed. For example: +## +## .. code-block:: Nim +## sql"INSERT INTO myTable (colA, colB, colC) VALUES (?, ?, ?)" +## +## +## Examples +## -------- +## +## Opening a connection to a database +## ================================== +## +## .. code-block:: Nim +## import db_odbc +## let db = open("localhost", "user", "password", "dbname") +## db.close() +## +## Creating a table +## ================ +## +## .. code-block:: Nim +## db.exec(sql"DROP TABLE IF EXISTS myTable") +## db.exec(sql("""CREATE TABLE myTable ( +## id integer, +## name varchar(50) not null)""")) +## +## Inserting data +## ============== +## +## .. code-block:: Nim +## db.exec(sql"INSERT INTO myTable (id, name) VALUES (0, ?)", +## "Andreas") +## +## Large example +## ============= ## ## .. code-block:: Nim ## -- cgit 1.4.1-2-gfad0