org.chur.ant.db.profiles
Interface DBProfile

All Known Implementing Classes:
AbstractDBProfile, CommonProfile, DB2Profile, MySQLProfile, OracleProfile

public interface DBProfile

Date: Oct 9, 2006 Time: 6:28:59 PM Author: Sergey Churikov


Method Summary
 java.lang.String convert(java.sql.ResultSet rs, int fieldIndex, int sqlType)
          Export method (i.e.
 SQLCommandProducer<Record> createDeleteSQLProducer()
           
 SQLCommandProducer<Record> createInsertSQLProducer()
           
 SQLCommandProducer<UpdateRecord> createUpdateSQLProducer()
           
 boolean isExceptionCanBeIgnored(java.sql.SQLException ex)
          This this method it is possible to handle some cases when SQL operation can be continue even database error occured (say in case of Oracle we ignore ORA-00942 error: table or view does not exist).
 java.lang.String typeName(int sqlType, int len, java.lang.Integer precision)
          Comparison method, i.e.
 java.lang.String viewNameColumn()
          This method is used only in ViewStructTask to retrieve information about a view.
 java.lang.String viewOwnerColumn()
          This method is used only in ViewStructTask to retrieve information about a view.
 java.lang.String viewsCatalog()
          This method is used only in ViewStructTask to retrieve information about a view.
 java.lang.String viewSqlColumn()
          This method is used only in ViewStructTask to retrieve information about a view.
 

Method Detail

convert

java.lang.String convert(java.sql.ResultSet rs,
                         int fieldIndex,
                         int sqlType)
                         throws java.sql.SQLException
Export method (i.e. method which is used for export data from DB to XML).

This method is used to convert SQL data from ResultSet to String (i.e. java.sql.ResultSet.getXXX( fieldIndex ) to java.sql.String). The result of convertation will be saved into XML. Because JAXB is used it is not necessary to think about conversation of 'special' illegal for XML symbols (say like <).

Parameters:
rs - java.sql.ResultSet with current row
fieldIndex - the field which should be retrived from rs by rs.getXXX( fieldIndex ) method
sqlType - java.sql.Type according to metadata information.
Returns:
value of rs.getXXX( fieldIndex) which was converted into java.lang.String. Null is allowed.
Throws:
java.sql.SQLException

typeName

java.lang.String typeName(int sqlType,
                          int len,
                          java.lang.Integer precision)
Comparison method, i.e. method which is used for prepare SQL scripts while exported XMLs are compared.

Converts field description into ANSI SQL. If sqlType is not supported by DBProfile implementation IllegalArgumentException exception is thrown.

Parameters:
sqlType - java.sql.Types value
len - field len value
precision -
Returns:
ANSI SQL part

viewsCatalog

java.lang.String viewsCatalog()
This method is used only in ViewStructTask to retrieve information about a view.

Returns:
name of catalog where views are described in the given DB

viewSqlColumn

java.lang.String viewSqlColumn()
This method is used only in ViewStructTask to retrieve information about a view.

Returns:
name of field in the table/view which is returned by viewsCatalog method and where DDL defition of a view is stored in the given DB

viewNameColumn

java.lang.String viewNameColumn()
This method is used only in ViewStructTask to retrieve information about a view.

Returns:
name of field in the table/view which is returned by viewsCatalog method and where name of view's name is stored in the given DB

viewOwnerColumn

java.lang.String viewOwnerColumn()
This method is used only in ViewStructTask to retrieve information about a view.

Returns:
name of field in the table/view which is returned by viewsCatalog method and where name of view's owner name is stored in the given DB

isExceptionCanBeIgnored

boolean isExceptionCanBeIgnored(java.sql.SQLException ex)
This this method it is possible to handle some cases when SQL operation can be continue even database error occured (say in case of Oracle we ignore ORA-00942 error: table or view does not exist).

Parameters:
ex - database error
Returns:
true if given exception can be ignored or false if db action must be terminated

createUpdateSQLProducer

SQLCommandProducer<UpdateRecord> createUpdateSQLProducer()

createInsertSQLProducer

SQLCommandProducer<Record> createInsertSQLProducer()

createDeleteSQLProducer

SQLCommandProducer<Record> createDeleteSQLProducer()