org.apache.ddlutils.platform.sybase
Class SybasePlatform

java.lang.Object
  extended by org.apache.ddlutils.util.JdbcSupport
      extended by org.apache.ddlutils.platform.PlatformImplBase
          extended by org.apache.ddlutils.platform.sybase.SybasePlatform
All Implemented Interfaces:
Platform
Direct Known Subclasses:
SybaseASE15Platform

public class SybasePlatform
extends PlatformImplBase

The platform implementation for Sybase.

Version:
$Revision: 231306 $

Field Summary
static String DATABASENAME
          Database name of this platform.
static String JDBC_DRIVER
          The standard Sybase jdbc driver.
static String JDBC_DRIVER_OLD
          The old Sybase jdbc driver.
static String JDBC_SUBPROTOCOL
          The subprotocol used by the standard Sybase driver.
static long MAX_TEXT_SIZE
          The maximum size that text and binary columns can have.
 
Fields inherited from class org.apache.ddlutils.platform.PlatformImplBase
MODEL_DEFAULT_NAME
 
Constructor Summary
SybasePlatform()
          Creates a new platform instance.
 
Method Summary
protected  void afterInsert(Connection connection, Table table)
          Allows platforms to issue statements directly after rows have been inserted into the specified table.
protected  void afterUpdate(Connection connection, Table table)
          Allows platforms to issue statements directly after rows have been updated in the specified table.
protected  void beforeInsert(Connection connection, Table table)
          Allows platforms to issue statements directly before rows are inserted into the specified table.
protected  void beforeUpdate(Connection connection, Table table)
          Allows platforms to issue statements directly before rows are updated in the specified table.
protected  Object extractColumnValue(ResultSet resultSet, String columnName, int columnIdx, int jdbcType)
          This is the core method to retrieve a value for a column from a result set.
 List fetch(Database model, String sql, Collection parameters, Table[] queryHints, int start, int end)
          Queries for a list of dyna beans representing rows of the given query. In contrast to the Platform.query(Database, String, Collection, Table[]) method all beans will be materialized and the connection will be closed before returning the beans. Also, the two int parameters specify which rows of the result set to use. If there are more rows than desired, they will be ignored (and not read from the database).
 List fetch(Database model, String sql, Table[] queryHints, int start, int end)
          Queries for a list of dyna beans representing rows of the given query. In contrast to the Platform.query(Database, String, Table[]) method all beans will be materialized and the connection will be closed before returning the beans. Also, the two int parameters specify which rows of the result set to use. If there are more rows than desired, they will be ignored (and not read from the database).
 String getName()
          Returns the name of the database that this platform is for.
 Iterator query(Database model, String sql, Collection parameters, Table[] queryHints)
          Performs the given parameterized SQL query returning an iterator over the results.
 Iterator query(Database model, String sql, Table[] queryHints)
          Performs the given SQL query returning an iterator over the results.
protected  void setStatementParameterValue(PreparedStatement statement, int sqlIndex, int typeCode, Object value)
          This is the core method to set the parameter of a prepared statement to a given value.
 
Methods inherited from class org.apache.ddlutils.platform.PlatformImplBase
alterTables, alterTables, alterTables, alterTables, alterTables, alterTables, alterTables, alterTables, createDatabase, createDeleteSql, createInsertSql, createResultSetIterator, createSelectLastInsertIdSql, createTables, createTables, createTables, createTables, createUpdateSql, delete, delete, dropDatabase, dropTable, dropTable, dropTables, dropTables, evaluateBatch, evaluateBatch, exists, fetch, fetch, fetch, fetch, fetch, fetch, getAlterTablesSql, getAlterTablesSql, getAlterTablesSql, getAlterTablesSql, getAlterTablesSql, getAlterTablesSql, getAlterTablesSql, getAlterTablesSql, getCreateTablesSql, getCreateTablesSql, getDeleteSql, getDropTableSql, getDropTablesSql, getInsertSql, getLog, getModelReader, getObjectFromResultSet, getObjectFromResultSet, getPlatformInfo, getSqlBuilder, getUpdateSql, insert, insert, insert, insert, isDelimitedIdentifierModeOn, isForeignKeysSorted, isIdentityOverrideOn, isScriptModeOn, isSqlCommentsOn, logWarnings, postprocessModelFromDatabase, query, query, readModelFromDatabase, readModelFromDatabase, readModelFromDatabase, readModelFromDatabase, setDelimitedIdentifierModeOn, setForeignKeysSorted, setIdentityOverrideOn, setModelReader, setObject, setScriptModeOn, setSqlBuilder, setSqlCommentsOn, shutdownDatabase, shutdownDatabase, store, toColumnValues, update, update
 
Methods inherited from class org.apache.ddlutils.util.JdbcSupport
borrowConnection, closeStatement, getDataSource, getPassword, getUsername, returnConnection, setDataSource, setPassword, setUsername
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ddlutils.Platform
borrowConnection, getDataSource, getPassword, getUsername, returnConnection, setDataSource, setPassword, setUsername
 

Field Detail

DATABASENAME

public static final String DATABASENAME
Database name of this platform.

See Also:
Constant Field Values

JDBC_DRIVER

public static final String JDBC_DRIVER
The standard Sybase jdbc driver.

See Also:
Constant Field Values

JDBC_DRIVER_OLD

public static final String JDBC_DRIVER_OLD
The old Sybase jdbc driver.

See Also:
Constant Field Values

JDBC_SUBPROTOCOL

public static final String JDBC_SUBPROTOCOL
The subprotocol used by the standard Sybase driver.

See Also:
Constant Field Values

MAX_TEXT_SIZE

public static final long MAX_TEXT_SIZE
The maximum size that text and binary columns can have.

See Also:
Constant Field Values
Constructor Detail

SybasePlatform

public SybasePlatform()
Creates a new platform instance.

Method Detail

getName

public String getName()
Returns the name of the database that this platform is for.

Returns:
The name

extractColumnValue

protected Object extractColumnValue(ResultSet resultSet,
                                    String columnName,
                                    int columnIdx,
                                    int jdbcType)
                             throws DatabaseOperationException,
                                    SQLException
This is the core method to retrieve a value for a column from a result set. Its primary purpose is to call the appropriate method on the result set, and to provide an extension point where database-specific implementations can change this behavior.

Overrides:
extractColumnValue in class PlatformImplBase
Parameters:
resultSet - The result set to extract the value from
columnName - The name of the column; can be null in which case the columnIdx will be used instead
columnIdx - The index of the column's value in the result set; is only used if columnName is null
jdbcType - The jdbc type to extract
Returns:
The value
Throws:
SQLException - If an error occurred while accessing the result set
DatabaseOperationException

setStatementParameterValue

protected void setStatementParameterValue(PreparedStatement statement,
                                          int sqlIndex,
                                          int typeCode,
                                          Object value)
                                   throws SQLException
This is the core method to set the parameter of a prepared statement to a given value. The primary purpose of this method is to call the appropriate method on the statement, and to give database-specific implementations the ability to change this behavior.

Overrides:
setStatementParameterValue in class PlatformImplBase
Parameters:
statement - The statement
sqlIndex - The parameter index
typeCode - The JDBC type code
value - The value
Throws:
SQLException - If an error occurred while setting the parameter value

fetch

public List fetch(Database model,
                  String sql,
                  Collection parameters,
                  Table[] queryHints,
                  int start,
                  int end)
           throws DatabaseOperationException
Queries for a list of dyna beans representing rows of the given query. In contrast to the Platform.query(Database, String, Collection, Table[]) method all beans will be materialized and the connection will be closed before returning the beans. Also, the two int parameters specify which rows of the result set to use. If there are more rows than desired, they will be ignored (and not read from the database).

Specified by:
fetch in interface Platform
Overrides:
fetch in class PlatformImplBase
Parameters:
model - The database model to use
sql - The parameterized sql query
parameters - The parameter values
queryHints - The tables that are queried (optional)
start - Row number to start from (0 for first row)
end - Row number to stop at (inclusively; -1 for last row)
Returns:
The dyna beans resulting from the query
Throws:
DatabaseOperationException

fetch

public List fetch(Database model,
                  String sql,
                  Table[] queryHints,
                  int start,
                  int end)
           throws DatabaseOperationException
Queries for a list of dyna beans representing rows of the given query. In contrast to the Platform.query(Database, String, Table[]) method all beans will be materialized and the connection will be closed before returning the beans. Also, the two int parameters specify which rows of the result set to use. If there are more rows than desired, they will be ignored (and not read from the database).

Specified by:
fetch in interface Platform
Overrides:
fetch in class PlatformImplBase
Parameters:
model - The database model to use
sql - The sql query
queryHints - The tables that are queried (optional)
start - Row number to start from (0 for first row)
end - Row number to stop at (inclusively; -1 for last row)
Returns:
The dyna beans resulting from the query
Throws:
DatabaseOperationException

query

public Iterator query(Database model,
                      String sql,
                      Collection parameters,
                      Table[] queryHints)
               throws DatabaseOperationException
Performs the given parameterized SQL query returning an iterator over the results.

Specified by:
query in interface Platform
Overrides:
query in class PlatformImplBase
Parameters:
model - The database model to use
sql - The sql query to perform
parameters - The query parameter values
queryHints - The tables that are queried (optional)
Returns:
An iterator for the dyna beans resulting from the query
Throws:
DatabaseOperationException

query

public Iterator query(Database model,
                      String sql,
                      Table[] queryHints)
               throws DatabaseOperationException
Performs the given SQL query returning an iterator over the results.

Specified by:
query in interface Platform
Overrides:
query in class PlatformImplBase
Parameters:
model - The database model to use
sql - The sql query to perform
queryHints - The tables that are queried (optional)
Returns:
An iterator for the dyna beans resulting from the query
Throws:
DatabaseOperationException

beforeInsert

protected void beforeInsert(Connection connection,
                            Table table)
                     throws SQLException
Allows platforms to issue statements directly before rows are inserted into the specified table.

Overrides:
beforeInsert in class PlatformImplBase
Parameters:
connection - The connection used for the insertion
table - The table that the rows are inserted into
Throws:
SQLException

afterInsert

protected void afterInsert(Connection connection,
                           Table table)
                    throws SQLException
Allows platforms to issue statements directly after rows have been inserted into the specified table.

Overrides:
afterInsert in class PlatformImplBase
Parameters:
connection - The connection used for the insertion
table - The table that the rows have been inserted into
Throws:
SQLException

beforeUpdate

protected void beforeUpdate(Connection connection,
                            Table table)
                     throws SQLException
Allows platforms to issue statements directly before rows are updated in the specified table.

Overrides:
beforeUpdate in class PlatformImplBase
Parameters:
connection - The connection used for the update
table - The table that the rows are updateed into
Throws:
SQLException

afterUpdate

protected void afterUpdate(Connection connection,
                           Table table)
                    throws SQLException
Allows platforms to issue statements directly after rows have been updated in the specified table.

Overrides:
afterUpdate in class PlatformImplBase
Parameters:
connection - The connection used for the update
table - The table that the rows have been updateed into
Throws:
SQLException


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.