net.loadbang.sql
Class HSQL_DB

java.lang.Object
  extended by net.loadbang.sql.Database
      extended by net.loadbang.sql.HSQL_DB

public class HSQL_DB
extends Database

This is an encapsulated database connection to a HSQLDB located in the Max/MSP search path.

The database is mapped to a small number of text files. We actually locate the text files by searching for a mandatory "place-holder" file in Max's search path. This makes more sense than some property declaration somewhere.

Every instance of this object maintains its own database connection; there's no complicated connection pooling (and no real need for it). The database will automatically shut down when the last connection to it has been closed.

I don't know how HSQLDB will react to scheduler-priority threads, but we synchronise access to the connection to avoid interference between scheduler and GUI threads. (Although HSQLDB claims to be thread-safe, clearly that's not going to be true for the individual connections.)

Author:
Nick Rothwell, nick@cassiel.com / nick@loadbang.net

Nested Class Summary
 
Nested classes/interfaces inherited from class net.loadbang.sql.Database
Database.ConnectionCallback<T>
 
Constructor Summary
HSQL_DB(java.lang.String placeHolder)
          Constructor: create an HSQLDB database in a location specified by the place-holder.
 
Method Summary
 
Methods inherited from class net.loadbang.sql.Database
close, open, query, update, withConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSQL_DB

public HSQL_DB(java.lang.String placeHolder)
        throws SetupException
Constructor: create an HSQLDB database in a location specified by the place-holder.

Parameters:
placeHolder - the name of the place-holder file (without the hard-wired .PLACE_HOLDER suffix)
Throws:
SetupException - if the place-holder filename cannot be found, or if there is some other problem establishing the database connection