Class for creating PreparedStatements with named parameters.
More...
|
String | getQuery () |
|
void | setObject (String name, Object value) throws SQLException |
| Sets a parameter. More...
|
|
void | setString (String name, String value) throws SQLException |
| Sets a parameter. More...
|
|
void | setInt (String name, int value) throws SQLException |
| Sets a parameter. More...
|
|
void | setLong (String name, long value) throws SQLException |
| Sets a parameter. More...
|
|
void | setBoolean (String name, boolean value) throws SQLException |
| Sets a parameter. More...
|
|
void | setBinary (String name, byte[] value) throws SQLException |
| Sets a parameter. More...
|
|
boolean | execute () throws SQLException |
| Executes the statement. More...
|
|
ResultSet | executeQuery () throws SQLException |
| Executes the statement, which must be a query. More...
|
|
int | executeUpdate () throws SQLException |
| Executes the statement, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. More...
|
|
ResultSet | getGeneratedKeys () throws SQLException |
| Retrieves any auto-generated keys created as a result of executing this Statement object. More...
|
|
int | lastInsertId () throws SQLException |
|
void | close () |
| Closes the statement. More...
|
|
void | addBatch () throws SQLException |
| Adds the current set of parameters as a batch entry. More...
|
|
int[] | executeBatch () throws SQLException |
| Executes all of the batched statements. More...
|
|
|
List< Integer > | getIndexes (String name) |
| Returns the indexes for a parameter. More...
|
|
Class for creating PreparedStatements with named parameters.
Based on Named Parameters for PreparedStatement
Definition at line 22 of file MysqlStatement.java.
org.openslx.imagemaster.db.MysqlStatement.MysqlStatement |
( |
Connection |
con, |
|
|
String |
sql |
|
) |
| throws SQLException |
|
package |
void org.openslx.imagemaster.db.MysqlStatement.addBatch |
( |
| ) |
throws SQLException |
Adds the current set of parameters as a batch entry.
- Exceptions
-
SQLException | if something went wrong |
Definition at line 279 of file MysqlStatement.java.
void org.openslx.imagemaster.db.MysqlStatement.close |
( |
| ) |
|
boolean org.openslx.imagemaster.db.MysqlStatement.execute |
( |
| ) |
throws SQLException |
Executes the statement.
- Returns
- true if the first result is a ResultSet
- Exceptions
-
SQLException | if an error occurred |
- See also
- PreparedStatement::execute()
Definition at line 179 of file MysqlStatement.java.
int [] org.openslx.imagemaster.db.MysqlStatement.executeBatch |
( |
| ) |
throws SQLException |
ResultSet org.openslx.imagemaster.db.MysqlStatement.executeQuery |
( |
| ) |
throws SQLException |
Executes the statement, which must be a query.
- Returns
- the query results
- Exceptions
-
SQLException | if an error occurred |
- See also
- PreparedStatement::executeQuery()
Definition at line 191 of file MysqlStatement.java.
int org.openslx.imagemaster.db.MysqlStatement.executeUpdate |
( |
| ) |
throws SQLException |
Executes the statement, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement.
- Returns
- number of rows affected
- Exceptions
-
SQLException | if an error occurred |
- See also
- PreparedStatement::executeUpdate()
Definition at line 207 of file MysqlStatement.java.
ResultSet org.openslx.imagemaster.db.MysqlStatement.getGeneratedKeys |
( |
| ) |
throws SQLException |
Retrieves any auto-generated keys created as a result of executing this Statement
object.
If this Statement
object did not generate any keys, an empty ResultSet
object is returned.
Note:If the columns which represent the auto-generated keys were not specified, the JDBC driver implementation will determine the columns which best represent the auto-generated keys.
- Returns
- a
ResultSet
object containing the auto-generated key(s) generated by the execution of this Statement
object
- Exceptions
-
SQLException | if a database access error occurs or this method is called on a closed Statement |
SQLFeatureNotSupportedException | if the JDBC driver does not support this method |
Definition at line 229 of file MysqlStatement.java.
List<Integer> org.openslx.imagemaster.db.MysqlStatement.getIndexes |
( |
String |
name | ) |
|
|
private |
Returns the indexes for a parameter.
- Parameters
-
- Returns
- parameter indexes
- Exceptions
-
IllegalArgumentException | if the parameter does not exist |
Definition at line 61 of file MysqlStatement.java.
String org.openslx.imagemaster.db.MysqlStatement.getQuery |
( |
| ) |
|
int org.openslx.imagemaster.db.MysqlStatement.lastInsertId |
( |
| ) |
throws SQLException |
static PreparsedQuery org.openslx.imagemaster.db.MysqlStatement.parse |
( |
String |
query | ) |
|
|
staticprivate |
void org.openslx.imagemaster.db.MysqlStatement.setBinary |
( |
String |
name, |
|
|
byte[] |
value |
|
) |
| throws SQLException |
Sets a parameter.
- Parameters
-
name | parameter name |
value | parameter value |
- Exceptions
-
SQLException | if an error occurred |
IllegalArgumentException | if the parameter does not exist |
- See also
- PreparedStatement::setBoolean(int, boolean)
Definition at line 164 of file MysqlStatement.java.
void org.openslx.imagemaster.db.MysqlStatement.setBoolean |
( |
String |
name, |
|
|
boolean |
value |
|
) |
| throws SQLException |
Sets a parameter.
- Parameters
-
name | parameter name |
value | parameter value |
- Exceptions
-
SQLException | if an error occurred |
IllegalArgumentException | if the parameter does not exist |
- See also
- PreparedStatement::setBoolean(int, boolean)
Definition at line 147 of file MysqlStatement.java.
void org.openslx.imagemaster.db.MysqlStatement.setInt |
( |
String |
name, |
|
|
int |
value |
|
) |
| throws SQLException |
Sets a parameter.
- Parameters
-
name | parameter name |
value | parameter value |
- Exceptions
-
SQLException | if an error occurred |
IllegalArgumentException | if the parameter does not exist |
- See also
- PreparedStatement::setInt(int, int)
Definition at line 113 of file MysqlStatement.java.
void org.openslx.imagemaster.db.MysqlStatement.setLong |
( |
String |
name, |
|
|
long |
value |
|
) |
| throws SQLException |
Sets a parameter.
- Parameters
-
name | parameter name |
value | parameter value |
- Exceptions
-
SQLException | if an error occurred |
IllegalArgumentException | if the parameter does not exist |
- See also
- PreparedStatement::setLong(int, long)
Definition at line 130 of file MysqlStatement.java.
void org.openslx.imagemaster.db.MysqlStatement.setObject |
( |
String |
name, |
|
|
Object |
value |
|
) |
| throws SQLException |
Sets a parameter.
- Parameters
-
name | parameter name |
value | parameter value |
- Exceptions
-
SQLException | if an error occurred |
IllegalArgumentException | if the parameter does not exist |
- See also
- PreparedStatement::setObject(int, java.lang.Object)
Definition at line 79 of file MysqlStatement.java.
void org.openslx.imagemaster.db.MysqlStatement.setString |
( |
String |
name, |
|
|
String |
value |
|
) |
| throws SQLException |
Sets a parameter.
- Parameters
-
name | parameter name |
value | parameter value |
- Exceptions
-
SQLException | if an error occurred |
IllegalArgumentException | if the parameter does not exist |
- See also
- PreparedStatement::setString(int, java.lang.String)
Definition at line 96 of file MysqlStatement.java.
final List<ResultSet> org.openslx.imagemaster.db.MysqlStatement.openResultSets = new ArrayList<>() |
|
private |
final PreparedStatement org.openslx.imagemaster.db.MysqlStatement.statement |
|
private |
The documentation for this class was generated from the following file: