net.spy.db
Class FileDriver

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.db.FileDriver
All Implemented Interfaces:
java.sql.Driver

public class FileDriver
extends SpyObject
implements java.sql.Driver


Nested Class Summary
static interface FileDriver.Updater
          Interface for registering updates.
 
Field Summary
static java.lang.String URL_PREFIX
           
 
Constructor Summary
FileDriver()
           
 
Method Summary
 boolean acceptsURL(java.lang.String arg0)
           
 void clearQueries()
          Remove all mapped queries.
 java.sql.Connection connect(java.lang.String url, java.util.Properties prop)
           
 int getMajorVersion()
           
 int getMinorVersion()
           
 java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String arg0, java.util.Properties arg1)
           
 boolean jdbcCompliant()
           
 void registerQuery(java.lang.String url, DBSQL db, java.lang.Object[] args, java.io.File path)
          Register the query(-ies) from the given DBSQL and args to a file.
 void registerQuery(java.lang.String url, java.lang.String s, java.io.File f)
          Register a query to file mapping.
 void registerQuery(java.lang.String url, java.lang.String s, java.lang.Object[] args, java.io.File f)
          Register a ResultSet File to a parameterized query.
 void registerUpdate(java.lang.String url, DBSQL db, java.lang.Object[] args, FileDriver.Updater u)
          Register the update(s) from the given DBSQL and args to an updater.
 void registerUpdate(java.lang.String url, DBSQL db, java.lang.Object[] args, int rv)
          Register the update(s) from the given DBSQL and args to return an int.
 void registerUpdate(java.lang.String url, java.lang.String s, java.lang.Object[] args, FileDriver.Updater action)
          Register an update action.
 void registerUpdate(java.lang.String url, java.lang.String s, java.lang.Object[] args, int rv)
          Register a simple update that returns an int.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_PREFIX

public static final java.lang.String URL_PREFIX
See Also:
Constant Field Values
Constructor Detail

FileDriver

public FileDriver()
Method Detail

registerQuery

public void registerQuery(java.lang.String url,
                          java.lang.String s,
                          java.io.File f)
Register a query to file mapping.

Parameters:
url - JDBC URL to which this query applies
s - the query string
f - the file that will provide the results

registerQuery

public void registerQuery(java.lang.String url,
                          java.lang.String s,
                          java.lang.Object[] args,
                          java.io.File f)
Register a ResultSet File to a parameterized query.

Parameters:
url - JDBC URL to which this query applies
s - the query string
args - the args
f - the file with the result set

registerQuery

public void registerQuery(java.lang.String url,
                          DBSQL db,
                          java.lang.Object[] args,
                          java.io.File path)
Register the query(-ies) from the given DBSQL and args to a file.

Parameters:
url - JDBC URL to which this query applies
db - the DBSQL instance.
args - arguments to this query
path - the path of the results

registerUpdate

public void registerUpdate(java.lang.String url,
                           java.lang.String s,
                           java.lang.Object[] args,
                           FileDriver.Updater action)
Register an update action.

Parameters:
url - JDBC URL to which this query applies
s - the query
args - the args
action - the action to be performed upon this update

registerUpdate

public void registerUpdate(java.lang.String url,
                           DBSQL db,
                           java.lang.Object[] args,
                           FileDriver.Updater u)
Register the update(s) from the given DBSQL and args to an updater.

Parameters:
url - JDBC URL to which this query applies
db - the DBSQL instance
args - the arguments to the update
u - the updater

registerUpdate

public void registerUpdate(java.lang.String url,
                           DBSQL db,
                           java.lang.Object[] args,
                           int rv)
Register the update(s) from the given DBSQL and args to return an int.

Parameters:
url - JDBC URL to which this query applies
db - the DBSQL instance
args - the arguments to the update
rv - the return value

registerUpdate

public void registerUpdate(java.lang.String url,
                           java.lang.String s,
                           java.lang.Object[] args,
                           int rv)
Register a simple update that returns an int.

Parameters:
url - JDBC URL to which this query applies
s - the query
args - the args
rv - the value that should be returned from this update

clearQueries

public void clearQueries()
Remove all mapped queries.


connect

public java.sql.Connection connect(java.lang.String url,
                                   java.util.Properties prop)
                            throws java.sql.SQLException
Specified by:
connect in interface java.sql.Driver
Throws:
java.sql.SQLException

acceptsURL

public boolean acceptsURL(java.lang.String arg0)
                   throws java.sql.SQLException
Specified by:
acceptsURL in interface java.sql.Driver
Throws:
java.sql.SQLException

getPropertyInfo

public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String arg0,
                                                     java.util.Properties arg1)
                                              throws java.sql.SQLException
Specified by:
getPropertyInfo in interface java.sql.Driver
Throws:
java.sql.SQLException

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface java.sql.Driver

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface java.sql.Driver

jdbcCompliant

public boolean jdbcCompliant()
Specified by:
jdbcCompliant in interface java.sql.Driver


Copyright © 1995-2005 SPY Internetworking. All Rights Reserved.