Package com.mysql.cj.xdevapi
Interface FilterParams
- All Known Implementing Classes:
AbstractFilterParams,DocFilterParams,TableFilterParams
public interface FilterParams
Transforms X DevAPI filter parameters into X Protocol message entities.
Used internally.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classFilterParams.RowLockThe type of row lock.static classFilterParams.RowLockOptionsOptions that define the behavior while retrieving locked rows. -
Method Summary
Modifier and Type Method Description voidaddArg(java.lang.String name, java.lang.Object value)Set binding.voidclearArgs()Remove all current bindings.java.lang.ObjectgetArgs()Get binding arguments.java.lang.ObjectgetCollection()Get X Protocol Collection object.java.lang.ObjectgetCriteria()Get the search criteria.java.lang.ObjectgetFields()Get X Protocol Projection objects.java.lang.ObjectgetGrouping()Get X Protocol Expr objects for groupBy.java.lang.ObjectgetGroupingCriteria()Get X Protocol Expr objects for grouping criteria.java.lang.LonggetLimit()Get max number of rows to filter.FilterParams.RowLockgetLock()GetFilterParams.RowLockvalue.FilterParams.RowLockOptionsgetLockOption()GetFilterParams.RowLockOptionsvalue.java.lang.LonggetOffset()Get number of rows to skip before finding others.java.lang.ObjectgetOrder()Get X Protocol Order objects.booleanisRelational()Are relational columns identifiers allowed?voidsetCriteria(java.lang.String criteriaString)Parse criteriaString into X Protocol Expr object.voidsetFields(java.lang.String... projection)Parse projection expressions into X Protocol Projection objects.voidsetGrouping(java.lang.String... groupBy)Parse groupBy expressions into X Protocol Expr objects.voidsetGroupingCriteria(java.lang.String having)Parse having expressions into X Protocol Expr objects.voidsetLimit(java.lang.Long limit)Set maximum rows to find.voidsetLock(FilterParams.RowLock rowLock)SetFilterParams.RowLockvalue.voidsetLockOption(FilterParams.RowLockOptions rowLockOption)SetFilterParams.RowLockOptionsvalue.voidsetOffset(java.lang.Long offset)Set number of rows to skip before finding others.voidsetOrder(java.lang.String... orderExpression)Parse order expressions into X Protocol Order objects.booleansupportsOffset()Whether offset clause is supported in the statement or not.voidverifyAllArgsBound()Verify that all arguments are bound.
-
Method Details
-
getCollection
java.lang.Object getCollection()Get X Protocol Collection object.- Returns:
- X Protocol Collection object
-
getOrder
java.lang.Object getOrder()Get X Protocol Order objects.- Returns:
- List of X Protocol Order objects
-
setOrder
void setOrder(java.lang.String... orderExpression)Parse order expressions into X Protocol Order objects.DocResult docs = this.collection.find().orderBy("$._id").execute(); docs = this.collection.find().sort("$.x", "$.y").execute();- Parameters:
orderExpression- order expressions
-
getLimit
java.lang.Long getLimit()Get max number of rows to filter.- Returns:
- limit
-
setLimit
void setLimit(java.lang.Long limit)Set maximum rows to find.For example, to find the 3 first rows:
docs = this.collection.find().orderBy("$._id").limit(3).execute();- Parameters:
limit- maximum rows to find
-
getOffset
java.lang.Long getOffset()Get number of rows to skip before finding others.- Returns:
- maximum rows to skip
-
setOffset
void setOffset(java.lang.Long offset)Set number of rows to skip before finding others.For example, to skip 1 row and find other 3 rows:
docs = this.collection.find().orderBy("$._id").limit(3).skip(1).execute();- Parameters:
offset- maximum rows to skip
-
supportsOffset
boolean supportsOffset()Whether offset clause is supported in the statement or not.Note that setting offset values is always possible, even if they are not supported.
- Returns:
trueif offset clause is supported
-
getCriteria
java.lang.Object getCriteria()Get the search criteria.- Returns:
- X Protocol Expr object
-
setCriteria
void setCriteria(java.lang.String criteriaString)Parse criteriaString into X Protocol Expr object.docs = this.collection.find("$.x1 = 29 | 15").execute(); table.delete().where("age == 13").execute();- Parameters:
criteriaString- expression
-
getArgs
java.lang.Object getArgs()Get binding arguments.- Returns:
- List of X Protocol Scalar object
-
addArg
void addArg(java.lang.String name, java.lang.Object value)Set binding.this.collection.find("a = :arg1 or b = :arg2").bind("arg1", 1).bind("arg2", 2).execute();- Parameters:
name- bind keyvalue- bind value
-
verifyAllArgsBound
void verifyAllArgsBound()Verify that all arguments are bound. ThrowsWrongArgumentExceptionif any placeholder argument is not bound. -
clearArgs
void clearArgs()Remove all current bindings. -
isRelational
boolean isRelational()Are relational columns identifiers allowed?- Returns:
- true if allowed
-
setFields
void setFields(java.lang.String... projection)Parse projection expressions into X Protocol Projection objects.collection.find().fields("CAST($.x as SIGNED) as x").execute(); table.select("_id, name, birthday, age").execute(); table.select("age as age_group, count(name) as cnt, something").execute();- Parameters:
projection- projection expression
-
getFields
java.lang.Object getFields()Get X Protocol Projection objects.- Returns:
- List of X Protocol Projection objects.
-
setGrouping
void setGrouping(java.lang.String... groupBy)Parse groupBy expressions into X Protocol Expr objects.SelectStatement stmt = table.select("age as age_group, count(name) as cnt, something"); stmt.groupBy("something", "age_group");- Parameters:
groupBy- groupBy expression
-
getGrouping
java.lang.Object getGrouping()Get X Protocol Expr objects for groupBy.- Returns:
- List of X Protocol Expr objects
-
setGroupingCriteria
void setGroupingCriteria(java.lang.String having)Parse having expressions into X Protocol Expr objects.SelectStatement stmt = table.select("age as age_group, count(name) as cnt, something"); stmt.groupBy("something", "age_group"); stmt.having("cnt > 1");- Parameters:
having- having expression
-
getGroupingCriteria
java.lang.Object getGroupingCriteria()Get X Protocol Expr objects for grouping criteria.- Returns:
- List of X Protocol Expr objects
-
getLock
FilterParams.RowLock getLock()GetFilterParams.RowLockvalue.- Returns:
FilterParams.RowLock
-
setLock
SetFilterParams.RowLockvalue.- Parameters:
rowLock-FilterParams.RowLock
-
getLockOption
FilterParams.RowLockOptions getLockOption()GetFilterParams.RowLockOptionsvalue.- Returns:
FilterParams.RowLockOptions
-
setLockOption
SetFilterParams.RowLockOptionsvalue.- Parameters:
rowLockOption-FilterParams.RowLockOptions
-