Represents a connection to a SQL database

no subtypes hierarchy

Initializer
SQLConnection(SQLConnection unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
callshared default SQLConnection 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 default SQLConnection callWithParams(String sql, Array params, Array outputs, 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 (?, ?)}.

  • 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.

closeshared default void close()

Closes the connection. Important to always close the connection when you are done so it's returned to the pool.

closeshared default void close(Anything(Throwable?) handler)

Closes the connection. Important to always close the connection when you are done so it's returned to the pool.

Parameters:
  • handler

    the handler called when this operation completes.

commitshared default SQLConnection commit(Anything(Throwable?) handler)

Commits all changes made since the previous commit/rollback.

Parameters:
  • handler

    the handler called when this operation completes.

executeshared default SQLConnection execute(String sql, Anything(Throwable?) resultHandler)

Executes the given SQL statement

Parameters:
  • sql

    the SQL to execute. For example CREATE TABLE IF EXISTS table …

  • resultHandler

    the handler which is called once this operation completes.

queryshared default SQLConnection 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.

queryWithParamsshared default SQLConnection 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.

rollbackshared default SQLConnection rollback(Anything(Throwable?) handler)

Rolls back all changes made since the previous commit/rollback.

Parameters:
  • handler

    the handler called when this operation completes.

setAutoCommitshared default SQLConnection setAutoCommit(Boolean autoCommit, Anything(Throwable?) resultHandler)

Sets the auto commit flag for this connection. True by default.

Parameters:
  • autoCommit

    the autoCommit flag, true by default.

  • resultHandler

    the handler which is called once this operation completes.

updateshared default SQLConnection 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 default SQLConnection 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