com.sibvisions.rad.persist.jdbc
Class MSSQLDBAccess

java.lang.Object
  extended by com.sibvisions.rad.persist.jdbc.DBAccess
      extended by com.sibvisions.rad.persist.jdbc.MSSQLDBAccess
All Implemented Interfaces:
IDBAccess

public class MSSQLDBAccess
extends DBAccess

The MSSQLDBAccess is the implementation for MS SQL databases.

See Also:
DBAccess

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sibvisions.rad.persist.jdbc.DBAccess
DBAccess.ColumnMetaDataInfo
 
Field Summary
 
Fields inherited from class com.sibvisions.rad.persist.jdbc.DBAccess
logger, LONGNVARCHAR, NCHAR, NCLOB, NVARCHAR, QUOTE, SQLXML
 
Constructor Summary
MSSQLDBAccess()
          Constructs a new MSSQLDBAccess Object.
 
Method Summary
 Hashtable<String,Object[]> getAllowedValues(String pCatalog, String pSchema, String pTable)
          Gets the allowed values from a specific table.
 DBAccess.ColumnMetaDataInfo getColumnMetaData(String pFromClause, String[] pQueryColumns, String pBeforeQueryColumns, String pWhereClause, String pAfterWhereClause, String pWritebackTable, String[] pWritebackColumns)
          Returns the meta data information for the specified query, and configures all columns with defaults.
 String getTableForSynonym(String pSynomyn)
          Returns the full qualified table name incl. schema/catalog/db link for the given synonym.
 Object[] insertDatabaseSpecific(String pWritebackTable, String pInsertStatement, ServerMetaData pServerMetaData, Object[] pNewDataRow, String pDummyColumn)
          Returns the newly inserted row from an Database specific insert statement.
 boolean isAutoQuote(String pName)
          It returns true if this name should be automated quoted.
 void setUsername(String pUsername)
          Sets the user name to connect with.
protected  Object translateDefaultValue(String pColumnName, int pDataType, String pDefaultValue)
          Translates a default value from a column to the datatype object.
 
Methods inherited from class com.sibvisions.rad.persist.jdbc.DBAccess
close, commit, convertDatabaseSpecificObjectToValue, convertValueToDatabaseSpecificObject, createReplace, createWhereColumn, createWhereParam, delete, executeFunction, executeProcedure, executeSql, executeStatement, executeUpdate, fetch, formatSQLException, formatSQLException, getAutomaticLinkColumnName, getAutomaticLinkColumnNameTranslation, getConnection, getDatabaseSpecificLockStatement, getDBAccess, getDBAccess, getDBAccess, getDBProperties, getDBProperty, getDefaultAllowedValues, getDefaultSchema, getDefaultValues, getDriver, getFKs, getFromClause, getMaxTime, getPassword, getPK, getPreparedStatement, getQueryColumns, getSelectStatement, getUKs, getUrl, getUsername, getWHEREClause, insert, insertAnsiSQL, isOpen, isTypeEqual, lockRow, lockRowInternal, open, quote, quoteAllways, registerDBAccessClass, removeDBSpecificQuotes, removeQuotes, rollback, setAutomaticLinkColumnNameTranslation, setColumnsToStore, setConnection, setDatabaseSpecificType, setDBProperties, setDBProperty, setDefaultSchema, setDriver, setFilterParameter, setMaxTime, setPassword, setQueryTimeOut, setQuoteCharacters, setUrl, splitSchemaTable, supportsGetGeneratedKeys, toString, translateQuotes, translateValue, update, updateAnsiSQL, updateDatabaseSpecific
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MSSQLDBAccess

public MSSQLDBAccess()
Constructs a new MSSQLDBAccess Object.

Method Detail

insertDatabaseSpecific

public Object[] insertDatabaseSpecific(String pWritebackTable,
                                       String pInsertStatement,
                                       ServerMetaData pServerMetaData,
                                       Object[] pNewDataRow,
                                       String pDummyColumn)
                                throws DataSourceException
Returns the newly inserted row from an Database specific insert statement.
Database specific derivations of DBAcces need to implement it database specific.

Overrides:
insertDatabaseSpecific in class DBAccess
Parameters:
pWritebackTable - the table to use for the insert
pInsertStatement - the SQL Statement to use for the insert
pServerMetaData - the meta data to use.
pNewDataRow - the new row (Object[]) with the values to insert
pDummyColumn - null, if all writeable columns are null, but for a correct INSERT it have to be minimum one column to use in the syntax.
Returns:
the newly inserted row from an Oracle Database.
Throws:
DataSourceException - if an Exception occur during insert to the storage

translateDefaultValue

protected Object translateDefaultValue(String pColumnName,
                                       int pDataType,
                                       String pDefaultValue)
                                throws Exception
Translates a default value from a column to the datatype object.

Overrides:
translateDefaultValue in class DBAccess
Parameters:
pColumnName - the column name to translate
pDataType - the datatype of the column
pDefaultValue - the original default value from the database
Returns:
the default value with the datatype of the column or null if the default value is not valid
Throws:
Exception - if the type translation causes an error or the datatype is not supported

getAllowedValues

public Hashtable<String,Object[]> getAllowedValues(String pCatalog,
                                                   String pSchema,
                                                   String pTable)
                                            throws DataSourceException
Gets the allowed values from a specific table. The allowed values are defined through check constraints or other table related restrictions.

Overrides:
getAllowedValues in class DBAccess
Parameters:
pCatalog - the catalog name
pSchema - the schema name
pTable - the table to check
Returns:
a Hashtable with a column name as key and the allowed values as array of Objects or null if there are no allowed values
Throws:
DataSourceException - if the database access throws an exception

isAutoQuote

public boolean isAutoQuote(String pName)
Description copied from class: DBAccess
It returns true if this name should be automated quoted. e.g. in Oracle default all isUppercase(), so if the name has one loweCase character, then AutoQuote is true to quote this name.

Overrides:
isAutoQuote in class DBAccess
Parameters:
pName - the name to quote.
Returns:
true if this name should be automated quoted.

setUsername

public void setUsername(String pUsername)
Description copied from class: DBAccess
Sets the user name to connect with.

Overrides:
setUsername in class DBAccess
Parameters:
pUsername - the user name

getColumnMetaData

public DBAccess.ColumnMetaDataInfo getColumnMetaData(String pFromClause,
                                                     String[] pQueryColumns,
                                                     String pBeforeQueryColumns,
                                                     String pWhereClause,
                                                     String pAfterWhereClause,
                                                     String pWritebackTable,
                                                     String[] pWritebackColumns)
                                              throws DataSourceException
Description copied from class: DBAccess
Returns the meta data information for the specified query, and configures all columns with defaults.

Overrides:
getColumnMetaData in class DBAccess
Parameters:
pFromClause - the from clause with query tables and join definitions
pQueryColumns - the query columns
pBeforeQueryColumns - the before query columns
pWhereClause - the last where condition in query
pAfterWhereClause - the after where clause in query
pWritebackTable - the write back table to use for the isWriteable() state (Optional)
pWritebackColumns - the write back columns to use for the isWriteable() state (Optional)
Returns:
the meta data for the specified query, and initials all columns.
Throws:
DataSourceException - if an Exception occur during getting the meta data or if the storage is not opened or if one columns SQL type is not supported

getTableForSynonym

public String getTableForSynonym(String pSynomyn)
                          throws DataSourceException
Returns the full qualified table name incl. schema/catalog/db link for the given synonym. If pSynomyn is no synonym, then the pSynomyn string is returned.

Overrides:
getTableForSynonym in class DBAccess
Parameters:
pSynomyn - the synonym to use.
Returns:
the full qualified table name incl. schema/catalog/db link for the given synonym.
Throws:
DataSourceException - if an error occur in determining the synonyms.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.