@Override public Iterable<Value> values() { return values( ofValue() ); }
@Override public List<Pair<String, Value>> fields() { return Extract.fields( this, ofValue() ); }
public static Function<Record, Value> column( String key ) { return column( key, Values.ofValue() ); }
public static Function<Record,Value> column( int index ) { return column( index, Values.ofValue() ); }
@Override public String toString() { return format( "Record<%s>", formatPairs( asMap( ofValue() ) ) ); }
@Override public String toString() { return formatPairs( asMap( ofValue() ) ); }
private static CompletionStage<InternalStatementResultCursor> runStatement( Connection connection, Statement statement, ExplicitTransaction tx, boolean waitForRunResponse ) { String query = statement.text(); Map<String,Value> params = statement.parameters().asMap( ofValue() ); CompletableFuture<Void> runCompletedFuture = new CompletableFuture<>(); RunResponseHandler runHandler = new RunResponseHandler( runCompletedFuture, METADATA_EXTRACTOR ); PullAllResponseHandler pullAllHandler = newPullAllHandler( statement, runHandler, connection, tx ); connection.writeAndFlush( new RunMessage( query, params ), runHandler, PullAllMessage.PULL_ALL, pullAllHandler ); if ( waitForRunResponse ) { // wait for response of RUN before proceeding return runCompletedFuture.thenApply( ignore -> new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } else { return completedFuture( new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } }
private static CompletionStage<InternalStatementResultCursor> runStatement( Connection connection, Statement statement, BookmarksHolder bookmarksHolder, ExplicitTransaction tx, TransactionConfig config, boolean waitForRunResponse ) { String query = statement.text(); Map<String,Value> params = statement.parameters().asMap( ofValue() ); CompletableFuture<Void> runCompletedFuture = new CompletableFuture<>(); Message runMessage = new RunWithMetadataMessage( query, params, bookmarksHolder.getBookmarks(), config ); RunResponseHandler runHandler = new RunResponseHandler( runCompletedFuture, METADATA_EXTRACTOR ); PullAllResponseHandler pullAllHandler = newPullAllHandler( statement, runHandler, connection, bookmarksHolder, tx ); connection.writeAndFlush( runMessage, runHandler, PULL_ALL, pullAllHandler ); if ( waitForRunResponse ) { // wait for response of RUN before proceeding return runCompletedFuture.thenApply( ignore -> new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } else { return completedFuture( new InternalStatementResultCursor( runHandler, pullAllHandler ) ); } }
@Override public T apply( Value plan ) { final String operatorType = plan.get( "operatorType" ).asString(); final Value argumentsValue = plan.get( "args" ); final Map<String, Value> arguments = argumentsValue.isNull() ? Collections.<String, Value>emptyMap() : argumentsValue.asMap( Values.ofValue() ); final Value identifiersValue = plan.get( "identifiers" ); final List<String> identifiers = identifiersValue.isNull() ? Collections.<String>emptyList() : identifiersValue.asList( ofString() ); final Value childrenValue = plan.get( "children" ); final List<T> children = childrenValue.isNull() ? Collections.<T>emptyList() : childrenValue.asList( this ); return planCreator.create( operatorType, arguments, identifiers, children, plan ); } }