Package MySQLdb :: Module cursors :: Class BaseCursor
[show private | hide private]
[frames | no frames]

Type BaseCursor

object --+
         |
        BaseCursor

Known Subclasses:
Cursor, DictCursor, SSCursor, SSDictCursor

A base for Cursor classes. Useful attributes:

description
A tuple of DB API 7-tuples describing the columns in the last executed query; see PEP-249 for details.
description_flags
Tuple of column flags for last query, one entry per column in the result set. Values correspond to those in MySQLdb.constants.FLAG. See MySQL documentation (C API) for more information. Non-standard extension.
arraysize
default number of rows fetchmany() will fetch

Method Summary
  __init__(self, connection)
  __del__(self)
  __iter__(self)
  callproc(self, procname, args)
Execute stored procedure procname with args
  close(self)
Close the cursor.
  execute(self, query, args)
Execute a query.
  executemany(self, query, args)
Execute a multi-row query.
  nextset(self)
Advance to the next result set.
  setinputsizes(self, *args)
Does nothing, required by DB API.
  setoutputsizes(self, *args)
Does nothing, required by DB API.
  _check_executed(self)
  _do_get_result(self)
  _do_query(self, q)
  _fetch_row(self, size)
  _get_db(self)
  _post_get_result(self)
  _query(self, q)
  _warning_check(self)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
bool _defer_warnings = False
classobj DatabaseError = _mysql_exceptions.DatabaseError
classobj DataError = _mysql_exceptions.DataError
classobj Error = _mysql_exceptions.Error
classobj IntegrityError = _mysql_exceptions.IntegrityError
classobj InterfaceError = _mysql_exceptions.InterfaceError
classobj InternalError = _mysql_exceptions.InternalError
classobj MySQLError = _mysql_exceptions.MySQLError
classobj NotSupportedError = _mysql_exceptions.NotSupportedError
classobj OperationalError = _mysql_exceptions.OperationalError
classobj ProgrammingError = _mysql_exceptions.ProgrammingError
classobj Warning = _mysql_exceptions.Warning

Method Details

callproc(self, procname, args=())

Execute stored procedure procname with args

procname -- string, name of procedure to execute on server

args -- Sequence of parameters to use with procedure

Returns the original args.

Compatibility warning: PEP-249 specifies that any modified parameters must be returned. This is currently impossible as they are only available by storing them in a server variable and then retrieved by a query. Since stored procedures return zero or more result sets, there is no reliable way to get at OUT or INOUT parameters via callproc. The server variables are named @_procname_n, where procname is the parameter above and n is the position of the parameter (from zero). Once all result sets generated by the procedure have been fetched, you can issue a SELECT @_procname_0, ... query using .execute() to get any OUT or INOUT values.

Compatibility warning: The act of calling a stored procedure itself creates an empty result set. This appears after any result sets generated by the procedure. This is non-standard behavior with respect to the DB-API. Be sure to use nextset() to advance through all result sets; otherwise you may get disconnected.

close(self)

Close the cursor. No further queries will be possible.

execute(self, query, args=None)

Execute a query.

query -- string, query to execute on server args -- optional sequence or mapping, parameters to use with query.

Note: If args is a sequence, then %s must be used as the parameter placeholder in the query. If a mapping is used, %(key)s must be used as the placeholder.

Returns long integer rows affected, if any

executemany(self, query, args)

Execute a multi-row query.

query -- string, query to execute on server

args

Sequence of sequences or mappings, parameters to use with query.

Returns long integer rows affected, if any.

This method improves performance on multiple-row INSERT and REPLACE. Otherwise it is equivalent to looping over args with execute().

nextset(self)

Advance to the next result set.

Returns None if there are no more result sets.

setinputsizes(self, *args)

Does nothing, required by DB API.

setoutputsizes(self, *args)

Does nothing, required by DB API.


Class Variable Details

_defer_warnings

Type:
bool
Value:
False                                                                  

Generated by Epydoc 2.1 on Sat Mar 3 21:14:16 2007 http://epydoc.sf.net