Class: SQLOperations

vertx-sql-js/sql_operations~ SQLOperations

new SQLOperations()

Represents a SQL query interface to a database
Source:

Methods

call(sql, resultHandler) → {SQLOperations}

Calls the given SQL PROCEDURE which returns the result from the procedure.
Parameters:
Name Type Description
sql string the SQL to execute. For example {call getEmpName}.
resultHandler function the handler which is called once the operation completes. It will return a ResultSet.
Source:
Returns:
Type
SQLOperations

callWithParams(sql, params, outputs, resultHandler) → {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:
Name Type Description
sql string the SQL to execute. For example {call getEmpName (?, ?)}.
params todo these are the parameters to fill the statement.
outputs todo these are the outputs to fill the statement.
resultHandler function the handler which is called once the operation completes. It will return a ResultSet.
Source:
Returns:
Type
SQLOperations

query(sql, resultHandler) → {SQLOperations}

Executes the given SQL SELECT statement which returns the results of the query.
Parameters:
Name Type Description
sql string the SQL to execute. For example SELECT * FROM table ....
resultHandler function the handler which is called once the operation completes. It will return a ResultSet.
Source:
Returns:
Type
SQLOperations

querySingle(sql, handler) → {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:
Name Type Description
sql string the statement to execute
handler function the result handler
Source:
Returns:
self
Type
SQLOperations

querySingleWithParams(sql, arguments, handler) → {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:
Name Type Description
sql string the statement to execute
arguments todo the arguments
handler function the result handler
Source:
Returns:
self
Type
SQLOperations

queryWithParams(sql, params, resultHandler) → {SQLOperations}

Executes the given SQL SELECT prepared statement which returns the results of the query.
Parameters:
Name Type Description
sql string the SQL to execute. For example SELECT * FROM table ....
params todo these are the parameters to fill the statement.
resultHandler function the handler which is called once the operation completes. It will return a ResultSet.
Source:
Returns:
Type
SQLOperations

update(sql, resultHandler) → {SQLOperations}

Executes the given SQL statement which may be an INSERT, UPDATE, or DELETE statement.
Parameters:
Name Type Description
sql string the SQL to execute. For example INSERT INTO table ...
resultHandler function the handler which is called once the operation completes.
Source:
Returns:
Type
SQLOperations

updateWithParams(sql, params, resultHandler) → {SQLOperations}

Executes the given prepared statement which may be an INSERT, UPDATE, or DELETE statement with the given parameters
Parameters:
Name Type Description
sql string the SQL to execute. For example INSERT INTO table ...
params todo these are the parameters to fill the statement.
resultHandler function the handler which is called once the operation completes.
Source:
Returns:
Type
SQLOperations