QueryBuilder class
Constructors
QueryBuilder (ConnectionInterface connection , QueryGrammar grammar , Processor processor )
Create a new query builder instance.
Properties
aggregateProp
↔ Map <String , dynamic > ?
An aggregate function and column to be run.
getter/setter pair
backups
↔ List
The field backups currently in use.
getter/setter pair
bindingBackups
↔ List
The binding backups currently in use.
getter/setter pair
bindings
↔ Map <String , dynamic >
The current query value bindings.
getter/setter pair
columnsProp
↔ List ?
The columns that should be returned.
Propriedade da class QueryBuilder que armazena as colunas da tabela a serem retornadas
@var array
getter/setter pair
connection
↔ ConnectionInterface
The database connection instance.
getter/setter pair
distinctProp
↔ bool
Indicates if the query returns distinct results.
getter/setter pair
fromProp
↔ dynamic
The table which the query is targeting.
getter/setter pair
grammar
↔ QueryGrammar
The database query grammar instance.
getter/setter pair
groupsProp
↔ List
The groupings for the query.
getter/setter pair
hashCode
→ int
The hash code for this object.
no setter inherited
havingsProp
↔ List <Map <String , dynamic > >
The having constraints for the query.
getter/setter pair
joinsProp
↔ List <JoinClause >
The table joins for the query.
getter/setter pair
limitProp
↔ int ?
The maximum number of records to return.
getter/setter pair
lockProp
↔ dynamic
Indicates whether row locking is being used.
getter/setter pair
offsetProp
↔ int ?
The number of records to skip.
getter/setter pair
ordersProp
↔ List <Map <String , dynamic > >
The orderings for the query.
getter/setter pair
processor
↔ Processor
The database query post processor instance.
getter/setter pair
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
unionLimit
↔ int ?
The maximum number of union records to return.
getter/setter pair
unionOffset
↔ int ?
The number of union records to skip.
getter/setter pair
unionOrdersProp
↔ List <Map <String , dynamic > >
The orderings for the union query.
getter/setter pair
unionsProp
↔ List <Map <String , dynamic > >
The query union statements.
getter/setter pair
useWritePdoProp
↔ bool
Whether use write pdo for select.
getter/setter pair
wheresProp
↔ List <Map <String , dynamic > >
The where constraints for the query.
getter/setter pair
Methods
addBinding (dynamic value , [String type = 'where' ])
→ QueryBuilder
Add a binding to the query.
addDateBasedWhere (String type , String column , String ? operator , int value , [String boolean = 'and' ])
→ QueryBuilder
Add a date based (year, month, day) statement to the query.
addNestedWhereQuery (QueryBuilder query , [dynamic boolean = 'and' ])
→ QueryBuilder
Add another query builder as a nested where to the query builder.
addSelect (dynamic columnP )
→ QueryBuilder
Add a new select column to the query.
aggregate (String function , [List <String > columnsP = const <String>['*'] ])
→ Future
Retrieve the minimum value of a given column.
cleanBindings (List bindings )
→ List
Remove all of the expressions from a list of bindings.
count ([dynamic columns = '*' ])
→ Future <int >
Retrieve the "count" result of the query.
createSub (dynamic query )
→ List
Creates a subquery and parse it.
delete ([dynamic id , Duration ? timeout = Connection.defaultTimeout ])
→ Future <int >
Increment a column's value by a given amount.
distinct ()
→ QueryBuilder
Force the query to only return distinct results.
exists ()
→ dynamic
Concatenate values of a given column as a string.
find (int id , [List <String > columns = const ['*'] ])
→ dynamic
Execute a query for a single record by ID.
first ([List <String > columns = const ['*'] , int ? timeoutInSeconds ])
→ Future <Map <String , dynamic > ? >
Execute the query and get the first result.
forNestedWhere ()
→ QueryBuilder
Create a new query instance for nested where condition.
forPage (int page , [int perPage = 15 ])
→ QueryBuilder
Set the limit and offset for a given page.
forSubQuery ()
→ QueryBuilder
Create a new query instance for a sub-query.
from (String tableP )
→ QueryBuilder
Set the table which the query is targeting.
fromRaw (String expression , [List ? $bindings = const [] ])
→ QueryBuilder
Add a raw from clause to the query.
get ([List <String > columnsP = const ['*'] , int ? timeoutInSeconds ])
→ Future <List <Map <String , dynamic > > >
Execute the query as a "select" statement.
getBindings ()
→ List
Get the current query value bindings in a flattened array.
getColumns ()
→ List ?
getConnection ()
→ ConnectionInterface
Get the database connection instance.
getGrammar ()
→ QueryGrammar
Get the query grammar instance.
getProcessor ()
→ Processor
Get the database query processor instance.
getProperty (String propertyName )
→ dynamic
Isaque
Eu adicionei este metodo para mapear uma String para uma propriedade/atributo da Class QueryBuilder
isso permite ler a propriedade/atributo da Class QueryBuilder com base no nome da propriedade
getRawBindings ()
→ dynamic
Get the raw array of bindings.
groupBy (dynamic column )
→ QueryBuilder
Handles dynamic "where" clauses to the query.
having (String column , [String ? operator , dynamic value , String boolean = 'and' ])
→ QueryBuilder
Add a "having" clause to the query.
insert (Map <String , dynamic > values , [Duration ? timeout ])
→ Future
Insert a new record into the database.
insertGetId (Map <String , dynamic > keyValues , [String sequence = 'id' ])
→ Future
Insert a new record and get the value of the primary key.
invalidOperatorAndValue (String operator , dynamic value )
→ bool
Determine if the given operator and value combination is legal.
join (dynamic table , dynamic one , [String ? operator , dynamic two = null , String type = 'inner' , bool where = false ])
→ QueryBuilder
Add a join clause to the query.
joinSub (dynamic query , dynamic alias , dynamic first , [String ? operator , dynamic second , dynamic type = 'inner' , dynamic where = false ])
→ QueryBuilder
Add a subquery join clause to the query.
joinWhere (String table , dynamic one , dynamic operator , dynamic two , [dynamic type = 'inner' ])
→ QueryBuilder
Add a "join where" clause to the query.
latest ([String column = 'created_at' ])
→ QueryBuilder
Add an "order by" clause for a timestamp to the query.
leftJoin (String table , dynamic first , [String ? operator , dynamic second ])
→ QueryBuilder
Add a left join to the query.
leftJoinWhere (String table , dynamic one , String operator , dynamic two )
→ QueryBuilder
Add a "join where" clause to the query.
limit (int value )
→ QueryBuilder
Set the "limit" value of the query.
lock ([dynamic value = true ])
→ QueryBuilder
Lock the selected rows in the table.
lockForUpdate ()
→ QueryBuilder
Lock the selected rows in the table for updating.
mergeBindings (QueryBuilder query )
→ QueryBuilder
Merge an array of bindings into our bindings.
mergeWheres (List <Map <String , dynamic > > wheresP , dynamic bindingsP )
→ dynamic
Merge an array of where clauses and bindings.
newQuery ()
→ QueryBuilder
Get a new instance of the query builder.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset (int value )
→ QueryBuilder
Set the "offset" value of the query.
oldest ([String column = 'created_at' ])
→ QueryBuilder
Add an "order by" clause for a timestamp to the query.
orderBy (String column , [String direction = 'asc' ])
→ QueryBuilder
Add a raw having clause to the query.
orderByRaw (String sql , [dynamic bindings = const [] ])
→ QueryBuilder
Add a raw "order by" clause to the query.
orHaving (String column , [String ? operator , dynamic value ])
→ QueryBuilder
Add a "or having" clause to the query.
orWhere (dynamic column , [String ? operator , dynamic value ])
→ QueryBuilder
Add an "or where" clause to the query.
column
String|Map|Function
@param String $operator
@param mixed $value
@return \Illuminate\Database\Query\Builder|static
orWhereBetween (String column , List values )
→ QueryBuilder
Add an or where between statement to the query.
orWhereExists (Function callback , [bool not = false ])
→ QueryBuilder
Add an or exists clause to the query.
orWhereIn (String column , dynamic values )
→ QueryBuilder
Add an "or where in" clause to the query.
orWhereNotBetween (String column , List values )
→ QueryBuilder
Add an or where not between statement to the query.
orWhereNotExists (Function callback )
→ QueryBuilder
Add a where not exists clause to the query.
orWhereNotIn (dynamic $column , dynamic $values )
→ QueryBuilder
Add an "or where not in" clause to the query.
orWhereNotNull (String column )
→ QueryBuilder
Add an "or where not null" clause to the query.
orWhereNull (String column )
→ QueryBuilder
Add an "or where null" clause to the query.
orWhereRaw (String sql , [List bindings = const [] ])
→ QueryBuilder
Add a raw or where clause to the query.
parseSub (dynamic query )
→ List
Parse the subquery into SQL and bindings.
pluck (String column , [String ? key ])
→ dynamic
Paginate the given query into a simple paginator.
raw (dynamic value )
→ QueryExpression
Create a raw database expression.
rightJoin (String table , dynamic first , String operator , [dynamic second ])
→ QueryBuilder
Add a right join to the query.
rightJoinWhere (String table , dynamic one , String operator , dynamic two )
→ QueryBuilder
Add a "right join where" clause to the query.
runSelect ([int ? timeoutInSeconds ])
→ Future <List <Map <String , dynamic > > >
Run the query as a "select" statement against the connection.
select ([List <String > columnsP = const ['*'] ])
→ QueryBuilder
Set the columns to be selected.
selectRaw (String expression , [List ? bindingsP = const [] ])
→ QueryBuilder
Add a new "raw" select expression to the query.
selectSub (dynamic query , String alias )
→ QueryBuilder
Add a subselect expression to the query.
setBindings (dynamic bindings , [dynamic type = 'where' ])
→ dynamic
Set the bindings on the query builder.
setColumns (List ? cols )
→ void
sharedLock ()
→ QueryBuilder
Share lock the selected rows in the table.
skip (int value )
→ QueryBuilder
Alias to set the "offset" value of the query.
stripeTableForPluck (dynamic column )
→ dynamic
Alias for the "pluck" method.
take (int value )
→ QueryBuilder
Alias to set the "limit" value of the query.
toSql ()
→ String
Get the SQL representation of the query.
toString ()
→ String
A string representation of this object.
inherited
truncate ()
→ void
Run a truncate statement on the table.
union (dynamic queryP , [bool all = false ])
→ QueryBuilder
Add a union statement to the query.
unionAll (dynamic $query )
→ dynamic
Add a union all statement to the query.
update (Map <String , dynamic > keyValues , [Duration ? timeout = Connection.defaultTimeout ])
→ Future
Update a record in the database.
useWritePdo ()
→ QueryBuilder
Use the write pdo for query.
value (String column )
→ Future
Get a single column's value from the first result of a query.
where (dynamic column , [String ? operator , dynamic value , String boolean = 'and' ])
→ QueryBuilder
Add a basic where clause to the query.
whereBetween (String column , [List ? values , String boolean = 'and' , bool not = false ])
→ QueryBuilder
Add a where between statement to the query.
whereDate (String column , String ? operator , int value , [String boolean = 'and' ])
→ QueryBuilder
Add a "where date" statement to the query.
whereDay (String column , String operator , int value , [String boolean = 'and' ])
→ QueryBuilder
Add a "where day" statement to the query.
whereExists (Function callback , [String boolean = 'and' , dynamic not = false ])
→ QueryBuilder
Add an exists clause to the query.
whereIn (String column , dynamic values , [String boolean = 'and' , bool not = false ])
→ QueryBuilder
Add a "where in" clause to the query.
whereInExistingQuery (String column , QueryBuilder query , String boolean , bool not )
→ QueryBuilder
Add a external sub-select to the query.
whereInSub (String column , Function callback , String boolean , bool not )
→ QueryBuilder
Add a where in with a sub-select to the query.
whereMonth (String column , String operator , int value , [String boolean = 'and' ])
→ QueryBuilder
Add a "where month" statement to the query.
whereNested (Function callback , [String boolean = 'and' ])
→ QueryBuilder
Add a nested where statement to the query.
whereNotBetween (dynamic column , List values , [dynamic boolean = 'and' ])
→ QueryBuilder
Add a where not between statement to the query.
whereNotExists (Function callback , [String boolean = 'and' ])
→ QueryBuilder
Add a where not exists clause to the query.
whereNotIn (String column , dynamic values , [dynamic boolean = 'and' ])
→ QueryBuilder
Add a "where not in" clause to the query.
whereNotNull (String column , [String boolean = 'and' ])
→ QueryBuilder
Add a "where not null" clause to the query.
whereNull (String column , [String boolean = 'and' , bool not = false ])
→ QueryBuilder
Add a "where null" clause to the query.
whereRaw (String sql , [List bindings = const [] , dynamic boolean = 'and' ])
→ QueryBuilder
Add a raw where clause to the query.
whereSub (String column , String ? operator , Function callback , String boolean )
→ QueryBuilder
Add a full sub-select to the query.
whereYear (String column , String operator , int value , [String boolean = 'and' ])
→ QueryBuilder
Add a "where year" statement to the query.