limit

Set the limit clause

limit(sql: String, limit: Number, offset: [Number]): String
Parameters
sql (String) SQL statement to modify
limit (Number) Maximum number of rows to fetch
offset ([Number]) Number of rows to skip
Returns
String: Modified SQL statement

quoteTable

Quote database table name, and set prefix

quoteTable(table: String): String
Parameters
table (String) Table name to quote
Returns
String: Quoted table name

quoteIdentifiers

Use the driver's escape character to quote identifiers

quoteIdentifiers(str: (String | Array)): (String | Array)
Parameters
str ((String | Array)) String or array of strings to quote identifiers
Returns
(String | Array): Quoted identifier(s)

truncate

Generate SQL to truncate the passed table

truncate(table: String): String
Parameters
table (String) Table to truncate
Returns
String: Truncation SQL

insertBatch

Generate SQL to insert a group of rows

insertBatch(table: String, data: [Array]): String
Parameters
table (String) The table to insert to
data ([Array]) The array of object containing data to insert
Returns
String: Query and data to insert

NodeQuery

Class for connection management

new NodeQuery(config: object)
Parameters
config (object) connection parameters
Instance Members
constructor(config)
getQuery()

QueryBuilder

Main object that builds SQL queries.

new QueryBuilder(Driver: Driver, Adapter: Adapter)

Extends QueryBuilderBase

Parameters
Driver (Driver) The syntax driver for the database
Adapter (Adapter) The database module adapter for running queries
Instance Members
query(sql, [params], [callback])
resetQuery()
truncate(table, [callback])
end()
select(fields)
from(tableName)
like(field, val, [pos])
notLike(field, val, [pos])
orLike(field, val, [pos])
orNotLike(field, val, [pos])
having(key, [val])
orHaving(key, [val])
where(key, [val])
orWhere(key, [val])
whereIsNull(field)
whereIsNotNull(field)
orWhereIsNull(field)
orWhereIsNotNull(field)
whereIn(key, values)
orWhereIn(key, values)
whereNotIn(key, values)
orWhereNotIn(key, values)
set(key, [val])
join(table, cond, [type])
groupBy(field)
orderBy(field, [type])
limit(limit, [offset])
groupStart()
orGroupStart()
orNotGroupStart()
groupEnd()
get([table], [limit], [offset], [callback])
insert(table, [data], [callback])
insertBatch(table, data, [callback])
update(table, [data], [callback])
delete(table, [where], [callback])
getCompiledSelect([table], [reset])
getCompiledInsert(table, [reset])
getCompiledUpdate(table, [reset])
getCompiledDelete(table, [reset])

Result

Query result object

new Result(rows: Array, columns: Array)
Parameters
rows (Array) the data rows of the result
columns (Array) the column names in the result
Instance Members
rowCount()
columnCount()