Cursor Class

Represents a database cursor. Cursors manage the context of fetch operations.

Remarks

When a connection has multiple cursors, changes made to the database by one cursor are immediately visible to other cursors. You can configure whether cursors that are created from different connections are isolated.

Documentation is provided for methods that are not part of PEP 249 or whose behavior differs from PEP 249.

Methods

Method

Description Differences from PEP 249
callproc(procname[, parameters][, overview]) Method Calls the specified stored procedure from the database. The overview parameter is not part of PEP 249.
close() Method Closes the cursor. None.
description_ext() Method Retrieves a sequence of result column descriptions. Not defined in PEP 249.
execute(operation[, parameters]) Method Prepares and executes a database operation. The parameters can be specified by using keywords.
executemany(operation, list_of_parameters) Method Executes in batch. None.
executemanyprepared(list_of_parameters) Method Executes a previously prepared database operation in batch. Not defined in PEP 249.
executeprepared([parameters]) Method Executes a previously prepared database operation. Not defined in PEP 249.
fetchone([uselob]) Method Fetches the next row of a query result set. The uselob parameter is not part of PEP 249.
fetchall() Method Fetches all of the remaining rows of a query result as a sequence of sequences. None.
fetchmany([size=cursor.arraysize]) Method Fetches the next set of rows from a query result as a sequence of sequences. None.
get_resultset_holdability() Method Retrieves the result set holdability. Not defined in PEP 249.
getwarning() Method Retrieves a warning object if there is a warning from the previous execution. Not defined in PEP 249.
haswarning() Method Checks whether there are warnings from the previous execution. Not defined in PEP 249.
nextset() Method Makes the cursor skip to the next result set and closes the current result set. None.
parameter_description() Method Retrieves a sequence of descriptions of parameters. Not defined in PEP 249.
prepare(operation[, newcursor=False]) Method Prepares a database operation. Not defined in PEP 249.
scroll(value[, mode]) Method   Not defined in PEP 249.
server_cpu_time() Method

Returns the total CPU processing time, in microseconds.

Not defined in PEP 249.
server_memory_usage() Method

Returns the memory usage data on the server side, in bytes.

Not defined in PEP 249.
server_processing_time() Method

Returns the elapsed processing time, in microseconds, on the server side.

Not defined in PEP 249.
setinputsizes(sizes) Method Not supported. Not supported.
setfetchsize(value) Method Sets the size of prefetched result sets. Not defined in PEP 249.
setoutputsizes() Method Not supported. Not supported.
set_resultset_holdability(holdability) Method Sets the result set holdability. Not defined in PEP 249.

Cursor Attributes

Members

Description Differences from PEP 249
arraysize Specifies the cursor fetch size (number of rows). The default value is 32. Not defined in PEP 249.
description For operations that return rows or cursors that have invoked an operation by using the execute*() method, this attribute returns information about the rows in the result set. None.
maxage Specifies the refresh age for the cached view. Not defined in PEP 249.
refreshts Specifies the refresh timestamp for a cached view. Not defined in PEP 249.
rowcount Specifies the number of rows returned by the most recent execute*() method.. None.