Calls {@link #execute(Tuple, Handler)} with an empty tuple argument.
Create a cursor with the provided {@code arguments}.
@return create a query cursor with a {@code fetch} size and empty arguments
Create a cursor with the provided {@code arguments}.
Execute a batch.
Close the prepared query and release its resources.
Like {@link #close()} but notifies the {@code completionHandler} when it's closed.
Connection con=getConnection(); String query="select * from my_table where name=? or address=?"; PreparedStatement p=con.prepareStatement(query); p.setString(1, "bob"); p.setString(2, "123 terrace ct"); ResultSet rs=p.executeQuery();
can be replaced with:
Connection con=getConnection(); String query="select * from my_table where name=:name or address=:address"; NamedParameterStatement p=new NamedParameterStatement(con, query); p.setString("name", "bob"); p.setString("address", "123 terrace ct"); ResultSet rs=p.executeQuery();
Sourced from JavaWorld Article @ http://www.javaworld.com/javaworld/jw-04-2007/jw-04-jdbc.html
This class wraps around a {@link PreparedStatement} and allows the programmer to set parameters by name instead of by index. This eliminates any confusion as to which parameter index represents what. This also means that rearranging the SQL statement or adding a parameter doesn't involve renumbering your indices. Code such as this: