E&S CVS Commit: PEAK - Added DBCursor and LDAPCursor to peak.storage, along with their

pje at eby-sarna.com pje at eby-sarna.com
Sat Sep 28 22:02:00 EDT 2002


Module Name:	PEAK
Committed By:	pje
Date:		Sun Sep 29 02:01:31 UTC 2002

Modified Files:
	PEAK/src/peak/binding: components.py
	PEAK/src/peak/storage: connections.py interfaces.py
	PEAK/src/peak/util: Struct.py

Log Message:
Added DBCursor and LDAPCursor to peak.storage, along with their
corresponding interfaces.  ManagedConnections now support registerCursor()
and closeCursors() methods, as well as __call__() to create a new cursor
and optionally execute a query on it.  Cursor objects can be iterated over
to return rows, inverted to return a single row, or processed for
multi-sets as in::

    row = aConn('SQL that returns exactly one row').justOne()

    # shortcut for the above
    row = ~ aConn('SQL that returns exactly one row')

    # multiple result sets
    rs1, rs2 = aConn('SQL that returns 2 result sets').allSets()

    # iteration

    for row in aConn('SQL that returns 0-n rows, in 1 set'):
        # do something

Rows returned are 'struct' objects (a cross between a tuple, dict, and
object w/attributes), unless the underlying DB returns non-standard rows.
The LDAPCursor class also iterates over asynchronously retrieved results,
but isn't very well tested at this point.  None of this has been tested
with actual databases, just a few mockup test harnesses.

To support all this, I also needed to add a 'hasBinding()' method to
binding.Base and an 'addField' method to the 'structType' metaclass.


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/src/peak/binding/components.py.diff?r1=1.38&r2=1.39
http://cvs.eby-sarna.com/PEAK/src/peak/storage/connections.py.diff?r1=1.2&r2=1.3
http://cvs.eby-sarna.com/PEAK/src/peak/storage/interfaces.py.diff?r1=1.12&r2=1.13
http://cvs.eby-sarna.com/PEAK/src/peak/util/Struct.py.diff?r1=1.4&r2=1.5

To generate a diff of this commit:
cvs rdiff -r1.38 -r1.39 PEAK/src/peak/binding/components.py
cvs rdiff -r1.2 -r1.3 PEAK/src/peak/storage/connections.py
cvs rdiff -r1.12 -r1.13 PEAK/src/peak/storage/interfaces.py
cvs rdiff -r1.4 -r1.5 PEAK/src/peak/util/Struct.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




More information about the source-changes mailing list