|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openbandy.io.storage.DatabaseConnection
public class DatabaseConnection
The DatabaseConnection class implements the StorageConnection
class in order to execute SQL statements on the JDBC database.
To do so, it makes use of the java.sql package classes. Additionally,
it features the getLastInsertedId() method, which returns the numeric
ID value of the last object that was inserted into the database.
(c) Copyright Philipp Bolliger 2007, ALL RIGHTS RESERVED.
Method Summary | |
---|---|
void |
close()
TODO comment! |
boolean |
connect()
TODO comment! |
boolean |
executeDELETE(Serializable serializable)
This method deletes the serializable object in the storage. |
int |
executeINSERT(ObjectEntry objectEntry)
This method inserts the objectEntry in the database
and returns the genereated id resp. |
java.sql.ResultSet |
executeSELECT(java.lang.String sql)
This method returns the ResultSet for the select statement
sql . |
void |
executeUPDATE(ObjectEntry objectEntry)
This method updates the objectEntry in the database. |
java.lang.String |
getConnectionIdentifier()
Returns a string that allows the Storage to distinguish different connections in order to avert muliple open connections for the same serializer. |
int |
getLastInsertedId(ObjectEntry entry)
|
static DatabaseConnection |
instance()
|
boolean |
isConnected()
TODO comment! |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static DatabaseConnection instance()
public boolean connect()
StorageConnection
connect
in interface StorageConnection
public boolean isConnected()
StorageConnection
isConnected
in interface StorageConnection
public void close()
StorageConnection
close
in interface StorageConnection
public java.lang.String getConnectionIdentifier()
StorageConnection
getConnectionIdentifier
in interface StorageConnection
public int executeINSERT(ObjectEntry objectEntry)
objectEntry
in the database
and returns the genereated id resp. key.
executeINSERT
in interface StorageConnection
objectEntry
-
public void executeUPDATE(ObjectEntry objectEntry)
objectEntry
in the database.
executeUPDATE
in interface StorageConnection
objectEntry
- public boolean executeDELETE(Serializable serializable)
StorageConnection
serializable
object in the storage.
executeDELETE
in interface StorageConnection
serializable
- Entry to delete
serializable
object has been deleted.public java.sql.ResultSet executeSELECT(java.lang.String sql)
ResultSet
for the select statement
sql
. If the select statement sql
produces
no results, this method will return null
. Otherwise, the
cursor will be set to the first row.
sql
- The select statement to be executed.
public int getLastInsertedId(ObjectEntry entry)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |