public class DataHandler extends Object
| Constructor and Description | 
|---|
| DataHandler()Handle most generic Java data types. | 
| Modifier and Type | Method and Description | 
|---|---|
| PyObject | __chain__()Returns a list of datahandlers chained together through the use of delegation. | 
| static boolean | checkNull(PreparedStatement stmt,
         int index,
         PyObject object,
         int type)Handles checking if the object is null or None and setting it on the statement. | 
| String | getMetaDataName(PyObject name)Some database vendors are case sensitive on calls to DatabaseMetaData,
 most notably Oracle. | 
| Procedure | getProcedure(PyCursor cursor,
            PyObject name)A factory method for determing the correct procedure class to use
 per the cursor type. | 
| PyObject | getPyObject(CallableStatement stmt,
           int col,
           int type)Given a CallableStatement, column and type, return the appropriate
 Jython object. | 
| PyObject | getPyObject(ResultSet set,
           int col,
           int type)Given a ResultSet, column and type, return the appropriate
 Jython object. | 
| PyObject | getRowId(Statement stmt)Returns the row id of the last executed statement. | 
| static DataHandler | getSystemDataHandler()Build the DataHandler chain depending on the VM. | 
| void | postExecute(Statement stmt)A callback after successfully executing the statement. | 
| void | preExecute(Statement stmt)A callback prior to each execution of the statement. | 
| static byte[] | read(InputStream stream)Consume the InputStream into an byte array and close the InputStream. | 
| static String | read(Reader reader)Consume the Reader into a String and close the Reader. | 
| void | registerOut(CallableStatement statement,
           int index,
           int colType,
           int dataType,
           String dataTypeName)Called when a stored procedure or function is executed and OUT parameters
 need to be registered with the statement. | 
| void | setJDBCObject(PreparedStatement stmt,
             int index,
             PyObject object)Any .execute() which uses prepared statements will receive a callback for deciding
 how to map the PyObject to the appropriate JDBC type. | 
| void | setJDBCObject(PreparedStatement stmt,
             int index,
             PyObject object,
             int type)Any .execute() which uses prepared statements will receive a callback for deciding
 how to map the PyObject to the appropriate JDBC type. | 
| String | toString()Returns the classname of this datahandler. | 
public String getMetaDataName(PyObject name)
public Procedure getProcedure(PyCursor cursor, PyObject name) throws SQLException
cursor - an open cursorname - the name of the procedure to invokeSQLExceptionpublic PyObject getRowId(Statement stmt) throws SQLException
stmt - the current statementSQLException - thrown if an exception occurspublic void preExecute(Statement stmt) throws SQLException
SQLExceptionpublic void postExecute(Statement stmt) throws SQLException
SQLExceptionpublic void setJDBCObject(PreparedStatement stmt, int index, PyObject object) throws SQLException
stmt - the current PreparedStatementindex - the index for which this object is boundobject - the PyObject in questionSQLExceptionpublic void setJDBCObject(PreparedStatement stmt, int index, PyObject object, int type) throws SQLException
stmt - the current PreparedStatementindex - the index for which this object is boundobject - the PyObject in questiontype - the java.sql.Types for which this PyObject should be boundSQLExceptionpublic PyObject getPyObject(ResultSet set, int col, int type) throws SQLException
Note: DO NOT iterate the ResultSet.
set - the current ResultSet set to the current rowcol - the column number (adjusted properly for JDBC)type - the column typeSQLException - if the type is unmappablepublic PyObject getPyObject(CallableStatement stmt, int col, int type) throws SQLException
stmt - the CallableStatementcol - the column number (adjusted properly for JDBC)type - the column typeSQLException - if the type is unmappablepublic void registerOut(CallableStatement statement, int index, int colType, int dataType, String dataTypeName) throws SQLException
statement - index - the JDBC offset column numbercolType - the column as from DatabaseMetaData (eg, procedureColumnOut)dataType - the JDBC datatype from TypesdataTypeName - the JDBC datatype nameSQLExceptionpublic static final boolean checkNull(PreparedStatement stmt, int index, PyObject object, int type) throws SQLException
SQLExceptionpublic static final byte[] read(InputStream stream)
public static String read(Reader reader)
public static final DataHandler getSystemDataHandler()
public PyObject __chain__()