Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JDBCClient

An asynchronous client interface for interacting with a JDBC compliant database

Hierarchy

Implements

Index

Properties

Static Readonly DEFAULT_DS_NAME

DEFAULT_DS_NAME: string

The name of the default data source

Static Readonly DEFAULT_PROVIDER_CLASS

DEFAULT_PROVIDER_CLASS: string

The default data source provider is C3P0

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
    • handler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>

    Returns SQLClient

callWithParams

  • callWithParams(sql: string, params: any[], outputs: any[]): PromiseLike<ResultSet>
  • callWithParams(sql: string, params: any[], outputs: any[], handler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>): SQLClient
  • 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[]
    • handler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>

    Returns SQLClient

close

  • close(): PromiseLike<void>
  • close(handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • close(): void
  • Close the client and release all resources. Call the handler when close is complete.

    Returns PromiseLike<void>

  • Close the client and release all resources. Call the handler when close is complete.

    Parameters

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

    Returns void

  • Close the client

    Returns void

getConnection

  • Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.

    Returns PromiseLike<SQLConnection>

  • Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.

    Parameters

    Returns SQLClient

query

  • Execute a single SQL statement, this method acquires a connection from the the pool and executes the SQL statement and returns it back after the execution.

    Parameters

    • sql: string

    Returns PromiseLike<ResultSet>

  • Execute a single SQL statement, this method acquires a connection from the the pool and executes the SQL statement and returns it back after the execution.

    Parameters

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

    Returns SQLClient

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 SQLClient

queryStreamWithParams

  • queryStreamWithParams(sql: string, params: any[]): PromiseLike<SQLRowStream>
  • queryStreamWithParams(sql: string, params: any[], handler: ((res: AsyncResult<SQLRowStream>) => void) | Handler<AsyncResult<SQLRowStream>>): SQLClient

queryWithParams

  • queryWithParams(sql: string, arguments: any[]): PromiseLike<ResultSet>
  • queryWithParams(sql: string, arguments: any[], handler: ((res: AsyncResult<ResultSet>) => void) | Handler<AsyncResult<ResultSet>>): SQLClient
  • Execute a single SQL prepared statement, this method acquires a connection from the the pool and executes the SQL prepared statement and returns it back after the execution.

    Parameters

    • sql: string
    • arguments: any[]

    Returns PromiseLike<ResultSet>

  • Execute a single SQL prepared statement, this method acquires a connection from the the pool and executes the SQL prepared statement and returns it back after the execution.

    Parameters

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

    Returns SQLClient

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 SQLClient

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

    Returns SQLClient

Static create

  • Create a JDBC client which maintains its own data source.

    Parameters

    • vertx: Vertx
    • config: {}
      • [key: string]: any

    Returns JDBCClient

Static createShared

  • createShared(vertx: Vertx, config: {}, dataSourceName: string): JDBCClient
  • createShared(vertx: Vertx, config: {}): JDBCClient
  • Create a JDBC client which shares its data source with any other JDBC clients created with the same data source name

    Parameters

    • vertx: Vertx
    • config: {}
      • [key: string]: any
    • dataSourceName: string

    Returns JDBCClient

  • Like {@link JDBCClient#createShared} but with the default data source name

    Parameters

    • vertx: Vertx
    • config: {}
      • [key: string]: any

    Returns JDBCClient

Generated using TypeDoc