| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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.
var allSusans =
jSQL.select('*')
.from('Users')
.where('Name')
.equals('Susan')
.execute()
.fetchAll();
Filter results to ones where the filtered column matches the given value
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.
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
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
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.
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.
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.
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.
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.
var nameBeginsOrEndsWithB =
jSQL.select(['Name'])
.from('Users')
.where('Name')
.beginsWith('b')
.or('Name')
.endsWith('b')
.execute()
.fetchAll();
Limit the rows returned, deleted, or updated.
var first3Users =
jSQL.select('Name')
.from('Users')
.limit(3)
.execute()
.fetchAll();
Sort the result set. Only useful for "SELECT" queries.
var first3Users =
jSQL.select('Name')
.from('Users')
.limit(3)
.orderBy('Name')
.asc()
.execute()
.fetchAll();
Sort the result set ASCENDING. Only useful for "SELECT" queries.
var first3Users =
jSQL.select('*')
.from('Users')
.limit(3)
.orderBy('Name')
.asc()
.execute()
.fetchAll();
Sort the result set DESCENDING. Only useful for "SELECT" queries.
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.
var allUsers =
jSQL.select('*')
.from('Users')
.execute()
.fetchAll();
| Back | FazBrowse Home | New Git URL |