async_postgres/pg_client/prepared

Named server-side prepared statements: prepare, execute, and close.

Types

PreparedStatement = object
  conn*: PgConnection
  name*: string
  sql*: string
  fields*: seq[FieldDescription]
  paramOids*: seq[int32]
A server-side prepared statement returned by prepare.

Procs

proc close(stmt: PreparedStatement; timeout: Duration = ZeroDuration): Future[
    void] {....stackTrace: false, raises: [Exception, ValueError, CatchableError,
                                        PgConnectionError, ProtocolError,
                                        SslError, PgQueryError, PgTimeoutError,
                                        AsyncTimeoutError],
            tags: [RootEffect, TimeEffect], forbids: [].}
Close a prepared statement. On timeout, the connection is marked csClosed (protocol out of sync).
proc closeImpl(stmt: PreparedStatement; timeout: Duration = ZeroDuration): Future[
    void] {....stackTrace: false, raises: [Exception, PgConnectionError,
                                        ValueError, ProtocolError, SslError,
                                        PgQueryError, AsyncTimeoutError,
                                        CatchableError],
            tags: [RootEffect, TimeEffect], forbids: [].}
proc columnIndex(stmt: PreparedStatement; name: string): int {.
    ...raises: [PgTypeError], tags: [], forbids: [].}
Find the index of a column by name in a prepared statement.
proc execute(stmt: PreparedStatement; params: seq[PgParam] = @[];
             resultFormat: ResultFormat = rfAuto;
             timeout: Duration = ZeroDuration): Future[QueryResult] {.
    ...stackTrace: false, raises: [Exception, ValueError, CatchableError],
    tags: [RootEffect, TimeEffect], forbids: [].}
Execute a prepared statement with typed parameters.
proc executeImpl(stmt: PreparedStatement; params: seq[PgParam] = @[];
                 resultFormats: seq[int16] = @[];
                 timeout: Duration = ZeroDuration): Future[QueryResult] {.
    ...stackTrace: false, raises: [Exception, ValueError, PgConnectionError,
                                PgTypeError, ProtocolError, SslError,
                                PgQueryError, AsyncTimeoutError, CatchableError],
    tags: [RootEffect, TimeEffect], forbids: [].}
proc prepare(conn: PgConnection; name: string; sql: string;
             timeout: Duration = ZeroDuration): Future[PreparedStatement] {.
    ...stackTrace: false, raises: [Exception, ValueError, CatchableError],
    tags: [RootEffect, TimeEffect], forbids: [].}
Prepare a named statement, returning metadata. On timeout, the connection is marked csClosed (protocol out of sync).
proc prepareImpl(conn: PgConnection; name: string; sql: string;
                 timeout: Duration = ZeroDuration): Future[PreparedStatement] {.
    ...stackTrace: false, raises: [Exception, ValueError, PgConnectionError,
                                ProtocolError, SslError, PgQueryError,
                                AsyncTimeoutError, CatchableError],
    tags: [RootEffect, TimeEffect], forbids: [].}