@Override @Deprecated public ExecuteResult execute(StatementHandle sh, List<TypedValue> parameterValues, long maxRowCount) throws NoSuchStatementException { final MetaResultSet metaResultSet = MetaResultSet.create(sh.connectionId, sh.id, false, sh.signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); }
@Override public ExecuteResult execute( final StatementHandle statement, final List<TypedValue> parameterValues, final int maxRowsInFirstFrame ) throws NoSuchStatementException { Preconditions.checkArgument(parameterValues.isEmpty(), "Expected parameterValues to be empty"); final DruidStatement druidStatement = getDruidStatement(statement); final Signature signature = druidStatement.getSignature(); final Frame firstFrame = druidStatement.execute() .nextFrame( DruidStatement.START_OFFSET, getEffectiveMaxRowsPerFrame(maxRowsInFirstFrame) ); return new ExecuteResult( ImmutableList.of( MetaResultSet.create( statement.connectionId, statement.id, false, signature, firstFrame ) ) ); }
@Override public ExecuteResult execute(StatementHandle sh, List<TypedValue> parameterValues, int maxRowsInFirstFrame) throws NoSuchStatementException { final MetaResultSet metaResultSet = MetaResultSet.create(sh.connectionId, sh.id, false, sh.signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); }
@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)); }
@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)); }
@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); } }
@Override public ExecuteResult execute( final StatementHandle statement, final List<TypedValue> parameterValues, final int maxRowsInFirstFrame ) throws NoSuchStatementException { Preconditions.checkArgument(parameterValues.isEmpty(), "Expected parameterValues to be empty"); final DruidStatement druidStatement = getDruidStatement(statement); final Signature signature = druidStatement.getSignature(); final Frame firstFrame = druidStatement.execute() .nextFrame( DruidStatement.START_OFFSET, getEffectiveMaxRowsPerFrame(maxRowsInFirstFrame) ); return new ExecuteResult( ImmutableList.of( MetaResultSet.create( statement.connectionId, statement.id, false, signature, firstFrame ) ) ); }
public Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, Meta.PrepareCallback callback) { try { MetaResultSet metaResultSet = null; synchronized (callback.getMonitor()) { callback.clear(); ParserResult result = getConnection().parse(sql); metaResultSet = new PlanExecutor(h, getConnection(), connectionCache, maxRowCount).execute(result); callback.assign(metaResultSet.signature, metaResultSet.firstFrame, metaResultSet.updateCount); } callback.execute(); return new ExecuteResult(ImmutableList.of(metaResultSet)); } catch (Exception e) { throw propagate(e); } }
@Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount, int maxRowsInFirstFrame, PrepareCallback callback) { final Signature signature = newSignature(sql); try { synchronized (callback.getMonitor()) { callback.clear(); callback.assign(signature, null, -1); } callback.execute(); final MetaResultSet metaResultSet = MetaResultSet.create(h.connectionId, h.id, false, signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); } catch(SQLException e) { throw new RuntimeException(e); } }
@Override @SuppressWarnings("deprecation") public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount, PrepareCallback callback) { final Signature signature = newSignature(sql); try { synchronized (callback.getMonitor()) { callback.clear(); callback.assign(signature, null, -1); } callback.execute(); final MetaResultSet metaResultSet = MetaResultSet.create(h.connectionId, h.id, false, signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); } catch(SQLException e) { throw new RuntimeException(e); } }
@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)); }
public ExecuteResult call() { final Service.ExecuteResponse response = service.apply( new Service.ExecuteRequest(h, parameterValues, maxRowCount)); 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); } });
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); } });
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); } });
@Override @SuppressWarnings("deprecation") public ExecuteResult execute(StatementHandle statementHandle, List<TypedValue> list, long l) throws NoSuchStatementException { return new ExecuteResult(Collections.singletonList( MetaResultSet.create(statementHandle.connectionId, statementHandle.id, true, statementHandle.signature, null))); }
@Override @SuppressWarnings("deprecation") public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount, PrepareCallback callback) { final Signature signature = newSignature(sql); try { synchronized (callback.getMonitor()) { callback.clear(); callback.assign(signature, null, -1); } callback.execute(); final MetaResultSet metaResultSet = MetaResultSet.create(h.connectionId, h.id, false, signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); } catch(SQLException e) { throw new RuntimeException(e); } }
); return new ExecuteResult( ImmutableList.of( MetaResultSet.create(
@Override @Deprecated public ExecuteResult prepareAndExecute(StatementHandle sh, String sql, long maxRowCount, PrepareCallback callback) { try { synchronized (callback.getMonitor()) { callback.clear(); sh.signature = connection().mockPreparedSignature(sql); callback.assign(sh.signature, null, -1); } callback.execute(); final MetaResultSet metaResultSet = MetaResultSet.create(sh.connectionId, sh.id, false, sh.signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); } catch (SQLException e) { throw new RuntimeException(e); } }
@Override public ExecuteResult prepareAndExecute(StatementHandle sh, String sql, long maxRowCount, int maxRowsInFirstFrame, PrepareCallback callback) throws NoSuchStatementException { try { synchronized (callback.getMonitor()) { callback.clear(); sh.signature = connection().mockPreparedSignature(sql); callback.assign(sh.signature, null, -1); } callback.execute(); final MetaResultSet metaResultSet = MetaResultSet.create(sh.connectionId, sh.id, false, sh.signature, null); return new ExecuteResult(Collections.singletonList(metaResultSet)); } catch (SQLException e) { throw new RuntimeException(e); } }
@Override @SuppressWarnings("deprecation") public ExecuteResult execute(StatementHandle statementHandle, List<TypedValue> list, long l) throws NoSuchStatementException { return new ExecuteResult(Collections.singletonList( MetaResultSet.create(statementHandle.connectionId, statementHandle.id, true, statementHandle.signature, null))); }