All previous versions have supported returning data from the execute()
method of a Connection object. 0.39 breaks this, execute() now returns
None.
e.g.:
db = Sybase.Connect(....)
print db.execute('select 1,2,3')
We use this facility pretty much exclusively in preference to cursors.
The following patch seems to restore at least some backwards-compatible
behaviour for single statements:
$ diff -u Sybase.py.Orig Sybase.py
--- Sybase.py.Orig Mon Apr 14 19:01:59 2008
+++ Sybase.py Tue Oct 14 17:08:32 2008
@@ -1032,7 +1032,13 @@
try:
cursor = self.cursor()
cursor.execute(sql)
+ ret = []
+ while 1:
+ ret.append(cursor.fetchall())
+ if not cursor.nextset():
+ break
cursor.close()
+ return ret
finally:
self._unlock()
but this is not complete.... previous versions permitted (and we used)
multiple selects which would return a set of results, things like
db.execute('Select 1, 2, 3 select 4,5,6')
which would return
[[(1, 2, 3)], [(4, 5, 6)]]
Nobody/Anonymous
None
None
Public
|
Date: 2008-10-15 00:29 Ignore that patch, it doesn't handle the non-select case "db.execute('use |
| Filename | Description | Download |
|---|---|---|
| diffs | Patch to restore _most_ of the old execute() behaviour. | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| File Added | 297399: diffs | 2008-10-15 00:29 | gnbond |