Business Components

oracle.jbo.server
Interface SQLBuilder

All Known Implementing Classes:
BaseSQLBuilderImpl

public interface SQLBuilder

Internal: Applications should not use this interface.

Note: This interface is subject to change.

This interface is used by View Objects to construct SQL statements that create, retrieve, update and delete table rows based on the state of the cache.

Since:
JDeveloper 3.0

Field Summary
TypeField
static int BINDING_STYLE_JDBC
           
static int BINDING_STYLE_ORACLE
           
static int BINDING_STYLE_UNKNOWN
           
static int DML_DELETE
           
static int DML_INSERT
           
static int DML_UPDATE
           
 
Method Summary
TypeMethod
 void doEntityDML(EntityImpl enrt, int operation, TransactionEvent e)
          Performs the appropriate SQL Data Manipulation Language (DML) operations on the database to reflect an update, delete or insert operation on an Entity Object.
 void doEntitySelect(EntityImpl e, boolean lock)
          Perform the appropriate SQL operations to execute a select operation on an Entity Object.
 java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs, int attrIndex, java.sql.ResultSet rs, int rsIndex, DBTransactionImpl trans)
          Loads an array of objects from a result set.
 java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, byte attrLoad, java.sql.ResultSet rs, int index, DBTransactionImpl trans)
          Loads an object from a result set.
 java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, java.sql.PreparedStatement ps, int index, Transaction trans)
          Loads an object from a result set.
 void doPreparedStatementDefineColumnType(java.sql.PreparedStatement ps, int colnum, int sqltype)
          Performs the equivalent of defineColumnType() on a prepared statement.
 void doPreparedStatementDefines(java.sql.PreparedStatement ps, AttributeDefImpl[] attrs)
          Performs the equivalent of clearDefines() on a prepared statement.
 void doRegisterDefaultDriver()
          Registers the JDBC driver associated with this type of JDBC connection.
 void doStatementSetBindingStyle(java.sql.Statement ps, int bindingStyle)
          Sets the binding style for the statement.
 void doStatementSetBindingStyleDefault(java.sql.Statement ps)
           
 void doStatementSetRowPrefetch(java.sql.Statement ps, int prefetchSize)
          Performs the equivalent of setRowPrefetch() on a statement.
 void executeBatch(java.sql.PreparedStatement stmt)
           
 java.lang.Object generatePKBasedRef(EntityImpl entityContext)
          Generates a PK-Based REF for an Entity Object.
 java.lang.Object[] generateRefAndOID(EntityImpl e)
          Generates an object Ref and OID for an Entity Object.
 java.lang.Object generateRowID(EntityImpl e)
          Generates a ROWID for an Entity Object.
 java.lang.String getBaseTable(java.sql.Connection conn, java.lang.String schema, java.lang.String name)
          unroll any synonyms that may be present, and get the real objectname
 java.util.Vector getConstraints(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table)
           
 com.sun.java.util.collections.ArrayList getConstraintsList(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table)
          return vector of with constraint details for this table where each detail is in a String array with this structure: 0 String owner
 java.lang.String getDbType()
          returns a string uniquely identifying this type of SQLBuilder.
 int getDefaultBindingStyle()
          returns a constant identifying the best binding style for this sort of SQL (see the BINDINGSTYLE constants)
 java.lang.String getPersistManagerClassName()
          Returns the name of default PersistManager class name.
 java.util.Vector getSchemaList(java.sql.Connection conn)
          return a list of schemas for this database (note that for Oracle this is synonymous with users)
 com.sun.java.util.collections.ArrayList getSchemas(java.sql.Connection conn)
          return a list of schemas for this database (note that for Oracle this is synonymous with users)
 java.util.Vector getTableList(java.sql.Connection conn, java.lang.String defaultUserName, java.lang.String userName, boolean bTable, boolean bAlias, boolean bView, boolean bSnap)
          return a list of tables visible in this connection
 com.sun.java.util.collections.ArrayList getTables(java.sql.Connection conn, java.lang.String defaultUserName, java.lang.String userName, boolean bTable, boolean bAlias, boolean bView, boolean bSnap)
          return a list of tables visible in this connection
 java.lang.String getTypeMapName()
          Returns a String identifying the preferred type map to use.
 java.lang.String getVersion()
          Gets a string describing the version of this implentation of this interface.
 ViewCriteriaAdapter getViewCriteriaAdapter()
           
 boolean isCharType(int type)
          Tests if a type is character
 boolean isDataSourceJTABased(javax.sql.DataSource ds)
           
 boolean isNumericType(int type)
          Tests if a type is numeric.
 boolean isStreamType(int sqlTypeId)
          Provides streaming support.
 javax.sql.DataSource lookupDataSource(java.lang.String nsUrl, java.lang.String nsUser, java.lang.String nsPasswd, java.lang.String dataSourceName)
           
 void populateJboTypeMapEntries()
          Populates the system typemap table with entries appropriate for the JDBC implementation.
 void releaseSavepoint(java.sql.Connection conn, java.lang.String id)
          release SAVEPOINT - if possible
 void rollbackToSavepoint(java.sql.Connection conn, java.lang.String id)
          rollback to SAVEPOINT - if possible
 void setSavepoint(java.sql.Connection conn, java.lang.String id)
          issue a SAVEPOINT - if possible
 

Field Detail

DML_INSERT

public static final int DML_INSERT

DML_UPDATE

public static final int DML_UPDATE

DML_DELETE

public static final int DML_DELETE

BINDING_STYLE_UNKNOWN

public static final int BINDING_STYLE_UNKNOWN

BINDING_STYLE_JDBC

public static final int BINDING_STYLE_JDBC

BINDING_STYLE_ORACLE

public static final int BINDING_STYLE_ORACLE
Method Detail

getVersion

public java.lang.String getVersion()
Gets a string describing the version of this implentation of this interface.

getDbType

public java.lang.String getDbType()
returns a string uniquely identifying this type of SQLBuilder. Examples are: "Oracle", "OLite", "SQL92"

getTypeMapName

public java.lang.String getTypeMapName()
Returns a String identifying the preferred type map to use.

getPersistManagerClassName

public java.lang.String getPersistManagerClassName()
Returns the name of default PersistManager class name.

getDefaultBindingStyle

public int getDefaultBindingStyle()
returns a constant identifying the best binding style for this sort of SQL (see the BINDINGSTYLE constants)

doRegisterDefaultDriver

public void doRegisterDefaultDriver()
                             throws java.sql.SQLException
Registers the JDBC driver associated with this type of JDBC connection.
Throws:
java.sql.SQLException -  

doEntityDML

public void doEntityDML(EntityImpl enrt,
                        int operation,
                        TransactionEvent e)
Performs the appropriate SQL Data Manipulation Language (DML) operations on the database to reflect an update, delete or insert operation on an Entity Object.

Note: this method is subject to change.

Parameters:
enrt - the Entity Object.
operation - one of DML_INSERT, DML_UPDATE, or DML_DELETE.
e - the transaction.

doEntitySelect

public void doEntitySelect(EntityImpl e,
                           boolean lock)
Perform the appropriate SQL operations to execute a select operation on an Entity Object.

Note: this method is subject to change.

Parameters:
enrt - the Entity Object.
lock - if true, a "SELECT for UPDATE" statement is used.

doStatementSetRowPrefetch

public void doStatementSetRowPrefetch(java.sql.Statement ps,
                                      int prefetchSize)
                               throws java.sql.SQLException
Performs the equivalent of setRowPrefetch() on a statement.

doStatementSetBindingStyle

public void doStatementSetBindingStyle(java.sql.Statement ps,
                                       int bindingStyle)
Sets the binding style for the statement.

doStatementSetBindingStyleDefault

public void doStatementSetBindingStyleDefault(java.sql.Statement ps)

doPreparedStatementDefineColumnType

public void doPreparedStatementDefineColumnType(java.sql.PreparedStatement ps,
                                                int colnum,
                                                int sqltype)
                                         throws java.sql.SQLException
Performs the equivalent of defineColumnType() on a prepared statement.

doPreparedStatementDefines

public void doPreparedStatementDefines(java.sql.PreparedStatement ps,
                                       AttributeDefImpl[] attrs)
Performs the equivalent of clearDefines() on a prepared statement.

populateJboTypeMapEntries

public void populateJboTypeMapEntries()
Populates the system typemap table with entries appropriate for the JDBC implementation.

isNumericType

public boolean isNumericType(int type)
Tests if a type is numeric.

isCharType

public boolean isCharType(int type)
Tests if a type is character

doLoadFromResultSet

public java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory,
                                            java.lang.Object theElemFactory,
                                            java.lang.Class theJavaType,
                                            byte attrLoad,
                                            java.sql.ResultSet rs,
                                            int index,
                                            DBTransactionImpl trans)
                                     throws DataCreationException
Loads an object from a result set.

Note: this method is subject to change.

Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
index - the index of the object to be loaded.

doLoadBulkFromResultSet

public java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs,
                                                  int attrIndex,
                                                  java.sql.ResultSet rs,
                                                  int rsIndex,
                                                  DBTransactionImpl trans)
                                           throws DataCreationException
Loads an array of objects from a result set.

Note: this method is subject to change.

Parameters:
index - the index of the object to be loaded.

doLoadFromStatement

public java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory,
                                            java.lang.Object theElemFactory,
                                            java.lang.Class theJavaType,
                                            java.sql.PreparedStatement ps,
                                            int index,
                                            Transaction trans)
                                     throws DataCreationException
Loads an object from a result set.

Note: this method is subject to change.

Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
index - the index of the object to be loaded.

setSavepoint

public void setSavepoint(java.sql.Connection conn,
                         java.lang.String id)
                  throws java.sql.SQLException
issue a SAVEPOINT - if possible

Parameters:
id - = the id for a savepoint

rollbackToSavepoint

public void rollbackToSavepoint(java.sql.Connection conn,
                                java.lang.String id)
                         throws java.sql.SQLException
rollback to SAVEPOINT - if possible

Parameters:
id - = the id for a savepoint

releaseSavepoint

public void releaseSavepoint(java.sql.Connection conn,
                             java.lang.String id)
                      throws java.sql.SQLException
release SAVEPOINT - if possible

Parameters:
id - = the id for a savepoint

generateRowID

public java.lang.Object generateRowID(EntityImpl e)
Generates a ROWID for an Entity Object.


generatePKBasedRef

public java.lang.Object generatePKBasedRef(EntityImpl entityContext)
Generates a PK-Based REF for an Entity Object. This is used for an object table.

generateRefAndOID

public java.lang.Object[] generateRefAndOID(EntityImpl e)
Generates an object Ref and OID for an Entity Object. This is used for an object table.

isStreamType

public boolean isStreamType(int sqlTypeId)
Provides streaming support.

getTables

public com.sun.java.util.collections.ArrayList getTables(java.sql.Connection conn,
                                                         java.lang.String defaultUserName,
                                                         java.lang.String userName,
                                                         boolean bTable,
                                                         boolean bAlias,
                                                         boolean bView,
                                                         boolean bSnap)
                                                  throws java.lang.Exception
return a list of tables visible in this connection

getTableList

public java.util.Vector getTableList(java.sql.Connection conn,
                                     java.lang.String defaultUserName,
                                     java.lang.String userName,
                                     boolean bTable,
                                     boolean bAlias,
                                     boolean bView,
                                     boolean bSnap)
                              throws java.lang.Exception
return a list of tables visible in this connection

getSchemas

public com.sun.java.util.collections.ArrayList getSchemas(java.sql.Connection conn)
                                                   throws java.lang.Exception
return a list of schemas for this database (note that for Oracle this is synonymous with users)

getSchemaList

public java.util.Vector getSchemaList(java.sql.Connection conn)
                               throws java.lang.Exception
return a list of schemas for this database (note that for Oracle this is synonymous with users)

getConstraintsList

public com.sun.java.util.collections.ArrayList getConstraintsList(java.sql.Connection conn,
                                                                  java.lang.String catalog,
                                                                  java.lang.String schema,
                                                                  java.lang.String table)
                                                           throws java.sql.SQLException
return vector of with constraint details for this table where each detail is in a String array with this structure: 0 String owner

1 String constraint_name

2 String constraint_type

3 String table_name

4 String search_condition

5 Integer delete_rule (cascade)

6 Integer status (enabled)

7 Integerdeferrable

8 Integer deferred

9 Integer validated

10 String column_name

11 Integer position

12 String fkname

13 String fkother <>


getConstraints

public java.util.Vector getConstraints(java.sql.Connection conn,
                                       java.lang.String catalog,
                                       java.lang.String schema,
                                       java.lang.String table)
                                throws java.sql.SQLException

getBaseTable

public java.lang.String getBaseTable(java.sql.Connection conn,
                                     java.lang.String schema,
                                     java.lang.String name)
                              throws java.sql.SQLException
unroll any synonyms that may be present, and get the real objectname

executeBatch

public void executeBatch(java.sql.PreparedStatement stmt)
                  throws java.sql.SQLException

lookupDataSource

public javax.sql.DataSource lookupDataSource(java.lang.String nsUrl,
                                             java.lang.String nsUser,
                                             java.lang.String nsPasswd,
                                             java.lang.String dataSourceName)
                                      throws JboException

isDataSourceJTABased

public boolean isDataSourceJTABased(javax.sql.DataSource ds)

getViewCriteriaAdapter

public ViewCriteriaAdapter getViewCriteriaAdapter()

Business Components