# src/allographer/query_builder/libs/postgres/postgres_lib

Theme:

- Index

Search:
Group by:

# Imports

../../error, ../../models/database_types, postgres_rdb

# Types

    PGParams = object
      nParams*: int32
      values*: cstringArray
      lengths*: seq[int32]
      formats*: seq[int32]

# Procs

    proc appendDbRowWithBaseColumns(res: PPGresult; dbRows: var DbRows;
                                    line, cols: int32; base: DbColumns) {.
        ...raises: [], tags: [], forbids: [].}

    proc buildBaseDbColumns(res: PPGresult; cols: int32): DbColumns {....raises: [],
        tags: [], forbids: [].}

    proc checkError(db: PPGconn) {....raises: [DbError], tags: [], forbids: [].}

  Raises a DbError exception.

    proc dbError(db: PPGconn) {.noreturn, ...raises: [DbError], tags: [], forbids: [].}

  raises a DbError exception.

    proc dbFormat(formatstr: string; args: varargs[string]): string {.
        ...raises: [DbError], tags: [], forbids: [].}

    proc fromArray(_: type PGParams; args: JsonNode): PGParams

  `args` is JArray `{true, 1, 1.1, "alice"}`

    proc fromObjArray(_: type PGParams; args: JsonNode): PGParams

  `args` is JArray `[{"key": "bool", "value": true},{"key": "int", "value": 1}]`

    proc fromObjArray(_: type PGParams; args: JsonNode; columns: seq[Row]): PGParams

    proc newRow(L: int): Row {....raises: [], tags: [], forbids: [].}

    proc questionToDaller(s: string): string {....raises: [], tags: [], forbids: [].}

  from `UPDATE user SET name = ?, email = ? WHERE id = ?`

  to `UPDATE user SET name = $1, email = $2 WHERE id = $3`

    proc setColumnInfo(res: PPGresult; dbRows: var DbRows; line, cols: int32) {.
        ...raises: [], tags: [], forbids: [].}

    proc setRow(res: PPGresult; r: var Row; line, cols: int32) {....raises: [],
        tags: [], forbids: [].}