Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SQLOperations

Represents a SQL query interface to a database

Hierarchy

  • SQLOperations

Implemented by

Index

Methods

call

  • Calls the given SQL PROCEDURE which returns the result from the procedure.

    Parameters

    • sql: string

    Returns PromiseLike<ResultSet>

  • Calls the given SQL PROCEDURE which returns the result from the procedure.

    Parameters

    • sql: string
    • resultHandler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>

    Returns SQLOperations

callWithParams

  • callWithParams(sql: string, params: any[], outputs: any[]): PromiseLike<ResultSet>
  • callWithParams(sql: string, params: any[], outputs: any[], resultHandler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>): SQLOperations
  • Calls the given SQL PROCEDURE which returns the result from the procedure.

    The index of params and outputs are important for both arrays, for example when dealing with a prodecure that takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like:

      params = [VALUE1, VALUE2, null]
      outputs = [null, null, "VARCHAR"]
    

    Parameters

    • sql: string
    • params: any[]
    • outputs: any[]

    Returns PromiseLike<ResultSet>

  • Calls the given SQL PROCEDURE which returns the result from the procedure.

    The index of params and outputs are important for both arrays, for example when dealing with a prodecure that takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like:

      params = [VALUE1, VALUE2, null]
      outputs = [null, null, "VARCHAR"]
    

    Parameters

    • sql: string
    • params: any[]
    • outputs: any[]
    • resultHandler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>

    Returns SQLOperations

query

  • Executes the given SQL SELECT statement which returns the results of the query.

    Parameters

    • sql: string

    Returns PromiseLike<ResultSet>

  • Executes the given SQL SELECT statement which returns the results of the query.

    Parameters

    • sql: string
    • resultHandler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>

    Returns SQLOperations

querySingle

  • querySingle(sql: string): PromiseLike<any[]>
  • querySingle(sql: string, handler: ((res: AsyncResult<any[]>) => void) | Handler<AsyncResult<any[]>>): SQLOperations
  • Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.

    Parameters

    • sql: string

    Returns PromiseLike<any[]>

  • Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.

    Parameters

    • sql: string
    • handler: ((res: AsyncResult<any[]>) => void) | Handler<AsyncResult<any[]>>

    Returns SQLOperations

querySingleWithParams

  • querySingleWithParams(sql: string, arguments: any[]): PromiseLike<any[]>
  • querySingleWithParams(sql: string, arguments: any[], handler: ((res: AsyncResult<any[]>) => void) | Handler<AsyncResult<any[]>>): SQLOperations
  • Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.

    Parameters

    • sql: string
    • arguments: any[]

    Returns PromiseLike<any[]>

  • Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.

    Parameters

    • sql: string
    • arguments: any[]
    • handler: ((res: AsyncResult<any[]>) => void) | Handler<AsyncResult<any[]>>

    Returns SQLOperations

queryStream

  • Executes the given SQL SELECT statement which returns the results of the query as a read stream.

    Parameters

    • sql: string

    Returns PromiseLike<SQLRowStream>

  • Executes the given SQL SELECT statement which returns the results of the query as a read stream.

    Parameters

    Returns SQLOperations

queryStreamWithParams

  • Executes the given SQL SELECT statement which returns the results of the query as a read stream.

    Parameters

    • sql: string
    • params: any[]

    Returns PromiseLike<SQLRowStream>

  • Executes the given SQL SELECT statement which returns the results of the query as a read stream.

    Parameters

    Returns SQLOperations

queryWithParams

  • queryWithParams(sql: string, params: any[]): PromiseLike<ResultSet>
  • queryWithParams(sql: string, params: any[], resultHandler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>): SQLOperations
  • Executes the given SQL SELECT prepared statement which returns the results of the query.

    Parameters

    • sql: string
    • params: any[]

    Returns PromiseLike<ResultSet>

  • Executes the given SQL SELECT prepared statement which returns the results of the query.

    Parameters

    • sql: string
    • params: any[]
    • resultHandler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>

    Returns SQLOperations

update

  • Executes the given SQL statement which may be an INSERT, UPDATE, or DELETE statement.

    Parameters

    • sql: string

    Returns PromiseLike<UpdateResult>

  • Executes the given SQL statement which may be an INSERT, UPDATE, or DELETE statement.

    Parameters

    Returns SQLOperations

updateWithParams

  • Executes the given prepared statement which may be an INSERT, UPDATE, or DELETE statement with the given parameters

    Parameters

    • sql: string
    • params: any[]

    Returns PromiseLike<UpdateResult>

  • Executes the given prepared statement which may be an INSERT, UPDATE, or DELETE statement with the given parameters

    Parameters

    • sql: string
    • params: any[]
    • resultHandler: ((res: AsyncResult<UpdateResult>) => void) | Handler<AsyncResult<UpdateResult>>

    Returns SQLOperations

Generated using TypeDoc