Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PreparedStatement

A prepared statement, the statement is pre-compiled and it's more efficient to execute the statement for multiple times. In addition, this kind of statement provides protection against SQL injection attacks.

From a prepared statement you can

  • use {@link PreparedStatement#query} to create and execute a PreparedQuery
  • use {@link PreparedStatement#cursor} to create a Cursor
  • use {@link PreparedStatement#createStream} to create a RowStream

Hierarchy

  • PreparedStatement

Index

Methods

close

  • close(): PromiseLike<void>
  • close(completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Like {@link PreparedStatement#close} but notifies the completionHandler when it's closed.

    Returns PromiseLike<void>

  • Like {@link PreparedStatement#close} but notifies the completionHandler when it's closed.

    Parameters

    • completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

createStream

  • Like {@link PreparedStatement#createStream} but with empty arguments.

    Parameters

    • fetch: number

    Returns RowStream<Row>

  • Execute the prepared query with a cursor and createStream the result. The createStream opens a cursor with a fetch size to fetch the results.

    Note: this requires to be in a transaction, since cursors require it.

    Parameters

    • fetch: number
    • args: Tuple

    Returns RowStream<Row>

cursor

  • Like {@link PreparedStatement#cursor} but with empty arguments.

    Returns Cursor

  • Create a cursor with the provided arguments.

    Parameters

    Returns Cursor

query

  • Create a prepared query for this statement.

    Returns PreparedQuery<RowSet<Row>>

Generated using TypeDoc