Represents a SQL query interface to a database

no type hierarchy

no supertypes hierarchy

Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
callshared SQLOperations call(String sql, Anything(Throwable|ResultSet) resultHandler)

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

Parameters:
  • sql

    the SQL to execute. For example {call getEmpName}.

  • resultHandler

    the handler which is called once the operation completes. It will return a ResultSet.

callWithParamsshared SQLOperations callWithParams(String sql, Array params, Array outputs, Anything(Throwable|ResultSet) resultHandler)

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

    the SQL to execute. For example {call getEmpName (?, ?)}.

  • params

    these are the parameters to fill the statement.

  • outputs

    these are the outputs to fill the statement.

  • resultHandler

    the handler which is called once the operation completes. It will return a ResultSet.

queryshared SQLOperations query(String sql, Anything(Throwable|ResultSet) resultHandler)

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

Parameters:
  • sql

    the SQL to execute. For example SELECT * FROM table ….

  • resultHandler

    the handler which is called once the operation completes. It will return a ResultSet.

querySingleshared SQLOperations querySingle(String sql, Anything(Throwable|Array?) handler)

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

    the statement to execute

  • handler

    the result handler

querySingleWithParamsshared SQLOperations querySingleWithParams(String sql, Array arguments, Anything(Throwable|Array?) handler)

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

    the statement to execute

  • arguments

    the arguments

  • handler

    the result handler

queryWithParamsshared SQLOperations queryWithParams(String sql, Array params, Anything(Throwable|ResultSet) resultHandler)

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

Parameters:
  • sql

    the SQL to execute. For example SELECT * FROM table ….

  • params

    these are the parameters to fill the statement.

  • resultHandler

    the handler which is called once the operation completes. It will return a ResultSet.

updateshared SQLOperations update(String sql, Anything(Throwable|UpdateResult) resultHandler)

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

Parameters:
  • sql

    the SQL to execute. For example INSERT INTO table …

  • resultHandler

    the handler which is called once the operation completes.

updateWithParamsshared SQLOperations updateWithParams(String sql, Array params, Anything(Throwable|UpdateResult) resultHandler)

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

Parameters:
  • sql

    the SQL to execute. For example INSERT INTO table …

  • params

    these are the parameters to fill the statement.

  • resultHandler

    the handler which is called once the operation completes.

Inherited Methods
Methods inherited from: Object
equals