public class DataHandler
extends java.lang.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(java.sql.PreparedStatement stmt,
int index,
PyObject object,
int type)
Handles checking if the object is null or None and setting it on the statement.
|
java.lang.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(java.sql.CallableStatement stmt,
int col,
int type)
Given a CallableStatement, column and type, return the appropriate
Jython object.
|
PyObject |
getPyObject(java.sql.ResultSet set,
int col,
int type)
Given a ResultSet, column and type, return the appropriate
Jython object.
|
PyObject |
getRowId(java.sql.Statement stmt)
Returns the row id of the last executed statement.
|
static DataHandler |
getSystemDataHandler()
Build the DataHandler chain depending on the VM.
|
void |
postExecute(java.sql.Statement stmt)
A callback after successfully executing the statement.
|
void |
preExecute(java.sql.Statement stmt)
A callback prior to each execution of the statement.
|
static byte[] |
read(java.io.InputStream stream)
Consume the InputStream into an byte array and close the InputStream.
|
static java.lang.String |
read(java.io.Reader reader)
Consume the Reader into a String and close the Reader.
|
void |
registerOut(java.sql.CallableStatement statement,
int index,
int colType,
int dataType,
java.lang.String dataTypeName)
Called when a stored procedure or function is executed and OUT parameters
need to be registered with the statement.
|
void |
setJDBCObject(java.sql.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(java.sql.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.
|
java.lang.String |
toString()
Returns the classname of this datahandler.
|
public java.lang.String getMetaDataName(PyObject name)
public Procedure getProcedure(PyCursor cursor, PyObject name) throws java.sql.SQLException
cursor - an open cursorname - the name of the procedure to invokejava.sql.SQLExceptionpublic PyObject getRowId(java.sql.Statement stmt) throws java.sql.SQLException
stmt - the current statementjava.sql.SQLException - thrown if an exception occurspublic void preExecute(java.sql.Statement stmt)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void postExecute(java.sql.Statement stmt)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void setJDBCObject(java.sql.PreparedStatement stmt,
int index,
PyObject object)
throws java.sql.SQLException
stmt - the current PreparedStatementindex - the index for which this object is boundobject - the PyObject in questionjava.sql.SQLExceptionpublic void setJDBCObject(java.sql.PreparedStatement stmt,
int index,
PyObject object,
int type)
throws java.sql.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 boundjava.sql.SQLExceptionpublic PyObject getPyObject(java.sql.ResultSet set, int col, int type) throws java.sql.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 typejava.sql.SQLException - if the type is unmappablepublic PyObject getPyObject(java.sql.CallableStatement stmt, int col, int type) throws java.sql.SQLException
stmt - the CallableStatementcol - the column number (adjusted properly for JDBC)type - the column typejava.sql.SQLException - if the type is unmappablepublic void registerOut(java.sql.CallableStatement statement,
int index,
int colType,
int dataType,
java.lang.String dataTypeName)
throws java.sql.SQLException
statement - index - the JDBC offset column numbercolType - the column as from DatabaseMetaData (eg, procedureColumnOut)dataType - the JDBC datatype from TypesdataTypeName - the JDBC datatype namejava.sql.SQLExceptionpublic static final boolean checkNull(java.sql.PreparedStatement stmt,
int index,
PyObject object,
int type)
throws java.sql.SQLException
java.sql.SQLExceptionpublic static final byte[] read(java.io.InputStream stream)
public static java.lang.String read(java.io.Reader reader)
public static final DataHandler getSystemDataHandler()
public PyObject __chain__()
public java.lang.String toString()
toString in class java.lang.Object