Interface PreparedStatement
public interface PreparedStatement
A prepared statement, the statement is pre-compiled and it's more efficient to execute the statement for multiple times.
In addition, this kind of statement provides protection against SQL injection attacks.
From a prepared statement you can
- use
query()to create and execute aPreparedQuery - use
cursor()to create aCursor - use
createStream(int)to create aRowStream
- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescriptionclose()Close the prepared query and release its resources.createStream(int fetch) LikecreateStream(int, Tuple)but with empty arguments.createStream(int fetch, Tuple args) Execute the prepared query with a cursor and createStream the result.default Cursorcursor()Likecursor(Tuple)but with empty arguments.Create a cursor with the providedarguments.query()Create a prepared query for this statement.
-
Method Details
-
query
PreparedQuery<RowSet<Row>> query()Create a prepared query for this statement.- Returns:
- the prepared query
-
cursor
Likecursor(Tuple)but with empty arguments. -
cursor
-
createStream
LikecreateStream(int, Tuple)but with empty arguments. -
createStream
Execute the prepared query with a cursor and createStream the result. The createStream opens a cursor with afetchsize to fetch the results. Note: this requires to be in a transaction, since cursors require it.- Parameters:
fetch- the cursor fetch sizeargs- the prepared query arguments- Returns:
- the createStream
-
close
-