uk.ac.ic.doc.automed.wrappers
Class SQLWrapper

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
      extended by uk.ac.ic.doc.automed.wrappers.SQLWrapper
Direct Known Subclasses:
HsqldbWrapper, MSAccessWrapper, OracleWrapper, PostgresWrapper, TransactSQLWrapper

public class SQLWrapper
extends AutoMedWrapper

An AutoMed high wrapper for connecting to SQL databases that have a JBDC driver. Note that specific lower level wrapper must be instantiated in order to use a particular database.

Author:
Peter McBrien (pjm@doc.ic.ac.uk)

Field Summary
protected  java.sql.Connection con
           
static java.lang.String OPTION_SCHEMA_NAME
          An option key setting, the value of which should be the SQL schema which is the only one to be mapped in this wrapping
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
am, awf, debug, driver, emptyKeyProtection, emptyKeys, optionKeyProtection, optionKeys, password, protocol, s, url, username
 
Constructor Summary
SQLWrapper()
           
SQLWrapper(AccessMethod am, java.lang.String password)
           
 
Method Summary
protected  void connect()
          Connect to a JDBC database in the standard way.
 java.lang.String escapedSQLID(java.lang.Object o)
          Perform what escaping is necessary on SQL table names and column names.
 ASG executeIQL(ASG q)
          Execute an IQL query on the datasource.
 AutoMedResult executeLocalQuery(AutoMedQuery q)
          Execute a query in the datasource's native query language, and obtain a result in an AutoMedResult class
 SQLResult executeSQLQuery(SQLQuery q)
          Execute a query on the data source, returning the result in the standard format for instances of SQL queries.
protected  AutoMedWrapperFactory getDefaultWrapperFactory()
          Return the default AutoMedWrapperFactory that is used to generate Schema instances from information in a data sources
 java.lang.String getProtocolName()
          The name of the Protocol in the repository used to represent JDBC connections.
 QueryParser getQueryParser(ASG query)
          Return a parser that will accept queries for the wrapper.
 void getSODefinition(QuerySubGoal qsg)
          Implement AutoMedWrapper abstract method This method should never be executed because the calling method should already know that the transformation leading to the schema object represented by qsg variable belongs to a source schema.
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
atDebugLevel, cacheWrapper, deleteIQL, executeIQL, getAccessMethod, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDrivers, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, getQueryCache, getQueryCache, getSchema, getSchema, getSODefinition, insertIQL, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, newAutoMedWrapper, registerWrapper, selectNewAutoMedWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption, updateCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

con

protected java.sql.Connection con

OPTION_SCHEMA_NAME

public static final java.lang.String OPTION_SCHEMA_NAME
An option key setting, the value of which should be the SQL schema which is the only one to be mapped in this wrapping

See Also:
Constant Field Values
Constructor Detail

SQLWrapper

public SQLWrapper()

SQLWrapper

public SQLWrapper(AccessMethod am,
                  java.lang.String password)
           throws DataSourceException
Throws:
DataSourceException
Method Detail

getProtocolName

public java.lang.String getProtocolName()
The name of the Protocol in the repository used to represent JDBC connections.

Specified by:
getProtocolName in class AutoMedWrapper

escapedSQLID

public java.lang.String escapedSQLID(java.lang.Object o)
Perform what escaping is necessary on SQL table names and column names.


executeIQL

public ASG executeIQL(ASG q)
               throws DataSourceException,
                      NotFoundException
Description copied from class: AutoMedWrapper
Execute an IQL query on the datasource.

Specified by:
executeIQL in class AutoMedWrapper
Parameters:
q - An IQL query held in an ASG which complies with the limitations of what this wrapper is able to process
Returns:
An ASG containing the results of the query
Throws:
DataSourceException
NotFoundException

executeLocalQuery

public AutoMedResult executeLocalQuery(AutoMedQuery q)
                                throws DataSourceException
Description copied from class: AutoMedWrapper
Execute a query in the datasource's native query language, and obtain a result in an AutoMedResult class

Overrides:
executeLocalQuery in class AutoMedWrapper
Throws:
DataSourceException

connect

protected void connect()
                throws DataSourceException
Connect to a JDBC database in the standard way. Some databases allow you to pass additional parameters when you connect to control certain features, and therefore this method may be overridden.

Specified by:
connect in class AutoMedWrapper
Throws:
DataSourceException - if unable to connect to the data source

executeSQLQuery

public SQLResult executeSQLQuery(SQLQuery q)
                          throws DataSourceException
Execute a query on the data source, returning the result in the standard format for instances of SQL queries.

Throws:
DataSourceException

getQueryParser

public QueryParser getQueryParser(ASG query)
Description copied from class: AutoMedWrapper
Return a parser that will accept queries for the wrapper. The default parser is Schemes, which accepts only single schemes, with no other IQL operators supported. The SimpleComp parser will allow simple list comprehensions to be passed to the wrapper.

Overrides:
getQueryParser in class AutoMedWrapper

getDefaultWrapperFactory

protected AutoMedWrapperFactory getDefaultWrapperFactory()
Description copied from class: AutoMedWrapper
Return the default AutoMedWrapperFactory that is used to generate Schema instances from information in a data sources

Specified by:
getDefaultWrapperFactory in class AutoMedWrapper

getSODefinition

public void getSODefinition(QuerySubGoal qsg)
                     throws DataSourceException
Implement AutoMedWrapper abstract method This method should never be executed because the calling method should already know that the transformation leading to the schema object represented by qsg variable belongs to a source schema.

Specified by:
getSODefinition in class AutoMedWrapper
Throws:
DataSourceException