本文整理了Java中org.h2.command.dml.Query.getExpressions
方法的一些代码示例,展示了Query.getExpressions
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getExpressions
方法的具体详情如下:
包路径:org.h2.command.dml.Query
类名称:Query
方法名:getExpressions
[英]The the list of select expressions. This may include invisible expressions such as order by expressions.
[中]选择表达式的列表。这可能包括不可见的表达式,如按顺序表达式。
代码示例来源:origin: com.h2database/h2
private Expression getExpression() {
if (expression == null) {
ArrayList<Expression> expressions = query.getExpressions();
int columnCount = query.getColumnCount();
if (columnCount == 1) {
expression = expressions.get(0);
} else {
Expression[] list = new Expression[columnCount];
for (int i = 0; i < columnCount; i++) {
list[i] = expressions.get(i);
}
expression = new ExpressionList(list);
}
}
return expression;
}
代码示例来源:origin: com.h2database/h2
ArrayList<Expression> withExpressions = theQuery.getExpressions();
for (int i = 0; i < withExpressions.size(); ++i) {
Expression columnExp = withExpressions.get(i);
代码示例来源:origin: com.h2database/h2
@Override
public void init() {
if (SysProperties.CHECK && checkInit) {
DbException.throwInternalError();
}
checkInit = true;
left.init();
right.init();
int len = left.getColumnCount();
if (len != right.getColumnCount()) {
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
}
ArrayList<Expression> le = left.getExpressions();
// set the expressions to get the right column count and names,
// but can't validate at this time
expressions = New.arrayList();
for (int i = 0; i < len; i++) {
Expression l = le.get(i);
expressions.add(l);
}
}
代码示例来源:origin: com.h2database/h2
ArrayList<Expression> le = left.getExpressions();
ArrayList<Expression> re = right.getExpressions();
ColumnNamer columnNamer= new ColumnNamer(session);
for (int i = 0; i < len; i++) {
代码示例来源:origin: apache/ignite
/**
* @param qry Query.
* @param expCol Expression column.
* @param validate Query validation flag.
* @return {@code true} It it is an affinity column.
*/
private static boolean isAffinityColumn(Query qry, ExpressionColumn expCol, boolean validate) {
if (qry.isUnion()) {
SelectUnion union = (SelectUnion)qry;
return isAffinityColumn(union.getLeft(), expCol, validate) && isAffinityColumn(union.getRight(), expCol, validate);
}
Expression exp = qry.getExpressions().get(expCol.getColumn().getColumnId()).getNonAliasExpression();
if (exp instanceof ExpressionColumn) {
expCol = (ExpressionColumn)exp;
return isAffinityColumn(expCol.getTableFilter(), expCol, validate);
}
return false;
}
代码示例来源:origin: com.h2database/h2
private void generateColumnsFromQuery() {
int columnCount = asQuery.getColumnCount();
ArrayList<Expression> expressions = asQuery.getExpressions();
ColumnNamer columnNamer= new ColumnNamer(session);
for (int i = 0; i < columnCount; i++) {
代码示例来源:origin: com.h2database/h2
this.querySQL = compiledQuery.getPlanSQL();
tables = new ArrayList<>(compiledQuery.getTables());
ArrayList<Expression> expressions = compiledQuery.getExpressions();
ArrayList<Column> list = New.arrayList();
ColumnNamer columnNamer = new ColumnNamer(session);
代码示例来源:origin: com.h2database/com.springsource.org.h2
private Expression getExpression() {
return (Expression) query.getExpressions().get(0);
}
代码示例来源:origin: com.eventsourcing/h2
private Expression getExpression() {
if (expression == null) {
ArrayList<Expression> expressions = query.getExpressions();
int columnCount = query.getColumnCount();
if (columnCount == 1) {
expression = expressions.get(0);
} else {
Expression[] list = new Expression[columnCount];
for (int i = 0; i < columnCount; i++) {
list[i] = expressions.get(i);
}
expression = new ExpressionList(list);
}
}
return expression;
}
代码示例来源:origin: org.wowtools/h2
private Expression getExpression() {
if (expression == null) {
ArrayList<Expression> expressions = query.getExpressions();
int columnCount = query.getColumnCount();
if (columnCount == 1) {
expression = expressions.get(0);
} else {
Expression[] list = new Expression[columnCount];
for (int i = 0; i < columnCount; i++) {
list[i] = expressions.get(i);
}
expression = new ExpressionList(list);
}
}
return expression;
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
public LocalResult queryMeta() throws SQLException {
ObjectArray expressions = left.getExpressions();
int columnCount = left.getColumnCount();
LocalResult result = new LocalResult(session, expressions, columnCount);
result.done();
return result;
}
代码示例来源:origin: org.wowtools/h2
@Override
public void init() {
if (SysProperties.CHECK && checkInit) {
DbException.throwInternalError();
}
checkInit = true;
left.init();
right.init();
int len = left.getColumnCount();
if (len != right.getColumnCount()) {
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
}
ArrayList<Expression> le = left.getExpressions();
// set the expressions to get the right column count and names,
// but can't validate at this time
expressions = New.arrayList();
for (int i = 0; i < len; i++) {
Expression l = le.get(i);
expressions.add(l);
}
}
代码示例来源:origin: com.eventsourcing/h2
@Override
public void init() {
if (SysProperties.CHECK && checkInit) {
DbException.throwInternalError();
}
checkInit = true;
left.init();
right.init();
int len = left.getColumnCount();
if (len != right.getColumnCount()) {
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
}
ArrayList<Expression> le = left.getExpressions();
// set the expressions to get the right column count and names,
// but can't validate at this time
expressions = New.arrayList();
for (int i = 0; i < len; i++) {
Expression l = le.get(i);
expressions.add(l);
}
}
代码示例来源:origin: com.eventsourcing/h2
ArrayList<Expression> le = left.getExpressions();
ArrayList<Expression> re = right.getExpressions();
for (int i = 0; i < len; i++) {
Expression l = le.get(i);
代码示例来源:origin: org.apache.ignite/ignite-indexing
/**
* @param qry Query.
* @param expCol Expression column.
* @param validate Query validation flag.
* @return {@code true} It it is an affinity column.
*/
private static boolean isAffinityColumn(Query qry, ExpressionColumn expCol, boolean validate) {
if (qry.isUnion()) {
SelectUnion union = (SelectUnion)qry;
return isAffinityColumn(union.getLeft(), expCol, validate) && isAffinityColumn(union.getRight(), expCol, validate);
}
Expression exp = qry.getExpressions().get(expCol.getColumn().getColumnId()).getNonAliasExpression();
if (exp instanceof ExpressionColumn) {
expCol = (ExpressionColumn)exp;
return isAffinityColumn(expCol.getTableFilter(), expCol, validate);
}
return false;
}
代码示例来源:origin: org.wowtools/h2
private void generateColumnsFromQuery() {
int columnCount = asQuery.getColumnCount();
ArrayList<Expression> expressions = asQuery.getExpressions();
for (int i = 0; i < columnCount; i++) {
Expression expr = expressions.get(i);
int type = expr.getType();
String name = expr.getAlias();
long precision = expr.getPrecision();
int displaySize = expr.getDisplaySize();
DataType dt = DataType.getDataType(type);
if (precision > 0 && (dt.defaultPrecision == 0 ||
(dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
// dont' set precision to MAX_VALUE if this is the default
precision = dt.defaultPrecision;
}
int scale = expr.getScale();
if (scale > 0 && (dt.defaultScale == 0 ||
(dt.defaultScale > scale && dt.defaultScale < precision))) {
scale = dt.defaultScale;
}
if (scale > precision) {
precision = scale;
}
Column col = new Column(name, type, precision, scale, displaySize);
addColumn(col);
}
}
代码示例来源:origin: com.eventsourcing/h2
private void generateColumnsFromQuery() {
int columnCount = asQuery.getColumnCount();
ArrayList<Expression> expressions = asQuery.getExpressions();
for (int i = 0; i < columnCount; i++) {
Expression expr = expressions.get(i);
int type = expr.getType();
String name = expr.getAlias();
long precision = expr.getPrecision();
int displaySize = expr.getDisplaySize();
DataType dt = DataType.getDataType(type);
if (precision > 0 && (dt.defaultPrecision == 0 ||
(dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
// dont' set precision to MAX_VALUE if this is the default
precision = dt.defaultPrecision;
}
int scale = expr.getScale();
if (scale > 0 && (dt.defaultScale == 0 ||
(dt.defaultScale > scale && dt.defaultScale < precision))) {
scale = dt.defaultScale;
}
if (scale > precision) {
precision = scale;
}
Column col = new Column(name, type, precision, scale, displaySize);
addColumn(col);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
public void init() throws SQLException {
if (SysProperties.CHECK && checkInit) {
throw Message.getInternalError();
}
checkInit = true;
left.init();
right.init();
int len = left.getColumnCount();
if (len != right.getColumnCount()) {
throw Message.getSQLException(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
}
ObjectArray le = left.getExpressions();
// set the expressions to get the right column count and names,
// but can't validate at this time
expressions = new ObjectArray();
for (int i = 0; i < len; i++) {
Expression l = (Expression) le.get(i);
expressions.add(l);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
ObjectArray le = left.getExpressions();
ObjectArray re = right.getExpressions();
for (int i = 0; i < len; i++) {
Expression l = (Expression) le.get(i);
代码示例来源:origin: com.h2database/com.springsource.org.h2
private void generateColumnFromQuery() throws SQLException {
int columnCount = asQuery.getColumnCount();
ObjectArray expressions = asQuery.getExpressions();
for (int i = 0; i < columnCount; i++) {
Expression expr = (Expression) expressions.get(i);
int type = expr.getType();
String name = expr.getColumnName();
long precision = expr.getPrecision();
int displaySize = expr.getDisplaySize();
DataType dt = DataType.getDataType(type);
if (precision > 0 && (dt.defaultPrecision == 0 || (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
// dont' set precision to MAX_VALUE if this is the default
precision = dt.defaultPrecision;
}
int scale = expr.getScale();
if (scale > 0 && (dt.defaultScale == 0 || dt.defaultScale > scale)) {
scale = dt.defaultScale;
}
Column col = new Column(name, type, precision, scale, displaySize);
addColumn(col);
}
}
内容来源于网络,如有侵权,请联系作者删除!