use single backtick (#17100)
This commit is contained in:
parent
35ded02074
commit
9450bf6c08
10 changed files with 81 additions and 81 deletions
|
|
@ -16,8 +16,8 @@
|
|||
## Parameter substitution
|
||||
## ======================
|
||||
##
|
||||
## All ``db_*`` modules support the same form of parameter substitution.
|
||||
## That is, using the ``?`` (question mark) to signify the place where a
|
||||
## 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
|
||||
|
|
@ -179,7 +179,7 @@ iterator fastRows*(db: DbConn, query: SqlQuery,
|
|||
## if you require **ALL** the rows.
|
||||
##
|
||||
## Breaking the fastRows() iterator during a loop will cause the next
|
||||
## database query to raise an [EDb] exception ``Commands out of sync``.
|
||||
## database query to raise an [EDb] exception `Commands out of sync`.
|
||||
rawExec(db, query, args)
|
||||
var sqlres = mysql.useResult(PMySQL db)
|
||||
if sqlres != nil:
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
## Parameter substitution
|
||||
## ======================
|
||||
##
|
||||
## All ``db_*`` modules support the same form of parameter substitution.
|
||||
## That is, using the ``?`` (question mark) to signify the place where a
|
||||
## 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
|
||||
|
|
@ -168,7 +168,7 @@ proc dbError*(db: var DbConn) {.
|
|||
raise e
|
||||
|
||||
proc sqlCheck(db: var DbConn, resVal: TSqlSmallInt) {.raises: [DbError]} =
|
||||
## Wrapper that raises [EDb] if ``resVal`` is neither SQL_SUCCESS or SQL_NO_DATA
|
||||
## Wrapper that raises [EDb] if `resVal` is neither SQL_SUCCESS or SQL_NO_DATA
|
||||
if resVal notIn [SQL_SUCCESS, SQL_NO_DATA]: dbError(db)
|
||||
|
||||
proc sqlGetDBMS(db: var DbConn): string {.
|
||||
|
|
@ -195,7 +195,7 @@ proc dbQuote*(s: string): string {.noSideEffect.} =
|
|||
|
||||
proc dbFormat(formatstr: SqlQuery, args: varargs[string]): string {.
|
||||
noSideEffect.} =
|
||||
## Replace any ``?`` placeholders with `args`,
|
||||
## Replace any `?` placeholders with `args`,
|
||||
## and quotes the arguments
|
||||
result = ""
|
||||
var a = 0
|
||||
|
|
@ -498,7 +498,7 @@ proc open*(connection, user, password, database: string): DbConn {.
|
|||
## Raises `EDb` if the connection could not be established.
|
||||
##
|
||||
## Currently the database parameter is ignored,
|
||||
## but included to match ``open()`` in the other db_xxxxx library modules.
|
||||
## but included to match `open()` in the other db_xxxxx library modules.
|
||||
var
|
||||
val = SQL_OV_ODBC3
|
||||
resLen = 0
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
## Parameter substitution
|
||||
## ======================
|
||||
##
|
||||
## All ``db_*`` modules support the same form of parameter substitution.
|
||||
## That is, using the ``?`` (question mark) to signify the place where a
|
||||
## 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
|
||||
|
|
@ -26,9 +26,9 @@
|
|||
## **Note**: There are two approaches to parameter substitution support by
|
||||
## this module.
|
||||
##
|
||||
## 1. ``SqlQuery`` using ``?, ?, ?, ...`` (same as all the ``db_*`` modules)
|
||||
## 1. `SqlQuery` using `?, ?, ?, ...` (same as all the `db_*` modules)
|
||||
##
|
||||
## 2. ``SqlPrepared`` using ``$1, $2, $3, ...``
|
||||
## 2. `SqlPrepared` using `$1, $2, $3, ...`
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## prepare(db, "myExampleInsert",
|
||||
|
|
@ -184,8 +184,8 @@ proc setupQuery(db: DbConn, stmtName: SqlPrepared,
|
|||
|
||||
proc prepare*(db: DbConn; stmtName: string, query: SqlQuery;
|
||||
nParams: int): SqlPrepared =
|
||||
## Creates a new ``SqlPrepared`` statement. Parameter substitution is done
|
||||
## via ``$1``, ``$2``, ``$3``, etc.
|
||||
## Creates a new `SqlPrepared` statement. Parameter substitution is done
|
||||
## via `$1`, `$2`, `$3`, etc.
|
||||
if nParams > 0 and not string(query).contains("$1"):
|
||||
dbError("parameter substitution expects \"$1\"")
|
||||
var res = pqprepare(db, stmtName, query.string, int32(nParams), nil)
|
||||
|
|
@ -488,8 +488,8 @@ proc tryInsertID*(db: DbConn, query: SqlQuery,
|
|||
tags: [WriteDbEffect].}=
|
||||
## executes the query (typically "INSERT") and returns the
|
||||
## generated ID for the row or -1 in case of an error. For Postgre this adds
|
||||
## ``RETURNING id`` to the query, so it only works if your primary key is
|
||||
## named ``id``.
|
||||
## `RETURNING id` to the query, so it only works if your primary key is
|
||||
## named `id`.
|
||||
var x = pqgetvalue(setupQuery(db, SqlQuery(string(query) & " RETURNING id"),
|
||||
args), 0, 0)
|
||||
if not isNil(x):
|
||||
|
|
@ -502,8 +502,8 @@ proc insertID*(db: DbConn, query: SqlQuery,
|
|||
tags: [WriteDbEffect].} =
|
||||
## executes the query (typically "INSERT") and returns the
|
||||
## generated ID for the row. For Postgre this adds
|
||||
## ``RETURNING id`` to the query, so it only works if your primary key is
|
||||
## named ``id``.
|
||||
## `RETURNING id` to the query, so it only works if your primary key is
|
||||
## named `id`.
|
||||
result = tryInsertID(db, query, args)
|
||||
if result < 0: dbError(db)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
## Parameter substitution
|
||||
## ----------------------
|
||||
##
|
||||
## All ``db_*`` modules support the same form of parameter substitution.
|
||||
## That is, using the ``?`` (question mark) to signify the place where a
|
||||
## 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
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
## Note
|
||||
## ====
|
||||
## This module does not implement any ORM features such as mapping the types from the schema.
|
||||
## Instead, a ``seq[string]`` is returned for each row.
|
||||
## Instead, a `seq[string]` is returned for each row.
|
||||
##
|
||||
## The reasoning is as follows:
|
||||
## 1. it's close to what many DBs offer natively (char**)
|
||||
|
|
@ -221,7 +221,7 @@ proc dbFormat(formatstr: SqlQuery, args: varargs[string]): string =
|
|||
add(result, c)
|
||||
|
||||
proc prepare*(db: DbConn; q: string): SqlPrepared {.since: (1, 3).} =
|
||||
## Creates a new ``SqlPrepared`` statement.
|
||||
## Creates a new `SqlPrepared` statement.
|
||||
if prepare_v2(db, q, q.len.cint,result.PStmt, nil) != SQLITE_OK:
|
||||
discard finalize(result.PStmt)
|
||||
dbError(db)
|
||||
|
|
@ -310,8 +310,8 @@ iterator fastRows*(db: DbConn, query: SqlQuery,
|
|||
## if you require **ALL** the rows.
|
||||
##
|
||||
## **Note:** Breaking the `fastRows()` iterator during a loop will cause the
|
||||
## next database query to raise a `DbError` exception ``unable to close due
|
||||
## to ...``.
|
||||
## next database query to raise a `DbError` exception `unable to close due
|
||||
## to ...`.
|
||||
##
|
||||
## **Examples:**
|
||||
##
|
||||
|
|
@ -674,8 +674,8 @@ proc insertID*(db: DbConn, query: SqlQuery,
|
|||
## generated ID for the row.
|
||||
##
|
||||
## Raises a `DbError` exception when failed to insert row.
|
||||
## For Postgre this adds ``RETURNING id`` to the query, so it only works
|
||||
## if your primary key is named ``id``.
|
||||
## For Postgre this adds `RETURNING id` to the query, so it only works
|
||||
## if your primary key is named `id`.
|
||||
##
|
||||
## **Examples:**
|
||||
##
|
||||
|
|
@ -755,7 +755,7 @@ proc open*(connection, user, password, database: string): DbConn {.
|
|||
## Opens a database connection. Raises a `DbError` exception if the connection
|
||||
## could not be established.
|
||||
##
|
||||
## **Note:** Only the ``connection`` parameter is used for ``sqlite``.
|
||||
## **Note:** Only the `connection` parameter is used for `sqlite`.
|
||||
##
|
||||
## **Examples:**
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue