Improved documentation for all db modules.

This commit is contained in:
Dominik Picheta 2016-01-18 13:34:26 +00:00
commit 6ca9e5cbcc
4 changed files with 134 additions and 6 deletions

View file

@ -10,7 +10,49 @@
## A higher level `mySQL`:idx: database wrapper. The same interface is ## A higher level `mySQL`:idx: database wrapper. The same interface is
## implemented for other databases too. ## implemented for other databases too.
## ##
## Example: ## See also: `db_odbc <db_odbc.html>`_, `db_sqlite <db_sqlite.html>`_,
## `db_postgres <db_postgres.html>`_.
##
## 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_mysql
## 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, ?)",
## "Dominik")
##
## Larger example
## ==============
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## ##

View file

@ -11,12 +11,54 @@
## ##
## This is the same interface that is implemented for other databases. ## This is the same interface that is implemented for other databases.
## ##
## This has NOT yet been (extensively) tested agains ODBC drivers for ## This has NOT yet been (extensively) tested against ODBC drivers for
## Teradata, Oracle, Sybase, MSSqlvSvr, et. al. databases ## Teradata, Oracle, Sybase, MSSqlvSvr, et. al. databases.
## ##
## Currently all queries are ANSI calls, not Unicode. ## Currently all queries are ANSI calls, not Unicode.
## ##
## Example: ## See also: `db_postgres <db_postgres.html>`_, `db_sqlite <db_sqlite.html>`_,
## `db_mysql <db_mysql.html>`_.
##
## 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 ## .. code-block:: Nim
## ##

View file

@ -10,6 +10,9 @@
## A higher level `PostgreSQL`:idx: database wrapper. This interface ## A higher level `PostgreSQL`:idx: database wrapper. This interface
## is implemented for other databases also. ## is implemented for other databases also.
## ##
## See also: `db_odbc <db_odbc.html>`_, `db_sqlite <db_sqlite.html>`_,
## `db_mysql <db_mysql.html>`_.
##
## Parameter substitution ## Parameter substitution
## ---------------------- ## ----------------------
## ##

View file

@ -10,7 +10,48 @@
## A higher level `SQLite`:idx: database wrapper. This interface ## A higher level `SQLite`:idx: database wrapper. This interface
## is implemented for other databases too. ## is implemented for other databases too.
## ##
## Example: ## See also: `db_odbc <db_odbc.html>`_, `db_postgres <db_postgres.html>`_,
## `db_mysql <db_mysql.html>`_.
##
## 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_sqlite
## 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, ?)",
## "Jack")
##
## Larger example
## ==============
## ##
## .. code-block:: nim ## .. code-block:: nim
## ##