borland Packages Class Hierarchy sql Package
com.borland.sql.SQLAdapter
Variables Methods
Implemented by RResult
The SQLAdapter
interface can be implemented by any JDBC class which can be adapted for improved performance. A JDBC class which implements this interface is said to be adaptable. An adaptation modifies the default behavior for a JDBC object by compromising standard JDBC behavior in favor of performance.
Certain JDBC driver classes may choose to implement this interface for enhanced performance with the JBuilder data set components. Currently, JBuilder only looks for ResultSet
adaptations. Future versions of JBuilder may be able to use this for other java.sql
package objects.
Here's an example adaptation of a result set object which instructs the driver to right trim CHAR string instances, and to avoid constructing multiple java.sql.Date
instances by reusing the first Date
container fetched on each subsequent fetch.
Statement s = c.createStatement (); ResultSet rs = s.executeQuery ("select NAME, BIRTHDAY from BIRTHDAYS"); SQLAdapter rsSQLAdapter = (SQLAdapter) rs; rsSQLAdapter.adapt (SQLAdapter.RIGHT_TRIM_STRINGS, null); rsSQLAdapter.adapt (SQLAdapter.SINGLE_INSTANCE_TIME, null); while (rs.next ()) { rs.getString ("NAME"); // no need to call trim() rs.getDate ("BIRTHDAY"); // The first Date object constructed is reused // and modified throughout the iterations. }
Additional modifiers may be added in future releases.
public final int RESETABLE_STREAMInstructs driver to ensure streams returned will reposition to 0 position on a binary field value when the
InputStream.reset()
method is called. Also expects that there is a separate instance for each binary value returned. If driver uses ByteArrayInputStream
, then it can return true. Return true if you support this. extraInfo
is always null.
public static final int RIGHT_TRIM_STRINGS = 1This modifier instructs an adaptable JDBC driver to create
String
instances with white space already trimmed from the end of the String
on calls to ResultSet.getString()
.
public static final int SINGLE_INSTANCE_TIME = 2This modifier instructs an adaptable JDBC driver to reuse a single instance of a Java Time/Date/Timestamp object on calls to
ResultSet.getDate()
, ResultSet.getTime()
and ResultSet.getTimestamp()
.
public boolean adapt(int modifier, Object extraInfo)Adapt the JDBC object which implements this interface to the modification described by one of the above modifiers. This method returns true if the modifier is supported, false otherwise. It throws an
SQLException
if the driver is unable to adapt to the modification.
modifier
extraInfo
public void revert(int modifier)Revert back to the default JDBC behavior for the object previously adapted for the modification described by the given modifier. This method throws an
SQLException
if the driver is unable to revert the modification back to the standard JDBC behavior.
modifier