[Zope-DB] ZSQL Method dictionaries() failing - Please help!
Jim Penny
jpenny@universal-fasteners.com
Tue, 20 May 2003 11:35:39 -0400
On Tue, May 20, 2003 at 11:27:59AM -0400, jwsacksteder@ramprecision.com wrote:
> > I connecting to a MS SQL Server using ODBC on Win2000.
>
> A-ha.
>
> > On the other hand, to get the contents of the table 'holidays', when I
> > execute context.getHolidays().dictoinaries(), I get -
> > Error Type: AttributeError
> > Error Value: DatabaseResults instance has no attribute 'dictionaries'
>
> ZODBCDA does not support dictionaries.
> See the following posts.
>
> http://mail.zope.org/pipermail/zope-db/2002-September/000889.html
>
> and more irritatingly...
>
> http://mail.python.org/pipermail/zope-collector-monitor/2002-August/000894.h
> tml
>
> You can still access your results ordinally by position-
>
> dataset=misc_sql()
> for row in dataset:
> print row[0]
If you need to access by name, and I often do, you can do something like:
dataset=container.misc_sql()
names=dataset.names()
for i in range(len(names)):
names2i[names[i]]=i
Then you can access field name misc_col in row i as
dataset[i][names2i['misc_col']]
Jim Penny
>
> will print the 1st column of each row by position, not name. It works, but
> you must be careful to preserve the order of your result columns. Two other
> ways to get data from ms-sql are mxODBC(commercial) or the remote ODBC DA
> included in Zdataquerykit.
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB@zope.org
> http://mail.zope.org/mailman/listinfo/zope-db
>