* @return PyObject
* @throws SQLException
*/
protected PyObject createResults(CallableStatement callableStatement, Procedure procedure,
PyObject params) throws SQLException {
PyList results = new PyList();
for (int i = 0, j = 0, len = procedure.columns.__len__(); i < len; i++) {
PyObject obj = Py.None;
PyObject column = procedure.columns.__getitem__(i);
int colType = column.__getitem__(Procedure.COLUMN_TYPE).asInt();
int dataType = column.__getitem__(Procedure.DATA_TYPE).asInt();
switch (colType) {
case DatabaseMetaData.procedureColumnIn:
j++;
break;
case DatabaseMetaData.procedureColumnOut:
case DatabaseMetaData.procedureColumnInOut:
obj = datahandler.getPyObject(callableStatement, i + 1, dataType);
params.__setitem__(j++, obj);
break;
case DatabaseMetaData.procedureColumnReturn:
obj = datahandler.getPyObject(callableStatement, i + 1, dataType);
// Oracle sends ResultSets as a return value
Object rs = obj.__tojava__(ResultSet.class);
if (rs == Py.NoConversion) {
results.append(obj);
} else {
add((ResultSet) rs);
}
break;
}
}
if (results.__len__() == 0) {
return results;
}
PyList ret = new PyList();
ret.append(PyTuple.fromIterable(results));
return ret;
}