-
Notifications
You must be signed in to change notification settings - Fork 7
jSQLWhereClause class
For query types that have a where clause ("DELETE", "SELECT", and "UPDATE"), this method is accessed via the query's where() method. This is used to filter and sort results in a "SELECT" query or the results to be edited or delete with "DELETE" and "UPDATE" queries.
Set a column to add a filter to.
- column: The column to be used in the filter.
- The
jSQLWhereClauseobject.
var allSusans =
jSQL.select('*')
.from('Users')
.where('Name')
.equals('Susan')
.execute()
.fetchAll();
Filter results to ones where the filtered column matches the given value
- value: The value to be used in the filter.
- The
jSQLWhereClauseobject.
var OldUsers =
jSQL.select(['Name', 'Age'])
.from('Users')
.where('Age')
.equals(37)
.execute()
.fetchAll();
For use with "LIKE" modifiers which are used with a prepared query.
- The
jSQLWhereClauseobject.
var PatrioticUsers =
jSQL.select(['Name', 'Age'])
.from('Users')
.where('Name')
.preparedLike()
.execute(['%usa%'])
.fetchAll();
Filter results to ones where the filtered column does not match the given value
- value: The value to be used in the filter.
- The
jSQLWhereClauseobject.
var EveryoneButSusan =
jSQL.select(['Name', 'Age'])
.from('Users')
.where('Name')
.doesNotEqual('Susan')
.execute()
.fetchAll();
Filter results to ones where the filtered column is less than the given value
- value: The value to be used in the filter.
- The
jSQLWhereClauseobject.
var hipsters =
jSQL.select(['Name'])
.from('Users')
.where('Age')
.lessThan(23)
.execute()
.fetchAll();
Filter results to ones where the filtered column contains the given substring.
- value: The value to be used in the filter.
- The
jSQLWhereClauseobject.
var UsersLikeBob =
jSQL.select(['Name'])
.from('Users')
.where('Name')
.contains('bob')
.execute()
.fetchAll();
Filter results to ones where the filtered column ends with the given substring.
- value: The value to be used in the filter.
- The
jSQLWhereClauseobject.
var nameEndsWithB =
jSQL.select(['Name'])
.from('Users')
.where('Name')
.endsWith('b')
.execute()
.fetchAll();
Filter results to ones where the filtered column begins with the given substring.
- value: The value to be used in the filter.
- The
jSQLWhereClauseobject.
var nameBeginsWithB =
jSQL.select(['Name'])
.from('Users')
.where('Name')
.beginsWith('b')
.execute()
.fetchAll();
Begin an additional condition. Results must match both this condition and the preceeding one.
- column: The column to be used in the filter.
- The
jSQLWhereClauseobject.
var nameBeginsAndEndsWithB =
jSQL.select(['Name'])
.from('Users')
.where('Name')
.beginsWith('b')
.and('Name')
.endsWith('b')
.execute()
.fetchAll();
Begin an additional condition. Results must match either this condition or the preceeding one.
- column: The column to be used in the filter.
- The
jSQLWhereClauseobject.
var nameBeginsOrEndsWithB =
jSQL.select(['Name'])
.from('Users')
.where('Name')
.beginsWith('b')
.or('Name')
.endsWith('b')
.execute()
.fetchAll();
Limit the rows returned, deleted, or updated.
- limit: The number of rows to limit to.
- offset: The index at which to begin the result set.
- The
jSQLWhereClauseobject.
var first3Users =
jSQL.select('Name')
.from('Users')
.limit(3)
.execute()
.fetchAll();
Sort the result set. Only useful for "SELECT" queries.
- column: The column or columns to order results by
- The
jSQLWhereClauseobject.
var first3Users =
jSQL.select('Name')
.from('Users')
.limit(3)
.orderBy('Name')
.asc()
.execute()
.fetchAll();
Sort the result set ASCENDING. Only useful for "SELECT" queries.
- The
jSQLWhereClauseobject.
var first3Users =
jSQL.select('*')
.from('Users')
.limit(3)
.orderBy('Name')
.asc()
.execute()
.fetchAll();
Sort the result set DESCENDING. Only useful for "SELECT" queries.
- The
jSQLWhereClauseobject.
var first3Users =
jSQL.select('*')
.from('Users')
.limit(3)
.orderBy('Name')
.desc()
.execute()
.fetchAll();
Builds the result set based on conditions and prepared values provided and then executes the query's execute method and returns the query itself rather than the query's where clause.
- The
jSQLQueryobject.
var allUsers =
jSQL.select('*')
.from('Users')
.execute()
.fetchAll();
jSQLTable.namejSQLTable.columnsjSQLTable.datajSQLTable.colmapjSQLTable.renameColumnjSQLTable.addColumnjSQLTable.loadDatajSQLTable.insertRow
jSQLQuery.ifNotExistsjSQLQuery.ignorejSQLQuery.executejSQLQuery.fetchjSQLQuery.fetchAlljSQLQuery.valuesjSQLQuery.setjSQLQuery.wherejSQLQuery.fromjSQLQuery.limitjSQLQuery.orderByjSQLQuery.ascjSQLQuery.descjSQLQuery.distinct
jSQLWhereClause.wherejSQLWhereClause.equalsjSQLWhereClause.preparedLikejSQLWhereClause.doesNotEqualjSQLWhereClause.lessThanjSQLWhereClause.containsjSQLWhereClause.endsWithjSQLWhereClause.beginsWithjSQLWhereClause.andjSQLWhereClause.orjSQLWhereClause.limitjSQLWhereClause.orderByjSQLWhereClause.ascjSQLWhereClause.descjSQLWhereClause.execute