xmlBlaster 2.1.0 API

org.xmlBlaster.contrib.db
Class DbMetaHelper

java.lang.Object
  extended by org.xmlBlaster.contrib.db.DbMetaHelper

public class DbMetaHelper
extends java.lang.Object

DbMetaHelper offers methods which take care of stuff specific to particular databases. For example if a database stores table names in uppercase you don't need to bother about this knowledge. You just pass the name of the table to the method getUnquotedIdentifier and you get back the correct name (if uppercase it will be uppercase).

Author:
Michele Laghi

Field Summary
private static int CASE_LOWER
           
private static int CASE_MIXED
           
private static int CASE_UNKNOWN
           
private static int CASE_UPPER
           
private  int caseSense
           
private  int maxProcLength
           
private  java.lang.String productName
           
 
Constructor Summary
DbMetaHelper(I_DbPool pool)
          Initializes the object by reading the metadata of this database.
 
Method Summary
 java.lang.String createFunctionName(java.lang.String prefix, java.lang.String separator, java.lang.String schema, java.lang.String tableName)
          If the name is too long it cuts first from the end of the schema, and then from the end of the table name.
 java.lang.String[] getColumnNames(I_DbPool pool, java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Returns an array of column names correctly sorted of the specified table.
 java.lang.String getIdentifier(java.lang.String proposedName)
          Returns the correct identifier depending on the properties of the database.
 boolean isOracle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CASE_UNKNOWN

private static final int CASE_UNKNOWN
See Also:
Constant Field Values

CASE_MIXED

private static final int CASE_MIXED
See Also:
Constant Field Values

CASE_UPPER

private static final int CASE_UPPER
See Also:
Constant Field Values

CASE_LOWER

private static final int CASE_LOWER
See Also:
Constant Field Values

caseSense

private int caseSense

maxProcLength

private int maxProcLength

productName

private java.lang.String productName
Constructor Detail

DbMetaHelper

public DbMetaHelper(I_DbPool pool)
             throws java.lang.Exception
Initializes the object by reading the metadata of this database.

Parameters:
pool - the pool must be non null and initialized.
Throws:
java.lang.Exception - If a backend exception occurs.
Method Detail

getColumnNames

public java.lang.String[] getColumnNames(I_DbPool pool,
                                         java.lang.String catalog,
                                         java.lang.String schema,
                                         java.lang.String table)
                                  throws java.lang.Exception
Returns an array of column names correctly sorted of the specified table. Never returns null, if no columns found it returns an empty array.

Throws:
java.lang.Exception - If a backend exception occurs.

getIdentifier

public java.lang.String getIdentifier(java.lang.String proposedName)
Returns the correct identifier depending on the properties of the database. If it can not determine the case of the identifier it returns null.

Parameters:
proposedName - the name which is proposed.
Returns:

createFunctionName

public java.lang.String createFunctionName(java.lang.String prefix,
                                           java.lang.String separator,
                                           java.lang.String schema,
                                           java.lang.String tableName)
If the name is too long it cuts first from the end of the schema, and then from the end of the table name. Otherwise it is ${PREFIX}${SEP}${SCHEMA}${SEP}${TABLENAME}

Parameters:
schema -
tableName -
Returns:

isOracle

public boolean isOracle()

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.