Cursor Objects

These objects represent a database cursor, which manages the context of a fetch operation.

Cursor objects should respond to the following methods and attributes:

description

This read-only attribute is a sequence of seven-item sequences. Each of these sequences contains information describing one result column: (name, type_code, display_size, internal_size, precision, scale, null_ok). This attribute is None for operations that don’t return rows or if the cursor has not yet had an operation invoked via the executeXXX() method.

The type_code can be interpreted by comparing it to the Type objects specified in the next section.

rowcount

This read-only attribute specifies the number of rows the last executeXXX() produced (for DQL statements such as select) or affected (for DML statements such as update or insert).

The attribute is -1 if no executeXXX() has been performed on the cursor or the row count of the last operation can’t be determined by the interface.Note 5

callproc( procname[,parameters] )

This method is optional since not all databases provide stored procedures. Note 3

Calls a stored database procedure with the given name. The sequence of parameters must contain one entry for each argument 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 are replaced with possibly new values.

The procedure may also provide a result set as output. This must ...

Get Python Programming On Win32 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.