本文整理汇总了Java中org.apache.calcite.avatica.NoSuchStatementException类的典型用法代码示例。如果您正苦于以下问题:Java NoSuchStatementException类的具体用法?Java NoSuchStatementException怎么用?Java NoSuchStatementException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoSuchStatementException类属于org.apache.calcite.avatica包,在下文中一共展示了NoSuchStatementException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: syncResults
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
public boolean syncResults(StatementHandle sh, QueryState state, long offset)
throws NoSuchStatementException {
try {
final Connection conn = getConnection(sh.connectionId);
final StatementInfo info = statementCache.getIfPresent(sh.id);
if (null == info) {
throw new NoSuchStatementException(sh);
}
final Statement statement = info.statement;
// Let the state recreate the necessary ResultSet on the Statement
info.setResultSet(state.invoke(conn, statement));
if (null != info.getResultSet()) {
// If it is non-null, try to advance to the requested offset.
return info.advanceResultSetToOffset(info.getResultSet(), offset);
}
// No results, nothing to do. Client can move on.
return false;
} catch (SQLException e) {
throw propagate(e);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:24,代码来源:JdbcMeta.java
示例2: fetch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
NoSuchStatementException, MissingResultsException {
LOG.trace("fetching {} offset:{} fetchMaxRowCount:{}", h, offset, fetchMaxRowCount);
try {
final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
if (null == statementInfo) {
// Statement might have expired, or never existed on this server.
throw new NoSuchStatementException(h);
}
if (!statementInfo.isResultSetInitialized()) {
// The Statement exists, but the results are missing. Need to call syncResults(...)
throw new MissingResultsException(h);
}
if (statementInfo.getResultSet() == null) {
return Frame.EMPTY;
} else {
return JdbcResultSet.frame(statementInfo, statementInfo.getResultSet(), offset,
fetchMaxRowCount, calendar, Optional.<Meta.Signature>absent());
}
} catch (SQLException e) {
throw propagate(e);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:25,代码来源:JdbcMeta.java
示例3: prepareAndExecuteBatch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h,
List<String> sqlCommands) throws NoSuchStatementException {
try {
// Get the statement
final StatementInfo info = statementCache.getIfPresent(h.id);
if (info == null) {
throw new NoSuchStatementException(h);
}
// addBatch() for each sql command
final Statement stmt = info.statement;
for (String sqlCommand : sqlCommands) {
stmt.addBatch(sqlCommand);
}
// Execute the batch and return the results
return new ExecuteBatchResult(AvaticaUtils.executeLargeBatch(stmt));
} catch (SQLException e) {
throw propagate(e);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:22,代码来源:JdbcMeta.java
示例4: executeBatchProtobuf
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public ExecuteBatchResult executeBatchProtobuf(StatementHandle h,
List<Requests.UpdateBatch> updateBatches) throws NoSuchStatementException {
try {
final StatementInfo info = statementCache.getIfPresent(h.id);
if (null == info) {
throw new NoSuchStatementException(h);
}
final PreparedStatement preparedStmt = (PreparedStatement) info.statement;
for (Requests.UpdateBatch update : updateBatches) {
int i = 1;
for (Common.TypedValue value : update.getParameterValuesList()) {
// Use the value and then increment
preparedStmt.setObject(i++, TypedValue.protoToJdbc(value, calendar));
}
preparedStmt.addBatch();
}
return new ExecuteBatchResult(AvaticaUtils.executeLargeBatch(preparedStmt));
} catch (SQLException e) {
throw propagate(e);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:23,代码来源:JdbcMeta.java
示例5: apply
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
public ExecuteResponse apply(ExecuteRequest request) {
try (final Context ignore = executeTimer.start()) {
try {
final Meta.ExecuteResult executeResult = meta.execute(request.statementHandle,
request.parameterValues, AvaticaUtils.toSaturatedInt(request.maxRowCount));
final List<ResultSetResponse> results = new ArrayList<>(executeResult.resultSets.size());
for (Meta.MetaResultSet metaResultSet : executeResult.resultSets) {
results.add(toResponse(metaResultSet));
}
return new ExecuteResponse(results, false, serverLevelRpcMetadata);
} catch (NoSuchStatementException e) {
return new ExecuteResponse(null, true, serverLevelRpcMetadata);
}
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:17,代码来源:LocalService.java
示例6: syncResults
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public boolean syncResults(final StatementHandle h, final QueryState state,
final long offset) throws NoSuchStatementException {
try {
return connection.invokeWithRetries(
new CallableWithoutException<Boolean>() {
public Boolean call() {
final Service.SyncResultsResponse response =
service.apply(
new Service.SyncResultsRequest(h.connectionId, h.id, state, offset));
if (response.missingStatement) {
throw new RuntimeException(new NoSuchStatementException(h));
}
return response.moreResults;
}
});
} catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof NoSuchStatementException) {
throw (NoSuchStatementException) cause;
}
throw e;
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:24,代码来源:RemoteMeta.java
示例7: prepareAndExecute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override
public ExecuteResult prepareAndExecute(StatementHandle statementHandle, String sql,
long maxRowCount,
int maxRowsInFirstFrame,
PrepareCallback prepareCallback)
throws NoSuchStatementException {
try {
MetaResultSet metaResultSet;
synchronized (prepareCallback.getMonitor()) {
prepareCallback.clear();
ParserResult result = getConnection().parse(sql);
metaResultSet = new PlanExecutor(statementHandle, getConnection(),
connectionCache, maxRowCount).execute(result);
prepareCallback.assign(metaResultSet.signature, metaResultSet.firstFrame,
metaResultSet.updateCount);
}
prepareCallback.execute();
return new ExecuteResult(ImmutableList.of(metaResultSet));
} catch (Exception e) {
throw propagate(e);
}
}
开发者ID:qubole,项目名称:quark,代码行数:24,代码来源:QuarkMetaImpl.java
示例8: prepare
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public StatementHandle prepare(ConnectionHandle ch, String sql,
long maxRowCount) {
final StatementHandle h = createStatement(ch);
final CalciteConnectionImpl calciteConnection = getConnection();
final CalciteServerStatement statement;
try {
statement = calciteConnection.server.getStatement(h);
} catch (NoSuchStatementException e) {
// Not possible. We just created a statement.
throw new AssertionError("missing statement", e);
}
final Context context = statement.createPrepareContext();
final CalcitePrepare.Query<Object> query = toQuery(context, sql);
h.signature = calciteConnection.parseQuery(query, context, maxRowCount);
statement.setSignature(h.signature);
return h;
}
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:CalciteMetaImpl.java
示例9: fetch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public Frame fetch(StatementHandle h, long offset,
int fetchMaxRowCount) throws NoSuchStatementException {
final CalciteConnectionImpl calciteConnection = getConnection();
CalciteServerStatement stmt = calciteConnection.server.getStatement(h);
final Signature signature = stmt.getSignature();
final Iterator<Object> iterator;
if (stmt.getResultSet() == null) {
final Iterable<Object> iterable =
_createIterable(h, signature, null, null);
iterator = iterable.iterator();
stmt.setResultSet(iterator);
} else {
iterator = stmt.getResultSet();
}
final List rows =
MetaImpl.collect(signature.cursorFactory,
LimitIterator.of(iterator, fetchMaxRowCount),
new ArrayList<List<Object>>());
boolean done = fetchMaxRowCount == 0 || rows.size() < fetchMaxRowCount;
@SuppressWarnings("unchecked") List<Object> rows1 = (List<Object>) rows;
return new Meta.Frame(offset, done, rows1);
}
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:CalciteMetaImpl.java
示例10: execute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public ExecuteResult execute(StatementHandle h,
List<TypedValue> parameterValues, int maxRowsInFirstFrame)
throws NoSuchStatementException {
final CalciteConnectionImpl calciteConnection = getConnection();
CalciteServerStatement stmt = calciteConnection.server.getStatement(h);
final Signature signature = stmt.getSignature();
MetaResultSet metaResultSet;
if (signature.statementType.canUpdate()) {
final Iterable<Object> iterable =
_createIterable(h, signature, parameterValues, null);
final Iterator<Object> iterator = iterable.iterator();
stmt.setResultSet(iterator);
metaResultSet = MetaResultSet.count(h.connectionId, h.id,
((Number) iterator.next()).intValue());
} else {
// Don't populate the first frame.
// It's not worth saving a round-trip, since we're local.
final Meta.Frame frame =
new Meta.Frame(0, false, Collections.emptyList());
metaResultSet =
MetaResultSet.create(h.connectionId, h.id, false, signature, frame);
}
return new ExecuteResult(ImmutableList.of(metaResultSet));
}
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:CalciteMetaImpl.java
示例11: prepareAndExecute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount,
int maxRowsInFirstFrame, PrepareCallback callback) throws NoSuchStatementException {
try {
final StatementInfo info = getStatementCache().getIfPresent(h.id);
if (info == null) {
throw new NoSuchStatementException(h);
}
final Statement statement = info.statement;
// Make sure that we limit the number of rows for the query
setMaxRows(statement, maxRowCount);
boolean ret = statement.execute(sql);
info.setResultSet(statement.getResultSet());
// Either execute(sql) returned true or the resultSet was null
assert ret || null == info.getResultSet();
final List<MetaResultSet> resultSets = new ArrayList<>();
if (null == info.getResultSet()) {
// Create a special result set that just carries update count
resultSets.add(
JdbcResultSet.count(h.connectionId, h.id,
AvaticaUtils.getLargeUpdateCount(statement)));
} else {
resultSets.add(
JdbcResultSet.create(h.connectionId, h.id, info.getResultSet(), maxRowsInFirstFrame));
}
LOG.trace("prepAndExec statement {}", h);
// TODO: review client to ensure statementId is updated when appropriate
return new ExecuteResult(resultSets);
} catch (SQLException e) {
throw propagate(e);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:32,代码来源:JdbcMeta.java
示例12: prepareAndExecute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount,
PrepareCallback callback) throws NoSuchStatementException {
// The old semantics were that maxRowCount was also treated as the maximum number of
// elements in the first Frame of results. A value of -1 would also preserve this, but an
// explicit (positive) number is easier to follow, IMO.
return prepareAndExecute(h, sql, maxRowCount, AvaticaUtils.toSaturatedInt(maxRowCount),
callback);
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:10,代码来源:RemoteMeta.java
示例13: fetch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public Frame fetch(final StatementHandle h, final long offset,
final int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
try {
return connection.invokeWithRetries(
new CallableWithoutException<Frame>() {
public Frame call() {
final Service.FetchResponse response =
service.apply(
new Service.FetchRequest(h.connectionId, h.id, offset, fetchMaxRowCount));
if (response.missingStatement) {
throw new RuntimeException(new NoSuchStatementException(h));
}
if (response.missingResults) {
throw new RuntimeException(new MissingResultsException(h));
}
return response.frame;
}
});
} catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof NoSuchStatementException) {
throw (NoSuchStatementException) cause;
} else if (cause instanceof MissingResultsException) {
throw (MissingResultsException) cause;
}
throw e;
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:29,代码来源:RemoteMeta.java
示例14: execute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public ExecuteResult execute(final StatementHandle h,
final List<TypedValue> parameterValues, final int maxRowsInFirstFrame)
throws NoSuchStatementException {
try {
return connection.invokeWithRetries(
new CallableWithoutException<ExecuteResult>() {
public ExecuteResult call() {
final Service.ExecuteResponse response = service.apply(
new Service.ExecuteRequest(h, parameterValues, maxRowsInFirstFrame));
if (response.missingStatement) {
throw new RuntimeException(new NoSuchStatementException(h));
}
List<MetaResultSet> metaResultSets = new ArrayList<>();
for (Service.ResultSetResponse result : response.results) {
metaResultSets.add(toResultSet(null, result));
}
return new ExecuteResult(metaResultSets);
}
});
} catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof NoSuchStatementException) {
throw (NoSuchStatementException) cause;
}
throw e;
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:31,代码来源:RemoteMeta.java
示例15: prepareAndExecuteBatch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public ExecuteBatchResult prepareAndExecuteBatch(final StatementHandle h,
final List<String> sqlCommands) throws NoSuchStatementException {
return connection.invokeWithRetries(new CallableWithoutException<ExecuteBatchResult>() {
@Override public ExecuteBatchResult call() {
Service.ExecuteBatchResponse response =
service.apply(
new Service.PrepareAndExecuteBatchRequest(h.connectionId, h.id, sqlCommands));
return new ExecuteBatchResult(response.updateCounts);
}
});
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:12,代码来源:RemoteMeta.java
示例16: executeBatch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override public ExecuteBatchResult executeBatch(final StatementHandle h,
final List<List<TypedValue>> parameterValues) throws NoSuchStatementException {
return connection.invokeWithRetries(new CallableWithoutException<ExecuteBatchResult>() {
@Override public ExecuteBatchResult call() {
Service.ExecuteBatchResponse response =
service.apply(new Service.ExecuteBatchRequest(h.connectionId, h.id, parameterValues));
return new ExecuteBatchResult(response.updateCounts);
}
});
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:11,代码来源:RemoteMeta.java
示例17: prepareAndExecuteInternal
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override
protected ExecuteResult prepareAndExecuteInternal(AvaticaStatement statement, String sql, long maxRowCount)
throws SQLException, NoSuchStatementException {
try {
return super.prepareAndExecuteInternal(statement, sql, maxRowCount);
} catch(RuntimeException e) {
Throwables.propagateIfInstanceOf(e.getCause(), SQLException.class);
throw e;
}
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:DremioConnectionImpl.java
示例18: execute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override
public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues, int maxRowsInFirstFrame)
throws NoSuchStatementException {
// Signature might have been zeroed by AvaticaConnection#executeQueryInternal()
// Get it from the original handle
final AvaticaStatement stmt;
try {
stmt = connection.lookupStatement(h);
} catch(SQLException e) {
throw new NoSuchStatementException(h);
}
MetaResultSet metaResultSet =
MetaResultSet.create(h.connectionId, h.id, false, stmt.handle.signature, null);
return new ExecuteResult(ImmutableList.of(metaResultSet));
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:DremioMetaImpl.java
示例19: executeBatch
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override
public ExecuteBatchResult executeBatch(StatementHandle h, List<List<TypedValue>> parameterValueLists)
throws NoSuchStatementException {
final List<Long> updateCounts = new ArrayList<>();
for (List<TypedValue> parameterValueList : parameterValueLists) {
ExecuteResult executeResult = execute(h, parameterValueList, -1);
final long updateCount =
executeResult.resultSets.size() == 1
? executeResult.resultSets.get(0).updateCount
: -1L;
updateCounts.add(updateCount);
}
return new ExecuteBatchResult(Longs.toArray(updateCounts));
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:15,代码来源:DremioMetaImpl.java
示例20: execute
import org.apache.calcite.avatica.NoSuchStatementException; //导入依赖的package包/类
@Override
public ExecuteResult execute(StatementHandle statementHandle,
List<TypedValue> list,
int i)
throws NoSuchStatementException {
return null;
}
开发者ID:qubole,项目名称:quark,代码行数:8,代码来源:QuarkMetaImpl.java
注:本文中的org.apache.calcite.avatica.NoSuchStatementException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论