Constructor
new SqlPool(options, defaultsopt)
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | an object defining the pool, the following properties define the pool: Properties
|
|||||||||||||
defaults |
object |
<optional> |
an object with default pool methods for init and shutdown and other properties, see Pool |
Methods
nextToken(client, req, rows) → {object}
- Description:
Support for pagination, for SQL this is the OFFSET for the next request
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
client |
object | |
req |
DbRequest | |
rows |
Array.<object> |
Returns:
| Type | Description |
|---|---|
| object |
prepare(req)
- Description:
Prepare for execution, return an object with formatted or transformed SQL query for the database driver of this pool
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
req |
DbRequest |
prepareUpdateExpr(req, expr)
- Description:
SQL SET expression for a column
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req |
DbRequest | |||||||||||||||||||||||||
expr |
object |
Properties
|
prepareUpsertExpr(req) → {string}
- Description:
Build UPSERT or ON CONFLICT statement
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
req |
DbRequest |
Returns:
| Type | Description |
|---|---|
| string |
full SQL text or nothing to use default |
query(client, req, callback)
- Description:
Execute a query in req.text
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
client |
object | |
req |
DbRequest | |
callback |
function |