Art Protin wrote: > Dear folks, > On testing and documenting my implementation of the V2 DB API Spec, > I am bothered > by my (limited) understanding of what the spec says for the behavior of > Cursor.description . > Clearly when a query (or rather an SQL statement) does not produce a > result, .description should be None.
It is common practice to do cursor.execute('select * from mytable where 1=0') print cursor.description to access the schema of a table. > However, not producing a result is > not the same as producing a table of > zero rows by one or more columns. (This is like the distinction between > the two comparisons > "" == False > and > "" is False > , the empty string has the same 'value' as False while remaining distinct.) > I do not know that this will ever make a difference to my users > but I am expected > to be precise in my implementation. Is it the general understanding > that .description > will return None whenever the result set has no rows? cursor.description always refers to a result set. If a statement does not produce a result set, then .description should be None. However, a result set may have length 0 (as in the example above), so .rowcount==0 is not a good inidicator. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2006) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig