Package com.mysql.cj.xdevapi
Class ExprParser
java.lang.Object
com.mysql.cj.xdevapi.ExprParser
public class ExprParser
extends java.lang.Object
Expression parser for X protocol.
-
Constructor Summary
Constructors Constructor Description ExprParser(java.lang.String s)
Constructor.ExprParser(java.lang.String s, boolean allowRelationalColumns)
Constructor. -
Method Summary
Modifier and Type Method Description MysqlxExpr.Expr
documentField()
Parse a document field.java.util.List<MysqlxExpr.DocumentPathItem>
documentPath()
Parse a JSON-style document path, like WL#7909, but prefix by @.java.util.Map<java.lang.String,java.lang.Integer>
getPlaceholderNameToPositionMap()
Get a mapping of parameter names to positions.int
getPositionalPlaceholderCount()
Return the number of positional placeholders in the expression.MysqlxExpr.Expr
parse()
Parse the entire string as an expression.java.util.List<MysqlxCrud.Projection>
parseDocumentProjection()
Parse a document projection which is similar to SELECT but with document paths as the target alias.java.util.List<MysqlxExpr.Expr>
parseExprList()
Parse a list of expressions used for GROUP BY.java.util.List<MysqlxCrud.Order>
parseOrderSpec()
Parse an ORDER BY specification which is a comma-separated list of expressions, each may be optionally suffixed by ASC/DESC.MysqlxCrud.Column
parseTableInsertField()
Parse an INSERT field name.java.util.List<MysqlxCrud.Projection>
parseTableSelectProjection()
Parse a SELECT projection which is a comma-separated list of expressions, each optionally suffixed with a target alias.MysqlxExpr.ColumnIdentifier
parseTableUpdateField()
Parse an UPDATE field which can include can document paths.
-
Constructor Details
-
ExprParser
public ExprParser(java.lang.String s)Constructor.- Parameters:
s
- expression string to parse
-
ExprParser
public ExprParser(java.lang.String s, boolean allowRelationalColumns)Constructor.- Parameters:
s
- expression string to parseallowRelationalColumns
- are relational columns identifiers allowed?
-
-
Method Details
-
documentPath
Parse a JSON-style document path, like WL#7909, but prefix by @. instead of $.- Returns:
- list of
MysqlxExpr.DocumentPathItem
objects
-
documentField
Parse a document field.- Returns:
MysqlxExpr.Expr
-
parse
Parse the entire string as an expression.- Returns:
- an X protocol expression tree
-
parseOrderSpec
Parse an ORDER BY specification which is a comma-separated list of expressions, each may be optionally suffixed by ASC/DESC.- Returns:
- list of
MysqlxCrud.Order
objects
-
parseTableSelectProjection
Parse a SELECT projection which is a comma-separated list of expressions, each optionally suffixed with a target alias.- Returns:
- list of
MysqlxCrud.Projection
objects
-
parseTableInsertField
Parse an INSERT field name.- Returns:
MysqlxCrud.Column
-
parseTableUpdateField
Parse an UPDATE field which can include can document paths.- Returns:
MysqlxExpr.ColumnIdentifier
-
parseDocumentProjection
Parse a document projection which is similar to SELECT but with document paths as the target alias.- Returns:
- list of
MysqlxCrud.Projection
objects
-
parseExprList
Parse a list of expressions used for GROUP BY.- Returns:
- list of
MysqlxExpr.Expr
objects
-
getPositionalPlaceholderCount
public int getPositionalPlaceholderCount()Return the number of positional placeholders in the expression.- Returns:
- the number of positional placeholders in the expression
-
getPlaceholderNameToPositionMap
public java.util.Map<java.lang.String,java.lang.Integer> getPlaceholderNameToPositionMap()Get a mapping of parameter names to positions.- Returns:
- a mapping of parameter names to positions.
-