本文整理汇总了Java中net.sf.jsqlparser.expression.Parenthesis类的典型用法代码示例。如果您正苦于以下问题:Java Parenthesis类的具体用法?Java Parenthesis怎么用?Java Parenthesis使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Parenthesis类属于net.sf.jsqlparser.expression包,在下文中一共展示了Parenthesis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis parenthesis) {
if (parenthesis.isNot()) {
buffer.append(NOT);
}
buffer.append("(");
parenthesis.getExpression().accept(this);
buffer.append(")");
}
示例2: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
public void visit(Parenthesis parenthesis) {
if (parenthesis.isNot()) {
buffer.append(parenthesis.getCommentNot() != null ? " " + parenthesis.getCommentNot() + ExpressionDeParser.LINE_SEPARATOR : "").append(" not ");
}
buffer.append(parenthesis.getCommentBeginBracket() != null ? parenthesis.getCommentBeginBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("(");
parenthesis.getExpression().accept(this);
buffer.append(parenthesis.getCommentEndBracket() != null ? parenthesis.getCommentEndBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(")");
}
示例3: getInstance
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
public static Projector getInstance(Expression expression, String alias, QueryTypeExtractor queryTypeExtractor) {
Projector instance = null;
if (expression instanceof net.sf.jsqlparser.schema.Column) {
instance = new ColumnProjector((net.sf.jsqlparser.schema.Column) expression, alias, queryTypeExtractor);
} else if (expression instanceof Function) {
instance = new FunctionProjector((Function) expression, alias, queryTypeExtractor);
} else if (expression instanceof BinaryExpression) {
instance = new BinaryExpressionProjector((BinaryExpression) expression, alias, queryTypeExtractor);
} else if (expression instanceof LongValue) {
instance = new LongProjector(expression, alias, queryTypeExtractor);
} else if (expression instanceof StringValue) {
instance = new StringProjector(expression, alias, queryTypeExtractor);
} else if (expression instanceof DoubleValue) {
instance = new DoubleProjector(expression, alias, queryTypeExtractor);
} else if (expression instanceof Parenthesis) {
instance = new ParenthesisProjector((Parenthesis) expression, queryTypeExtractor);
} else if (expression instanceof JdbcParameter) {
instance = new JdbcParameterProjector(queryTypeExtractor);
} else if (expression instanceof SubSelect) {
instance = new SubSelectProjector((SubSelect) expression, alias, queryTypeExtractor);
} else {
throw new RuntimeException("Not supported");
}
return instance;
}
示例4: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis parenthesis) {
parenthesis.getExpression().accept(this);
}
示例5: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis parenthesis) {
// TODO Auto-generated method stub
}
示例6: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis prnths) {
prnths.getExpression().accept(this);
}
示例7: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis arg0) {
log.debug("sql Parenthesis value expression = " + arg0.toString());
value = arg0.toString();
}
示例8: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
public void visit(Parenthesis parenthesis) {
parenthesis.getExpression().accept(this);
}
示例9: getObjectByPk
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
/**
* Loads an object by primary key. It also verifies that the object falls within the results of a given query.
* @param persistence the persistence object
* @param database the database (connection provider)
* @param entityName the name of the entity to load
* @param pk the primary key object
* @param hqlQueryString the query (where condition) that the object must fulfill
* @param rootObject the OGNL root object against which to evaluate the query string.
* @return the loaded object, or null if an object with that key does not exist or falls outside the query.
*/
public static Object getObjectByPk(
Persistence persistence, String database, String entityName,
Serializable pk, String hqlQueryString, Object rootObject) {
TableAccessor table = persistence.getTableAccessor(database, entityName);
List<Object> result;
PropertyAccessor[] keyProperties = table.getKeyProperties();
OgnlHqlFormat hqlFormat = OgnlHqlFormat.create(hqlQueryString);
String formatString = hqlFormat.getFormatString();
Object[] ognlParameters = hqlFormat.evaluateOgnlExpressions(rootObject);
int p = ognlParameters.length;
Object[] parameters = new Object[p + keyProperties.length];
System.arraycopy(ognlParameters, 0, parameters, 0, p);
try {
PlainSelect parsedQuery = parseQuery(new CCJSqlParserManager(), formatString);
if(parsedQuery.getWhere() == null) {
return getObjectByPk(persistence, database, entityName, pk);
}
Alias mainEntityAlias = getEntityAlias(entityName, parsedQuery);
net.sf.jsqlparser.schema.Table mainEntityTable;
if(mainEntityAlias != null) {
mainEntityTable = new net.sf.jsqlparser.schema.Table(null, mainEntityAlias.getName());
} else {
mainEntityTable = new net.sf.jsqlparser.schema.Table();
}
for(int i = 0; i < keyProperties.length; i++) {
PropertyAccessor propertyAccessor = keyProperties[i];
EqualsTo condition = new EqualsTo();
parsedQuery.setWhere(
new AndExpression(condition, new Parenthesis(parsedQuery.getWhere())));
net.sf.jsqlparser.schema.Column column =
new net.sf.jsqlparser.schema.Column(mainEntityTable, propertyAccessor.getName());
condition.setLeftExpression(column);
JdbcParameter jdbcParameter = new JdbcParameter();
jdbcParameter.setIndex(p + i + 1);
condition.setRightExpression(jdbcParameter);
parameters[p + i] = propertyAccessor.get(pk);
}
String fullQueryString = parsedQuery.toString();
if(fullQueryString.toLowerCase().startsWith(FAKE_SELECT_PREFIX)) {
fullQueryString = fullQueryString.substring(FAKE_SELECT_PREFIX.length());
}
Session session = persistence.getSession(database);
result = runHqlQuery(session, fullQueryString, parameters);
if(result != null && !result.isEmpty()) {
return result.get(0);
} else {
return null;
}
} catch (JSQLParserException e) {
throw new Error(e);
}
}
示例10: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis arg0) {
isSimple = false;
}
示例11: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
public void visit(Parenthesis parenthesis) {
parenthesis.getExpression().accept(this);
}
示例12: ParenthesisProjector
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
public ParenthesisProjector(Parenthesis parenthesis, QueryTypeExtractor projectionsExtractor) {
super(null, projectionsExtractor);
this.parenthesis = parenthesis;
}
示例13: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis parenthesis)
{
increaseOpenParenthesisCount();
parenthesis.getExpression().accept(this);
}
示例14: visit
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
@Override
public void visit(Parenthesis parenthesis)
{
throw new IllegalOperationException("Illegal SQL ON expression: " + parenthesis); //$NON-NLS-1$
}
示例15: getObjectByPk
import net.sf.jsqlparser.expression.Parenthesis; //导入依赖的package包/类
/**
* Loads an object by primary key. It also verifies that the object falls within the results of a given query.
*
* @param persistence the persistence object
* @param database the database (connection provider)
* @param entityName the name of the entity to load
* @param pk the primary key object
* @param hqlQueryString the query (where condition) that the object must fulfill
* @param rootObject the OGNL root object against which to evaluate the query string.
* @return the loaded object, or null if an object with that key does not exist or falls outside the query.
*/
public static Object getObjectByPk(Persistence persistence, String database, String entityName, Serializable pk,
String hqlQueryString, Object rootObject) {
TableAccessor table = persistence.getTableAccessor(database, entityName);
List<Object> result;
PropertyAccessor[] keyProperties = table.getKeyProperties();
OgnlSqlFormat sqlFormat = OgnlSqlFormat.create(hqlQueryString);
String formatString = sqlFormat.getFormatString();
Object[] ognlParameters = sqlFormat.evaluateOgnlExpressions(rootObject);
int i = keyProperties.length;
int p = ognlParameters.length;
Object[] parameters = new Object[p + i];
System.arraycopy(ognlParameters, 0, parameters, i, p);
try {
PlainSelect parsedQuery = parseQuery(new CCJSqlParserManager(), formatString);
if (parsedQuery.getWhere() == null) {
return getObjectByPk(persistence, database, entityName, pk);
}
String mainEntityAlias = getEntityAlias(entityName, parsedQuery);
net.sf.jsqlparser.schema.Table mainEntityTable;
if (mainEntityAlias != null) {
mainEntityTable = new net.sf.jsqlparser.schema.Table(null, mainEntityAlias);
} else {
mainEntityTable = new net.sf.jsqlparser.schema.Table();
}
for (PropertyAccessor propertyAccessor : keyProperties) {
i--;
EqualsTo condition = new EqualsTo();
parsedQuery.setWhere(new AndExpression(condition, new Parenthesis(parsedQuery.getWhere())));
net.sf.jsqlparser.schema.Column column = new net.sf.jsqlparser.schema.Column(mainEntityTable,
propertyAccessor.getName());
condition.setLeftExpression(column);
condition.setRightExpression(new JdbcParameter());
parameters[i] = propertyAccessor.get(pk);
}
String fullQueryString = parsedQuery.toString();
if (fullQueryString.toLowerCase().startsWith(FAKE_SELECT_PREFIX)) {
fullQueryString = fullQueryString.substring(FAKE_SELECT_PREFIX.length());
}
Session session = persistence.getSession(database);
result = runHqlQuery(session, fullQueryString, parameters);
if (result != null && !result.isEmpty()) {
return result.get(0);
} else {
return null;
}
} catch (JSQLParserException e) {
throw new Error(e);
}
}