org.vrspace.neurogrid
Class SQLStore

java.lang.Object
  extended byorg.vrspace.neurogrid.SQLStore
All Implemented Interfaces:
Store
Direct Known Subclasses:
MySQLStore, OracleStore

public class SQLStore
extends java.lang.Object
implements Store


Field Summary
protected  java.sql.Connection conn
           
protected  java.sql.PreparedStatement delete
           
protected  java.sql.PreparedStatement insert
           
protected  java.sql.PreparedStatement select
           
protected  java.sql.PreparedStatement update
           
 
Constructor Summary
SQLStore()
           
 
Method Summary
protected  void checkForSwap()
           
 long count()
           
 void delete(NGObject obj)
           
 java.sql.Connection getConnection()
           
 void init(DBAdapter db, LoadListener listener)
          Initialize: create table 'swap' if not exists.
 NGObject retrieve(java.lang.Class what, long id)
          Retrieve an object from the database
 void store(NGObject obj)
          Store an object to the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conn

protected java.sql.Connection conn

insert

protected java.sql.PreparedStatement insert

update

protected java.sql.PreparedStatement update

select

protected java.sql.PreparedStatement select

delete

protected java.sql.PreparedStatement delete
Constructor Detail

SQLStore

public SQLStore()
Method Detail

store

public void store(NGObject obj)
           throws java.sql.SQLException
Store an object to the database

Specified by:
store in interface Store
Throws:
java.sql.SQLException

delete

public void delete(NGObject obj)
            throws java.sql.SQLException
Specified by:
delete in interface Store
Throws:
java.sql.SQLException

retrieve

public NGObject retrieve(java.lang.Class what,
                         long id)
                  throws java.lang.Exception
Retrieve an object from the database

Specified by:
retrieve in interface Store
Throws:
java.lang.Exception

checkForSwap

protected void checkForSwap()
                     throws java.lang.Exception
Throws:
java.lang.Exception

init

public void init(DBAdapter db,
                 LoadListener listener)
          throws java.lang.Exception
Initialize: create table 'swap' if not exists. Assumes open connection to the database.

Specified by:
init in interface Store
Throws:
java.lang.Exception

count

public long count()
           throws java.lang.Exception
Specified by:
count in interface Store
Throws:
java.lang.Exception

getConnection

public java.sql.Connection getConnection()