21
21
import java .util .Map ;
22
22
23
23
/**
24
- * Common interface for components that can execute Neo4j statements .
24
+ * Common interface for components that can execute Neo4j queries .
25
25
*
26
26
* <h2>Important notes on semantics</h2>
27
27
* <p>
28
- * Statements run in the same {@link StatementRunner } are guaranteed
29
- * to execute in order, meaning changes made by one statement will be seen
30
- * by all subsequent statements in the same {@link StatementRunner }.
28
+ * queries run in the same {@link QueryRunner } are guaranteed
29
+ * to execute in order, meaning changes made by one query will be seen
30
+ * by all subsequent queries in the same {@link QueryRunner }.
31
31
* <p>
32
32
* However, to allow handling very large results, and to improve performance,
33
33
* result streams are retrieved lazily from the network.
34
- * This means that when any of {@link #run(Statement )}
35
- * methods return a result, the statement has only started executing - it may not
34
+ * This means that when any of {@link #run(Query )}
35
+ * methods return a result, the query has only started executing - it may not
36
36
* have completed yet. Most of the time, you will not notice this, because the
37
- * driver automatically waits for statements to complete at specific points to
37
+ * driver automatically waits for queries to complete at specific points to
38
38
* fulfill its contracts.
39
39
* <p>
40
- * Specifically, the driver will ensure all outstanding statements are completed
40
+ * Specifically, the driver will ensure all outstanding queries are completed
41
41
* whenever you:
42
42
*
43
43
* <ul>
44
44
* <li>Read from or discard a result, for instance via
45
- * {@link StatementResult #next()} or {@link StatementResult #consume()} </li>
45
+ * {@link Result #next()} or {@link Result #consume()} </li>
46
46
* <li>Explicitly commit/rollback a transaction using blocking {@link Transaction#close()} </li>
47
47
* <li>Close a session using blocking {@link Session#close()}</li>
48
48
* </ul>
59
59
* @see Transaction
60
60
* @since 1.0
61
61
*/
62
- public interface StatementRunner
62
+ public interface QueryRunner
63
63
{
64
64
/**
65
- * Run a statement and return a result stream.
65
+ * Run a query and return a result stream.
66
66
* <p>
67
67
* This method takes a set of parameters that will be injected into the
68
- * statement by Neo4j. Using parameters is highly encouraged, it helps avoid
68
+ * query by Neo4j. Using parameters is highly encouraged, it helps avoid
69
69
* dangerous cypher injection attacks and improves database performance as
70
70
* Neo4j can re-use query plans more often.
71
71
* <p>
@@ -77,25 +77,25 @@ public interface StatementRunner
77
77
* might be more helpful, it converts your map to a {@link Value} for you.
78
78
*
79
79
* <h2>Example</h2>
80
- * <pre class="doctest:StatementRunnerDocIT #parameterTest">
80
+ * <pre class="doctest:QueryRunnerDocIT #parameterTest">
81
81
* {@code
82
82
*
83
- * StatementResult cursor = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
83
+ * Result result = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
84
84
* Values.parameters( "myNameParam", "Bob" ) );
85
85
* }
86
86
* </pre>
87
87
*
88
- * @param statementTemplate text of a Neo4j statement
88
+ * @param query text of a Neo4j query
89
89
* @param parameters input parameters, should be a map Value, see {@link Values#parameters(Object...)}.
90
90
* @return a stream of result values and associated metadata
91
91
*/
92
- StatementResult run ( String statementTemplate , Value parameters );
92
+ Result run (String query , Value parameters );
93
93
94
94
/**
95
- * Run a statement and return a result stream.
95
+ * Run a query and return a result stream.
96
96
* <p>
97
97
* This method takes a set of parameters that will be injected into the
98
- * statement by Neo4j. Using parameters is highly encouraged, it helps avoid
98
+ * query by Neo4j. Using parameters is highly encouraged, it helps avoid
99
99
* dangerous cypher injection attacks and improves database performance as
100
100
* Neo4j can re-use query plans more often.
101
101
* <p>
@@ -104,61 +104,61 @@ public interface StatementRunner
104
104
* a list of allowed types.
105
105
*
106
106
* <h2>Example</h2>
107
- * <pre class="doctest:StatementRunnerDocIT #parameterTest">
107
+ * <pre class="doctest:QueryRunnerDocIT #parameterTest">
108
108
* {@code
109
109
*
110
110
* Map<String, Object> parameters = new HashMap<String, Object>();
111
111
* parameters.put("myNameParam", "Bob");
112
112
*
113
- * StatementResult cursor = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
113
+ * Result result = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
114
114
* parameters );
115
115
* }
116
116
* </pre>
117
117
*
118
- * @param statementTemplate text of a Neo4j statement
119
- * @param statementParameters input data for the statement
118
+ * @param query text of a Neo4j query
119
+ * @param parameters input data for the query
120
120
* @return a stream of result values and associated metadata
121
121
*/
122
- StatementResult run ( String statementTemplate , Map <String ,Object > statementParameters );
122
+ Result run (String query , Map <String ,Object > parameters );
123
123
124
124
/**
125
- * Run a statement and return a result stream.
125
+ * Run a query and return a result stream.
126
126
* <p>
127
127
* This method takes a set of parameters that will be injected into the
128
- * statement by Neo4j. Using parameters is highly encouraged, it helps avoid
128
+ * query by Neo4j. Using parameters is highly encouraged, it helps avoid
129
129
* dangerous cypher injection attacks and improves database performance as
130
130
* Neo4j can re-use query plans more often.
131
131
* <p>
132
132
* This version of run takes a {@link Record} of parameters, which can be useful
133
- * if you want to use the output of one statement as input for another.
133
+ * if you want to use the output of one query as input for another.
134
134
*
135
- * @param statementTemplate text of a Neo4j statement
136
- * @param statementParameters input data for the statement
135
+ * @param query text of a Neo4j query
136
+ * @param parameters input data for the query
137
137
* @return a stream of result values and associated metadata
138
138
*/
139
- StatementResult run ( String statementTemplate , Record statementParameters );
139
+ Result run (String query , Record parameters );
140
140
141
141
/**
142
- * Run a statement and return a result stream.
142
+ * Run a query and return a result stream.
143
143
*
144
- * @param statementTemplate text of a Neo4j statement
144
+ * @param query text of a Neo4j query
145
145
* @return a stream of result values and associated metadata
146
146
*/
147
- StatementResult run ( String statementTemplate );
147
+ Result run (String query );
148
148
149
149
/**
150
- * Run a statement and return a result stream.
150
+ * Run a query and return a result stream.
151
151
* <h2>Example</h2>
152
- * <pre class="doctest:StatementRunnerDocIT#statementObjectTest ">
152
+ * <pre class="doctest:QueryRunnerDocIT#queryObjectTest ">
153
153
* {@code
154
154
*
155
- * Statement statement = new Statement ( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
156
- * StatementResult cursor = session.run( statement .withParameters( Values.parameters( "myNameParam", "Bob" ) ) );
155
+ * Query query = new Query ( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
156
+ * Result result = session.run( query .withParameters( Values.parameters( "myNameParam", "Bob" ) ) );
157
157
* }
158
158
* </pre>
159
159
*
160
- * @param statement a Neo4j statement
160
+ * @param query a Neo4j query
161
161
* @return a stream of result values and associated metadata
162
162
*/
163
- StatementResult run ( Statement statement );
163
+ Result run (Query query );
164
164
}
0 commit comments