예제 #1
0
  /** Provide functionality for Oracle specific types, such as ROWID. */
  public PyObject getPyObject(ResultSet set, int col, int type) throws SQLException {

    PyObject obj = Py.None;

    switch (type) {
      case Types.BLOB:
        BLOB blob = ((OracleResultSet) set).getBLOB(col);

        if (blob == null) {
          return Py.None;
        }

        InputStream stream = new BufferedInputStream(blob.getBinaryStream());

        obj = Py.java2py(DataHandler.read(stream));
        break;

      case OracleTypes.ROWID:
        ROWID rowid = ((OracleResultSet) set).getROWID(col);

        if (rowid != null) {
          obj = Py.java2py(rowid.stringValue());
        }
        break;

      default:
        obj = super.getPyObject(set, col, type);
    }

    return (set.wasNull() ? Py.None : obj);
  }