com.northgateis.reality.realsql
Class RealCatalogQueryR81

java.lang.Object
 |
 +--com.northgateis.reality.realsql.RealCatalogQuery
        |
 +--com.northgateis.reality.realsql.RealCatalogQueryR81

public class RealCatalogQueryR81
extends RealCatalogQuery

This class is used to generate SQL catalog query statements for connections to an 8.1D Reality database.

See Also:
RealSQLDatabaseMetaData, DatabaseMetaData

Fields inherited from class com.northgateis.reality.realsql.RealCatalogQuery
dbmd, debug, sqlStatement
 
Constructor Summary
RealCatalogQueryR81(RealSQLDatabaseMetaData metadata, int traceFlags)
           
 
Method Summary
protected  voidaddWhereOrAnd()
          Appends a 'WHERE' or 'AND' clause to the SQL statement being generated.
protected  voidBuildTableRef(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          This is employed by those catalog query methods that require to reference a specific catalog, schema, and or table name.
protected  java.lang.StringcreateBestRowStatement(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, int scope, boolean nullable)
          Constructs an appropriate catalog query to implement getBestRowIdentifier()
protected  java.lang.StringcreateCatalogStatement()
          Constructs an appropriate catalog query to implement getCatalogs()
protected  java.lang.StringcreateColumnStatement(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
          Constructs an appropriate catalog query to implement getColumns()
protected  java.lang.StringcreateIndexInfoStatement(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, boolean unique, boolean approximate)
          Constructs an appropriate catalog query to implement getIndexInfo()
protected  java.lang.StringcreatePrimaryKeyStatement(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName)
          Constructs an appropriate catalog query to implement getPrimarKeys() This is not implemented on Reality databases prior to release 8.2A
protected  java.lang.StringcreateSchemaStatement()
          Constructs an appropriate catalog query to implement getSchemas()
protected  java.lang.StringcreateTableStatement(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, java.lang.String[] types)
          Constructs an appropriate catalog query to implement getTables() Reality supports the following table types : "TABLE", "SYSTEM TABLE".
protected  java.lang.StringcreateTableTypeStatement()
          Constructs an appropriate catalog query to implement getTableTypes()
protected  java.lang.StringcreateTypeInfoStatement()
          Constructs an appropriate catalog query to implement getTypeInfo()
protected  java.lang.StringcreateVersionColumnStatement(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName)
          Constructs an appropriate catalog query to implement getVersionColumns() Reality does not support columns that are automatically updated when any value in a row is updated, therefore this query will always return a ResultSet containing zero rows.
protected  java.sql.ResultSetexecuteCatalogQuery(RealSQLStatement catalogStatement, java.lang.String sqlStatement)
          Executes the catalog query statement and returns the result set.
protected  voidparsePattern(java.lang.String pattern, java.lang.String column_name, int max_length)
          Parses a string pattern passed into one of the catalog queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealCatalogQueryR81

public RealCatalogQueryR81(RealSQLDatabaseMetaData metadata,
 int traceFlags)
Method Detail

executeCatalogQuery

protected java.sql.ResultSet executeCatalogQuery(RealSQLStatement catalogStatement,
 java.lang.String sqlStatement)
 throws java.sql.SQLException
Executes the catalog query statement and returns the result set.

Parameters:
catalogStatement - the catalog object used for the statement generation.
sqlStatement - the completed SQL statement being passed to the Reality server.
Returns:
ResultSet generated from executing this catalog query.
Overrides:
executeCatalogQuery in class RealCatalogQuery


createTableStatement

protected java.lang.String createTableStatement(java.lang.String catalogName,
 java.lang.String schemaName,
 java.lang.String tableName,
 java.lang.String[] types)
 throws RealSQLException
Constructs an appropriate catalog query to implement getTables()

Reality supports the following table types : "TABLE", "SYSTEM TABLE".

Parameters:
catalogName - a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria.
schemaName - a schema name pattern; "" retrieves those without a schema.
tableName - a table name pattern.
types - a list of table types to include; null returns all types.
Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createTableStatement in class RealCatalogQuery


createCatalogStatement

protected java.lang.String createCatalogStatement()
 throws RealSQLException
Constructs an appropriate catalog query to implement getCatalogs()

Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createCatalogStatement in class RealCatalogQuery


createSchemaStatement

protected java.lang.String createSchemaStatement()
 throws RealSQLException
Constructs an appropriate catalog query to implement getSchemas()

Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createSchemaStatement in class RealCatalogQuery


createTableTypeStatement

protected java.lang.String createTableTypeStatement()
 throws RealSQLException
Constructs an appropriate catalog query to implement getTableTypes()

Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createTableTypeStatement in class RealCatalogQuery


createColumnStatement

protected java.lang.String createColumnStatement(java.lang.String catalogName,
 java.lang.String schemaName,
 java.lang.String tableName,
 java.lang.String columnName)
 throws RealSQLException
Constructs an appropriate catalog query to implement getColumns()

Parameters:
catalogName - a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria.
schemaName - a schema name pattern; "" retrieves those without a schema.
tableName - a table name pattern.
columnName - a column name pattern.
Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createColumnStatement in class RealCatalogQuery


createBestRowStatement

protected java.lang.String createBestRowStatement(java.lang.String catalogName,
 java.lang.String schemaName,
 java.lang.String tableName,
 int scope,
 boolean nullable)
 throws RealSQLException
Constructs an appropriate catalog query to implement getBestRowIdentifier()

Parameters:
catalogName - a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria.
schemaName - a schema name; "" retrieves those without a schema.
tableName - a table name.
columnName - a column name.
scope - - the scope of interest; use same values as SCOPE
nullable - - include columns that are nullable?
Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createBestRowStatement in class RealCatalogQuery


createVersionColumnStatement

protected java.lang.String createVersionColumnStatement(java.lang.String catalogName,
 java.lang.String schemaName,
 java.lang.String tableName)
 throws RealSQLException
Constructs an appropriate catalog query to implement getVersionColumns()

Reality does not support columns that are automatically updated when any value in a row is updated, therefore this query will always return a ResultSet containing zero rows.

Parameters:
catalogName - a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria.
schemaName - a schema name; "" retrieves those without a schema.
tableName - a table name.
columnName - a column name.
Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createVersionColumnStatement in class RealCatalogQuery


createIndexInfoStatement

protected java.lang.String createIndexInfoStatement(java.lang.String catalogName,
 java.lang.String schemaName,
 java.lang.String tableName,
 boolean unique,
 boolean approximate)
 throws RealSQLException
Constructs an appropriate catalog query to implement getIndexInfo()

Parameters:
catalogName - a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria.
schemaName - a schema name; "" retrieves those without a schema.
tableName - a table name.
columnName - a column name.
unique - - when true, return only indices for unique values; when false, return indices regardless of whether unique or not
approximate - - when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate
Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createIndexInfoStatement in class RealCatalogQuery


createTypeInfoStatement

protected java.lang.String createTypeInfoStatement()
 throws RealSQLException
Constructs an appropriate catalog query to implement getTypeInfo()

Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createTypeInfoStatement in class RealCatalogQuery


createPrimaryKeyStatement

protected java.lang.String createPrimaryKeyStatement(java.lang.String catalogName,
 java.lang.String schemaName,
 java.lang.String tableName)
 throws RealSQLException
Constructs an appropriate catalog query to implement getPrimarKeys()

This is not implemented on Reality databases prior to release 8.2A

Parameters:
catalogName - a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria.
schemaName - a schema name; "" retrieves those without a schema.
tableName - a table name.
columnName - a column name.
Returns:
String SQL statement representing this query.
Throws:
RealSQLException -  
Overrides:
createPrimaryKeyStatement in class RealCatalogQuery


parsePattern

protected void parsePattern(java.lang.String pattern,
 java.lang.String column_name,
 int max_length)
 throws RealSQLException
Parses a string pattern passed into one of the catalog queries. If the pattern is NULL, an empty string, or '%' the method returns without modifying the statement being generated. If the pattern length is greater than the maximum length allowed an exception is thrown. i.e. (WHERE|AND) column_name LIKE 'pattern'

Parameters:
pattern - the pattern being applied.
column_name - the name of the table column being accessed.
max_length - maximum length of pattern
Throws:
RealSQLException - if pattern length exceeds its maximum value.


addWhereOrAnd

protected void addWhereOrAnd()
Appends a 'WHERE' or 'AND' clause to the SQL statement being generated. Which clause is dependant on the value of the whereFlag. The flag is initally always set to false and then set to true on the first pass through, this method maybe called a number of times for one catalog statement.

BuildTableRef

protected void BuildTableRef(java.lang.String catalog,
 java.lang.String schema,
 java.lang.String table)
 throws RealSQLException
This is employed by those catalog query methods that require to reference a specific catalog, schema, and or table name. If a name length is greater than the maximum length allowed an exception is thrown. Providing the name is not null or an empty string the SQL statement is modified to include the named references

i.e. (WHERE|AND) TABLE_QUALIFIER = 'catalog' (WHERE|AND) TABLE_OWNER = 'schema' (WHERE|AND) TABLE_NAME = 'table'

Parameters:
catalog - the name of the table catalog.
schema - the name of the table schema.
table - the name of the table.
Throws:
RealSQLException - if a name length exceeds its maximum value.