[Zope-DB] Newbe quiz on _searchable_result_columns() method

Ole Fostad ole.fostad@netcom.no
Tue, 15 Oct 2002 10:54:21 +0200


 Hi!

I just started using Zope and I am stuck!

Trying to make a simple db editor and needs the column description information for the column types and sizes.

I made an External method to retrive the column description:

# External method
def getDescription(zsql_id):
    return zsql_id._serachable_result_columns()

And a Zope script to retrieve data and the description:

# Get the data
def getData():
    sql = 'select * from table1'
    db = 'my_zsql_connection'
    context.zsql_method.manage_edit('', db, '', sql)
    data = context.zsql_method()
    description = getDescription(context.zsql_method)

And everything works so far. However, if I change the table in the sql statement like
    sql = 'select * from table2'
and/or change to another database connection (on the same ZSQLMethod), the data is returned as expected, but the 
_searchable_result_columns method still returns the description of the first table?????

The only way I can get the description to change is by running zsql_method.manage_test

I am using Postgres, MySQL, Gadfly and Oracle connections and all behave the same.

So, is it possible to "force" an update of some kind so that  the _searchable_result_columns method retrieves the 
description of the actual sql statement?

Thanks for all help!

Ole