bwLehrpool Masterserver
Manages authentication and sharing of virtual machines between participating institutions
Classes | Public Member Functions | Package Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.openslx.imagemaster.db.MysqlStatement Class Reference

Class for creating PreparedStatements with named parameters. More...

+ Inheritance diagram for org.openslx.imagemaster.db.MysqlStatement:
+ Collaboration diagram for org.openslx.imagemaster.db.MysqlStatement:

Classes

class  PreparsedQuery
 
class  QueryCache
 

Public Member Functions

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...
 

Package Functions

 MysqlStatement (Connection con, String sql) throws SQLException
 

Private Member Functions

List< Integer > getIndexes (String name)
 Returns the indexes for a parameter. More...
 

Static Private Member Functions

static PreparsedQuery parse (String query)
 

Private Attributes

final PreparsedQuery query
 
final PreparedStatement statement
 
final List< ResultSet > openResultSets = new ArrayList<>()
 

Static Private Attributes

static final QueryCache cache = new QueryCache()
 

Detailed Description

Class for creating PreparedStatements with named parameters.

Based on Named Parameters for PreparedStatement

Definition at line 22 of file MysqlStatement.java.

Constructor & Destructor Documentation

org.openslx.imagemaster.db.MysqlStatement.MysqlStatement ( Connection  con,
String  sql 
) throws SQLException
package

Definition at line 33 of file MysqlStatement.java.

+ Here is the call graph for this function:

Member Function Documentation

void org.openslx.imagemaster.db.MysqlStatement.addBatch ( ) throws SQLException

Adds the current set of parameters as a batch entry.

Exceptions
SQLExceptionif something went wrong

Definition at line 279 of file MysqlStatement.java.

void org.openslx.imagemaster.db.MysqlStatement.close ( )

Closes the statement.

See also
Statement::close()

Definition at line 253 of file MysqlStatement.java.

boolean org.openslx.imagemaster.db.MysqlStatement.execute ( ) throws SQLException

Executes the statement.

Returns
true if the first result is a ResultSet
Exceptions
SQLExceptionif an error occurred
See also
PreparedStatement::execute()

Definition at line 179 of file MysqlStatement.java.

+ Here is the caller graph for this function:

int [] org.openslx.imagemaster.db.MysqlStatement.executeBatch ( ) throws SQLException

Executes all of the batched statements.

See Statement#executeBatch() for details.

Returns
update counts for each statement
Exceptions
SQLExceptionif something went wrong

Definition at line 292 of file MysqlStatement.java.

ResultSet org.openslx.imagemaster.db.MysqlStatement.executeQuery ( ) throws SQLException

Executes the statement, which must be a query.

Returns
the query results
Exceptions
SQLExceptionif an error occurred
See also
PreparedStatement::executeQuery()

Definition at line 191 of file MysqlStatement.java.

+ Here is the caller graph for this function:

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
SQLExceptionif an error occurred
See also
PreparedStatement::executeUpdate()

Definition at line 207 of file MysqlStatement.java.

+ Here is the caller graph for this function:

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
SQLExceptionif a database access error occurs or this method is called on a closed Statement
SQLFeatureNotSupportedExceptionif 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
nameparameter name
Returns
parameter indexes
Exceptions
IllegalArgumentExceptionif the parameter does not exist

Definition at line 61 of file MysqlStatement.java.

+ Here is the caller graph for this function:

String org.openslx.imagemaster.db.MysqlStatement.getQuery ( )

Definition at line 49 of file MysqlStatement.java.

int org.openslx.imagemaster.db.MysqlStatement.lastInsertId ( ) throws SQLException

Definition at line 236 of file MysqlStatement.java.

+ Here is the caller graph for this function:

static PreparsedQuery org.openslx.imagemaster.db.MysqlStatement.parse ( String  query)
staticprivate

Definition at line 299 of file MysqlStatement.java.

+ Here is the caller graph for this function:

void org.openslx.imagemaster.db.MysqlStatement.setBinary ( String  name,
byte[]  value 
) throws SQLException

Sets a parameter.

Parameters
nameparameter name
valueparameter value
Exceptions
SQLExceptionif an error occurred
IllegalArgumentExceptionif the parameter does not exist
See also
PreparedStatement::setBoolean(int, boolean)

Definition at line 164 of file MysqlStatement.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void org.openslx.imagemaster.db.MysqlStatement.setBoolean ( String  name,
boolean  value 
) throws SQLException

Sets a parameter.

Parameters
nameparameter name
valueparameter value
Exceptions
SQLExceptionif an error occurred
IllegalArgumentExceptionif the parameter does not exist
See also
PreparedStatement::setBoolean(int, boolean)

Definition at line 147 of file MysqlStatement.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void org.openslx.imagemaster.db.MysqlStatement.setInt ( String  name,
int  value 
) throws SQLException

Sets a parameter.

Parameters
nameparameter name
valueparameter value
Exceptions
SQLExceptionif an error occurred
IllegalArgumentExceptionif the parameter does not exist
See also
PreparedStatement::setInt(int, int)

Definition at line 113 of file MysqlStatement.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void org.openslx.imagemaster.db.MysqlStatement.setLong ( String  name,
long  value 
) throws SQLException

Sets a parameter.

Parameters
nameparameter name
valueparameter value
Exceptions
SQLExceptionif an error occurred
IllegalArgumentExceptionif the parameter does not exist
See also
PreparedStatement::setLong(int, long)

Definition at line 130 of file MysqlStatement.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void org.openslx.imagemaster.db.MysqlStatement.setObject ( String  name,
Object  value 
) throws SQLException

Sets a parameter.

Parameters
nameparameter name
valueparameter value
Exceptions
SQLExceptionif an error occurred
IllegalArgumentExceptionif the parameter does not exist
See also
PreparedStatement::setObject(int, java.lang.Object)

Definition at line 79 of file MysqlStatement.java.

+ Here is the call graph for this function:

void org.openslx.imagemaster.db.MysqlStatement.setString ( String  name,
String  value 
) throws SQLException

Sets a parameter.

Parameters
nameparameter name
valueparameter value
Exceptions
SQLExceptionif an error occurred
IllegalArgumentExceptionif the parameter does not exist
See also
PreparedStatement::setString(int, java.lang.String)

Definition at line 96 of file MysqlStatement.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

final QueryCache org.openslx.imagemaster.db.MysqlStatement.cache = new QueryCache()
staticprivate

Definition at line 25 of file MysqlStatement.java.

final List<ResultSet> org.openslx.imagemaster.db.MysqlStatement.openResultSets = new ArrayList<>()
private

Definition at line 31 of file MysqlStatement.java.

final PreparsedQuery org.openslx.imagemaster.db.MysqlStatement.query
private

Definition at line 27 of file MysqlStatement.java.

final PreparedStatement org.openslx.imagemaster.db.MysqlStatement.statement
private

Definition at line 29 of file MysqlStatement.java.


The documentation for this class was generated from the following file: