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
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
 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.
 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)
          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.util.Vector getSchemaList(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
 java.lang.String getVersion()
          Gets a string describing the version of this implentation of this interface.
 boolean isCharType(int type)
          Tests if a type is character
 boolean isNumericType(int type)
          Tests if a type is numeric.
 boolean isStreamType(int sqlTypeId)
          Provides streaming support.
 void populateJboTypeMapEntries()
          Populates the system typemap table with entries appropriate for the JDBC implementation.
 

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" and "OLite"

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.

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.

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

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)

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
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 <>


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

Business Components