Message737
There is a problem with the way that SQLWarnings are
added in PyCursor.addWarning(SQLWarning).
The existing code is:
PyTuple warn = new PyTuple();
// there are three parts: (reason, state, vendorCode)
warn.__add__(Py.java2py(warning.getMessage()));
warn.__add__(Py.java2py(warning.getSQLState()));
warn.__add__(Py.newInteger(warning.getErrorCode()));
However, PyTuple.__add__(PyObject) silently ignores
any object that is not another PyTuple instance. This
means that whilst there is an entry in the PyList for
each warning, the tuple has a zero length and the
warnings are effectively lost.
The fix is to replace the above code to use the PyTuple
constructor that allows an array to be passed:
PyObject[] msg = new PyObject[] {
// there are three parts: (reason, state, vendorCode)
Py.java2py(warning.getMessage()),
Py.java2py(warning.getSQLState()),
Py.newInteger(warning.getErrorCode())
};
PyTuple warn = new PyTuple(msg);
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:09 | admin | link | issue609505 messages |
2008-02-20 17:17:09 | admin | create | |
|