# Class: SQLOperations

## vertx-sql-js/sql_operations~ SQLOperations

#### new SQLOperations()

Represents a SQL query interface to a database

Source:
  - vertx-sql-js/sql_operations.js, line 31

### Methods

#### 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:
  - vertx-sql-js/sql_operations.js, line 44

##### 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:
  - vertx-sql-js/sql_operations.js, line 91

##### 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:
  - vertx-sql-js/sql_operations.js, line 116

##### 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:
  - vertx-sql-js/sql_operations.js, line 67

##### 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:
  - vertx-sql-js/sql_operations.js, line 139

##### 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:
  - vertx-sql-js/sql_operations.js, line 163

##### Returns:

Type
  SQLOperations