org.erowid.sperowider.hsqldb
Class BasicTable

java.lang.Object
  extended byorg.erowid.sperowider.hsqldb.BasicTable
Direct Known Subclasses:
MapTable, SetTable, TwoWayMapTable

public class BasicTable
extends Object

Provides basic functionality to classes that want to present Java interfaces to HSQLDB tables.

Version:
: $Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperowider/hsqldb/BasicTable.java,v 1.5 2005/05/16 01:20:33 gurustu Exp $
Author:
: $Author: gurustu $

Field Summary
static int CACHED
          Used in constructors to indicate that data will be stored in a mix of memory and file.
static int MEMORY
          Used in constructors to indicate that all data should be stored in memory.
 
Constructor Summary
BasicTable(String name, Connection connection, int mode)
          Represents a database table with the given name.
 
Method Summary
 void execSQL(String sql)
          Convenience method to execute some SQL.
 Connection getConnection()
          The database connection to the database containing this table.
 int getMode()
          Returns the mode value, which is either MEMORY or CACHED.
 String getName()
          Returns the table name.
 String getTableCreatePrefix()
          Uses getMode() to return either "create cached table" or "create memory table".
 PreparedStatement prepareStatement(String sql)
          A convenience method to prepare a SQL statement.
 boolean tableExists()
          Returns true if the backing table actually exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEMORY

public static final int MEMORY
Used in constructors to indicate that all data should be stored in memory. This is faster, but uses a lot of memory.

See Also:
Constant Field Values

CACHED

public static final int CACHED
Used in constructors to indicate that data will be stored in a mix of memory and file. This is slower that all in memory, but is far more memory efficient. Note that this will only work in databases that are not themselves in-memory.

See Also:
Constant Field Values
Constructor Detail

BasicTable

public BasicTable(String name,
                  Connection connection,
                  int mode)
Represents a database table with the given name. Mode should either be MEMORY or CACHED.

Method Detail

getMode

public int getMode()
Returns the mode value, which is either MEMORY or CACHED.


getTableCreatePrefix

public String getTableCreatePrefix()
Uses getMode() to return either "create cached table" or "create memory table".


getConnection

public Connection getConnection()
The database connection to the database containing this table.


getName

public String getName()
Returns the table name.


prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
A convenience method to prepare a SQL statement.

Throws:
SQLException

tableExists

public boolean tableExists()
                    throws SQLException
Returns true if the backing table actually exists.

Throws:
SQLException

execSQL

public void execSQL(String sql)
             throws SQLException
Convenience method to execute some SQL.

Throws:
SQLException

spero logo small Sperowider is
© 2005 Erowid.org