| java.lang.Object org.python.core.PyObject com.ziclix.python.sql.PyCursor
All known Subclasses: com.ziclix.python.sql.PyExtendedCursor,
PyCursor | public class PyCursor extends PyObject implements ClassDictInit,WarningListener(Code) | | These objects represent a database cursor, which is used to manage the
context of a fetch operation.
author: brian zimmer author: last revised by $Author: cgroves $ version: $Revision: 3248 $ |
Constructor Summary | |
| PyCursor(PyConnection connection) Create the cursor with a static fetch. | | PyCursor(PyConnection connection, boolean dynamicFetch) Create the cursor, optionally choosing the type of fetch (static or dynamic). | | PyCursor(PyConnection connection, boolean dynamicFetch, PyObject rsType, PyObject rsConcur) Create the cursor, optionally choosing the type of fetch (static or dynamic). |
Method Summary | |
public void | __del__() Delete the cursor. | public PyObject | __findattr__(String name) Gets the value of the attribute name. | public PyObject | __iter__() Returns an iteratable object. | public PyObject | __iternext__() Return the next element of the sequence that this is an iterator
for. | public void | __setattr__(String name, PyObject value) Sets the attribute name to value. | public void | callproc(PyObject name, PyObject params, PyObject bindings, PyObject maxRows) This method is optional since not all databases provide stored procedures.
Call a stored database procedure with the given name. | public static void | classDictInit(PyObject dict) Initializes the object's namespace. | protected void | clear() Resets the cursor state. | public void | close() Close the cursor now (rather than whenever __del__ is called). | public void | execute(PyObject sql, PyObject params, PyObject bindings, PyObject maxRows) Prepare and execute a database operation (query or command).
Parameters may be provided as sequence or mapping and will
be bound to variables in the operation. | protected void | execute(PyObject params, PyObject bindings) Execute the current sql statement. | public void | executemany(PyObject sql, PyObject params, PyObject bindings, PyObject maxRows) Prepare a database operation (query or command) and then execute it against all
parameter sequences or mappings found in the sequence seq_of_parameters. | public PyObject | fetchall() Fetch all (remaining) rows of a query result, returning them as a sequence
of sequences (e.g. | public PyObject | fetchmany(int size) Fetch the next set of rows of a query result, returning a sequence of
sequences (e.g. | public PyObject | fetchone() Fetch the next row of a query result set, returning a single sequence,
or None when no more data is available. | public DataHandler | getDataHandler() Return the currently bound DataHandler. | protected DatabaseMetaData | getMetaData() Return ths DatabaseMetaData for the current connection. | protected PyClass | getPyClass() | public static boolean | hasParams(PyObject params) | public static boolean | isSeq(PyObject object) | public static boolean | isSeqSeq(PyObject object) | public PyObject | next() Returns the next row from the currently executing SQL statement
using the same semantics as .fetchone(). | public PyObject | nextset() Move the result pointer to the next set if available. | public PyStatement | prepare(PyObject sql) Prepare a sql statement for later execution.
Parameters: sql - The sql string to be prepared. | public void | scroll(int value, String mode) Scroll the cursor in the result set to a new position according
to mode.
If mode is 'relative' (default), value is taken as offset to
the current position in the result set, if set to 'absolute',
value states an absolute target position.
An IndexError should be raised in case a scroll operation would
leave the result set. | public String | toString() String representation of the object. | public void | warning(WarningEvent event) Adds a warning to the tuple and will follow the chain as necessary. |
__members__ | protected static PyList __members__(Code) | | Field __members__
|
__methods__ | protected static PyList __methods__(Code) | | Field __methods__
|
arraysize | protected int arraysize(Code) | | Field arraysize
|
dynamicFetch | protected boolean dynamicFetch(Code) | | Field dynamicFetch
|
softspace | protected int softspace(Code) | | Field softspace
|
PyCursor | PyCursor(PyConnection connection)(Code) | | Create the cursor with a static fetch.
Parameters: connection - |
PyCursor | PyCursor(PyConnection connection, boolean dynamicFetch)(Code) | | Create the cursor, optionally choosing the type of fetch (static or dynamic).
If dynamicFetch is true, then use a dynamic fetch.
Parameters: connection - Parameters: dynamicFetch - |
PyCursor | PyCursor(PyConnection connection, boolean dynamicFetch, PyObject rsType, PyObject rsConcur)(Code) | | Create the cursor, optionally choosing the type of fetch (static or dynamic).
If dynamicFetch is true, then use a dynamic fetch.
rsType and rsConcur are used to create the Statement if both are non-None
Parameters: connection - Parameters: dynamicFetch - Parameters: rsType - Parameters: rsConcur - |
__del__ | public void __del__()(Code) | | Delete the cursor.
|
__findattr__ | public PyObject __findattr__(String name)(Code) | | Gets the value of the attribute name.
Parameters: name - the attribute for the given name |
__iter__ | public PyObject __iter__()(Code) | | Returns an iteratable object.
PyObject since: Jython 2.2, DB API 2.0+ |
__iternext__ | public PyObject __iternext__()(Code) | | Return the next element of the sequence that this is an iterator
for. Returns null when the end of the sequence is reached.
since: Jython 2.2 PyObject |
__setattr__ | public void __setattr__(String name, PyObject value)(Code) | | Sets the attribute name to value.
Parameters: name - Parameters: value - |
callproc | public void callproc(PyObject name, PyObject params, PyObject bindings, PyObject maxRows)(Code) | | This method is optional since not all databases provide stored procedures.
Call a stored database procedure with the given name. The sequence of parameters
must contain one entry for each argument that the procedure expects. The result of
the call is returned as modified copy of the input sequence. Input parameters are
left untouched, output and input/output parameters replaced with possibly new values.
The procedure may also provide a result set as output. This must then be made available
through the standard fetchXXX() methods.
Parameters: name - Parameters: params - Parameters: bindings - Parameters: maxRows - |
classDictInit | public static void classDictInit(PyObject dict)(Code) | | Initializes the object's namespace.
Parameters: dict - |
clear | protected void clear()(Code) | | Resets the cursor state. This includes flushing the warnings
and any previous results.
|
close | public void close()(Code) | | Close the cursor now (rather than whenever __del__ is called).
The cursor will be unusable from this point forward; an Error
(or subclass) exception will be raised if any operation is
attempted with the cursor.
|
execute | public void execute(PyObject sql, PyObject params, PyObject bindings, PyObject maxRows)(Code) | | Prepare and execute a database operation (query or command).
Parameters may be provided as sequence or mapping and will
be bound to variables in the operation. Variables are specified
in a database-specific notation (see the module's paramstyle
attribute for details).
A reference to the operation will be retained by the cursor.
If the same operation object is passed in again, then the cursor
can optimize its behavior. This is most effective for algorithms
where the same operation is used, but different parameters are
bound to it (many times).
For maximum efficiency when reusing an operation, it is best to
use the setinputsizes() method to specify the parameter types and
sizes ahead of time. It is legal for a parameter to not match the
predefined information; the implementation should compensate, possibly
with a loss of efficiency.
The parameters may also be specified as list of tuples to e.g. insert
multiple rows in a single operation, but this kind of usage is
deprecated: executemany() should be used instead.
Return values are not defined.
Parameters: sql - sql string or prepared statement Parameters: params - params for a prepared statement Parameters: bindings - dictionary of (param index : SQLType binding) Parameters: maxRows - integer value of max rows |
execute | protected void execute(PyObject params, PyObject bindings)(Code) | | Execute the current sql statement. Some generic functionality such
as updating the lastrowid and updatecount occur as well.
|
executemany | public void executemany(PyObject sql, PyObject params, PyObject bindings, PyObject maxRows)(Code) | | Prepare a database operation (query or command) and then execute it against all
parameter sequences or mappings found in the sequence seq_of_parameters.
Modules are free to implement this method using multiple calls to the execute()
method or by using array operations to have the database process the sequence as
a whole in one call.
The same comments as for execute() also apply accordingly to this method.
Return values are not defined.
Parameters: sql - Parameters: params - Parameters: bindings - Parameters: maxRows - |
fetchall | public PyObject fetchall()(Code) | | Fetch all (remaining) rows of a query result, returning them as a sequence
of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute
can affect the performance of this operation.
An Error (or subclass) exception is raised if the previous call to executeXXX()
did not produce any result set or no call was issued yet.
a sequence of sequences from the result set, or an empty sequence whenno more data is available |
fetchmany | public PyObject fetchmany(int size)(Code) | | Fetch the next set of rows of a query result, returning a sequence of
sequences (e.g. a list of tuples). An empty sequence is returned when
no more rows are available.
The number of rows to fetch per call is specified by the parameter. If
it is not given, the cursor's arraysize determines the number of rows
to be fetched. The method should try to fetch as many rows as indicated
by the size parameter. If this is not possible due to the specified number
of rows not being available, fewer rows may be returned.
An Error (or subclass) exception is raised if the previous call to executeXXX()
did not produce any result set or no call was issued yet.
Note there are performance considerations involved with the size parameter.
For optimal performance, it is usually best to use the arraysize attribute.
If the size parameter is used, then it is best for it to retain the same value
from one fetchmany() call to the next.
Parameters: size - a sequence of sequences from the result set, or an empty sequence whenno more data is available |
fetchone | public PyObject fetchone()(Code) | | Fetch the next row of a query result set, returning a single sequence,
or None when no more data is available.
An Error (or subclass) exception is raised if the previous call to
executeXXX() did not produce any result set or no call was issued yet.
a single sequence from the result set, or None when no more data is available |
getDataHandler | public DataHandler getDataHandler()(Code) | | Return the currently bound DataHandler.
DataHandler |
getPyClass | protected PyClass getPyClass()(Code) | | Method getPyClass
PyClass |
hasParams | public static boolean hasParams(PyObject params)(Code) | | Method hasParams
Parameters: params - boolean |
isSeq | public static boolean isSeq(PyObject object)(Code) | | Method isSeq
Parameters: object - true for any PyList, PyTuple or java.util.List |
isSeqSeq | public static boolean isSeqSeq(PyObject object)(Code) | | Method isSeqSeq
Parameters: object - true is a sequence of sequences |
next | public PyObject next()(Code) | | Returns the next row from the currently executing SQL statement
using the same semantics as .fetchone(). A StopIteration
exception is raised when the result set is exhausted for Python
versions 2.2 and later.
PyObject since: Jython 2.2, DB API 2.0+ |
nextset | public PyObject nextset()(Code) | | Move the result pointer to the next set if available.
true if more sets exist, else None |
prepare | public PyStatement prepare(PyObject sql)(Code) | | Prepare a sql statement for later execution.
Parameters: sql - The sql string to be prepared. A prepared statement usable with .executeXXX() |
scroll | public void scroll(int value, String mode)(Code) | | Scroll the cursor in the result set to a new position according
to mode.
If mode is 'relative' (default), value is taken as offset to
the current position in the result set, if set to 'absolute',
value states an absolute target position.
An IndexError should be raised in case a scroll operation would
leave the result set. In this case, the cursor position is left
undefined (ideal would be to not move the cursor at all).
Note: This method should use native scrollable cursors, if
available, or revert to an emulation for forward-only
scrollable cursors. The method may raise NotSupportedErrors to
signal that a specific operation is not supported by the
database (e.g. backward scrolling).
Parameters: value - Parameters: mode - |
toString | public String toString()(Code) | | String representation of the object.
a string representation of the object. |
warning | public void warning(WarningEvent event)(Code) | | Adds a warning to the tuple and will follow the chain as necessary.
Parameters: event - |
Methods inherited from org.python.core.PyObject | public PyObject __abs__()(Code)(Java Doc) public PyObject __add__(PyObject other)(Code)(Java Doc) public PyObject __and__(PyObject other)(Code)(Java Doc) public PyObject __call__(PyObject args, String keywords)(Code)(Java Doc) public PyObject __call__(PyObject arg1, PyObject args, String keywords)(Code)(Java Doc) public PyObject __call__(PyObject args)(Code)(Java Doc) public PyObject __call__()(Code)(Java Doc) public PyObject __call__(PyObject arg0)(Code)(Java Doc) public PyObject __call__(PyObject arg0, PyObject arg1)(Code)(Java Doc) public PyObject __call__(PyObject arg0, PyObject arg1, PyObject arg2)(Code)(Java Doc) public PyObject __call__(PyObject arg0, PyObject arg1, PyObject arg2, PyObject arg3)(Code)(Java Doc) public int __cmp__(PyObject other)(Code)(Java Doc) final public PyObject __coerce__(PyObject pyo)(Code)(Java Doc) public Object __coerce_ex__(PyObject o)(Code)(Java Doc) public PyComplex __complex__()(Code)(Java Doc) public boolean __contains__(PyObject o)(Code)(Java Doc) final public void __delattr__(PyString name)(Code)(Java Doc) public void __delattr__(String name)(Code)(Java Doc) public void __delete__(PyObject obj)(Code)(Java Doc) public void __delitem__(PyObject key)(Code)(Java Doc) public void __delitem__(String key)(Code)(Java Doc) public void __delslice__(PyObject s_start, PyObject s_stop, PyObject s_step)(Code)(Java Doc) public void __delslice__(PyObject start, PyObject stop)(Code)(Java Doc) public PyObject __dir__()(Code)(Java Doc) public PyObject __div__(PyObject other)(Code)(Java Doc) public PyObject __divmod__(PyObject other)(Code)(Java Doc) public PyObject __eq__(PyObject other)(Code)(Java Doc) final public PyObject __findattr__(PyString name)(Code)(Java Doc) public PyObject __findattr__(String name)(Code)(Java Doc) public PyObject __finditem__(PyObject key)(Code)(Java Doc) public PyObject __finditem__(int key)(Code)(Java Doc) public PyObject __finditem__(String key)(Code)(Java Doc) public PyFloat __float__()(Code)(Java Doc) public PyObject __floordiv__(PyObject other)(Code)(Java Doc) public PyObject __ge__(PyObject other)(Code)(Java Doc) public PyObject __get__(PyObject obj, PyObject type)(Code)(Java Doc) final public PyObject __getattr__(PyString name)(Code)(Java Doc) final public PyObject __getattr__(String name)(Code)(Java Doc) public PyObject __getitem__(int key)(Code)(Java Doc) public PyObject __getitem__(PyObject key)(Code)(Java Doc) public PyTuple __getnewargs__()(Code)(Java Doc) public PyObject __getslice__(PyObject s_start, PyObject s_stop, PyObject s_step)(Code)(Java Doc) public PyObject __getslice__(PyObject start, PyObject stop)(Code)(Java Doc) public PyObject __gt__(PyObject other)(Code)(Java Doc) final public PyInteger __hash__()(Code)(Java Doc) public PyString __hex__()(Code)(Java Doc) public PyObject __iadd__(PyObject other)(Code)(Java Doc) public PyObject __iand__(PyObject other)(Code)(Java Doc) public PyObject __idiv__(PyObject other)(Code)(Java Doc) public PyObject __idivmod__(PyObject other)(Code)(Java Doc) public PyObject __ifloordiv__(PyObject other)(Code)(Java Doc) public PyObject __ilshift__(PyObject other)(Code)(Java Doc) public PyObject __imod__(PyObject other)(Code)(Java Doc) public PyObject __imul__(PyObject other)(Code)(Java Doc) public PyObject __int__()(Code)(Java Doc) public PyObject __invert__()(Code)(Java Doc) public PyObject __ior__(PyObject other)(Code)(Java Doc) public PyObject __ipow__(PyObject other)(Code)(Java Doc) public PyObject __irshift__(PyObject other)(Code)(Java Doc) public PyObject __isub__(PyObject other)(Code)(Java Doc) public PyObject __iter__()(Code)(Java Doc) public PyObject __iternext__()(Code)(Java Doc) public PyObject __itruediv__(PyObject other)(Code)(Java Doc) public PyObject __ixor__(PyObject other)(Code)(Java Doc) public PyObject __le__(PyObject other)(Code)(Java Doc) public int __len__()(Code)(Java Doc) public PyLong __long__()(Code)(Java Doc) public PyObject __lshift__(PyObject other)(Code)(Java Doc) public PyObject __lt__(PyObject other)(Code)(Java Doc) public PyObject __mod__(PyObject other)(Code)(Java Doc) public PyObject __mul__(PyObject other)(Code)(Java Doc) public PyObject __ne__(PyObject other)(Code)(Java Doc) public PyObject __neg__()(Code)(Java Doc) public boolean __nonzero__()(Code)(Java Doc) public PyObject __not__()(Code)(Java Doc) public PyString __oct__()(Code)(Java Doc) public PyObject __or__(PyObject other)(Code)(Java Doc) public PyObject __pos__()(Code)(Java Doc) public PyObject __pow__(PyObject o2, PyObject o3)(Code)(Java Doc) public PyObject __pow__(PyObject other)(Code)(Java Doc) public PyObject __radd__(PyObject other)(Code)(Java Doc) public PyObject __rand__(PyObject other)(Code)(Java Doc) protected void __rawdir__(PyDictionary accum)(Code)(Java Doc) public PyObject __rdiv__(PyObject other)(Code)(Java Doc) public PyObject __rdivmod__(PyObject other)(Code)(Java Doc) public PyObject __reduce__()(Code)(Java Doc) public PyString __repr__()(Code)(Java Doc) public PyObject __rfloordiv__(PyObject other)(Code)(Java Doc) public PyObject __rlshift__(PyObject other)(Code)(Java Doc) public PyObject __rmod__(PyObject other)(Code)(Java Doc) public PyObject __rmul__(PyObject other)(Code)(Java Doc) public PyObject __ror__(PyObject other)(Code)(Java Doc) public PyObject __rpow__(PyObject other)(Code)(Java Doc) public PyObject __rrshift__(PyObject other)(Code)(Java Doc) public PyObject __rshift__(PyObject other)(Code)(Java Doc) public PyObject __rsub__(PyObject other)(Code)(Java Doc) public PyObject __rtruediv__(PyObject other)(Code)(Java Doc) public PyObject __rxor__(PyObject other)(Code)(Java Doc) public void __set__(PyObject obj, PyObject value)(Code)(Java Doc) final public void __setattr__(PyString name, PyObject value)(Code)(Java Doc) public void __setattr__(String name, PyObject value)(Code)(Java Doc) public void __setitem__(PyObject key, PyObject value)(Code)(Java Doc) public void __setitem__(String key, PyObject value)(Code)(Java Doc) public void __setitem__(int key, PyObject value)(Code)(Java Doc) public void __setslice__(PyObject s_start, PyObject s_stop, PyObject s_step, PyObject value)(Code)(Java Doc) public void __setslice__(PyObject start, PyObject stop, PyObject value)(Code)(Java Doc) public PyString __str__()(Code)(Java Doc) public PyObject __sub__(PyObject other)(Code)(Java Doc) public Object __tojava__(Class c)(Code)(Java Doc) public PyObject __truediv__(PyObject other)(Code)(Java Doc) public PyUnicode __unicode__()(Code)(Java Doc) public PyObject __xor__(PyObject other)(Code)(Java Doc) final public PyObject _add(PyObject o2)(Code)(Java Doc) final public PyObject _and(PyObject o2)(Code)(Java Doc) public PyObject _callextra(PyObject[] args, String[] keywords, PyObject starargs, PyObject kwargs)(Code)(Java Doc) final public int _cmp(PyObject o)(Code)(Java Doc) final public PyObject _div(PyObject o2)(Code)(Java Doc) final public PyObject _divmod(PyObject o2)(Code)(Java Doc) public PyObject _doget(PyObject container)(Code)(Java Doc) public PyObject _doget(PyObject container, PyObject wherefound)(Code)(Java Doc) public boolean _doset(PyObject container, PyObject value)(Code)(Java Doc) final public PyObject _eq(PyObject o)(Code)(Java Doc) final public PyObject _floordiv(PyObject o2)(Code)(Java Doc) final public PyObject _ge(PyObject o)(Code)(Java Doc) final public PyObject _gt(PyObject o)(Code)(Java Doc) final public PyObject _in(PyObject o)(Code)(Java Doc) public PyObject _is(PyObject o)(Code)(Java Doc) public PyObject _isnot(PyObject o)(Code)(Java Doc) public PyObject _jcall(Object[] args)(Code)(Java Doc) public PyObject _jcallexc(Object[] args) throws Throwable(Code)(Java Doc) public void _jthrow(Throwable t)(Code)(Java Doc) final public PyObject _le(PyObject o)(Code)(Java Doc) final public PyObject _lshift(PyObject o2)(Code)(Java Doc) final public PyObject _lt(PyObject o)(Code)(Java Doc) final public PyObject _mod(PyObject o2)(Code)(Java Doc) final public PyObject _mul(PyObject o2)(Code)(Java Doc) final public PyObject _ne(PyObject o)(Code)(Java Doc) final public PyObject _notin(PyObject o)(Code)(Java Doc) final public PyObject _or(PyObject o2)(Code)(Java Doc) final public PyObject _pow(PyObject o2)(Code)(Java Doc) final public PyObject _rshift(PyObject o2)(Code)(Java Doc) final public PyObject _sub(PyObject o2)(Code)(Java Doc) final public PyObject _truediv(PyObject o2)(Code)(Java Doc) final protected String _unsupportedop(String op, PyObject o2)(Code)(Java Doc) final public PyObject _xor(PyObject o2)(Code)(Java Doc) protected void addKeys(PyDictionary accum, String attr)(Code)(Java Doc) public int asInt(int index) throws ConversionException(Code)(Java Doc) public long asLong(int index) throws ConversionException(Code)(Java Doc) public String asName(int index) throws ConversionException(Code)(Java Doc) public String asString(int index) throws ConversionException(Code)(Java Doc) public String asStringOrNull(int index) throws ConversionException(Code)(Java Doc) public void delDict()(Code)(Java Doc) public void delType()(Code)(Java Doc) public void dispatch__init__(PyType type, PyObject[] args, String[] keywords)(Code)(Java Doc) public boolean equals(Object ob_other)(Code)(Java Doc) public PyObject fastGetClass()(Code)(Java Doc) public PyObject fastGetDict()(Code)(Java Doc) public PyObject getDict()(Code)(Java Doc) public PyObject getDoc()(Code)(Java Doc) public PyType getType()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) protected PyObject impAttr(String name)(Code)(Java Doc) public boolean implementsDescrDelete()(Code)(Java Doc) public boolean implementsDescrSet()(Code)(Java Doc) public PyObject invoke(String name, PyObject[] args, String[] keywords)(Code)(Java Doc) public PyObject invoke(String name, PyObject[] args)(Code)(Java Doc) public PyObject invoke(String name)(Code)(Java Doc) public PyObject invoke(String name, PyObject arg1)(Code)(Java Doc) public PyObject invoke(String name, PyObject arg1, PyObject arg2)(Code)(Java Doc) public boolean isCallable()(Code)(Java Doc) public boolean isDataDescr()(Code)(Java Doc) public boolean isMappingType()(Code)(Java Doc) public boolean isNumberType()(Code)(Java Doc) public boolean isSequenceType()(Code)(Java Doc) public void noAttributeError(String name)(Code)(Java Doc) public void readonlyAttributeError(String name)(Code)(Java Doc) protected String runsupportedopMessage(String op, PyObject o2)(Code)(Java Doc) public String safeRepr() throws PyIgnoreMethodTag(Code)(Java Doc) public void setDict(PyObject newDict)(Code)(Java Doc) public void setType(PyType type)(Code)(Java Doc) public String toString()(Code)(Java Doc) public static void typeSetup(PyObject dict, PyType.Newstyle marker)(Code)(Java Doc) protected String unsupportedopMessage(String op, PyObject o2)(Code)(Java Doc)
|
|
|