Problems with description structure

Dick Kniep <D.J.Kniep-/NLkJaSkS4VmR6Xm/[email protected]> 13 Aug 2003 11:02:51 +0200
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Hi there,

We are using pyPgSQL for a fairly complex system, and sofar everything
worked very nicely, especially in combination with SQLDict. With the new
version (2.4) however, there seems to be a problem with the description
list.

The following code is used to get the description of the fields from a
table:

--------- snip ----------------

    def __BldTabDef(self):
        """ Bouw gegevens over de te onderhouden tabel op """
        Sqlstmt = 'Select * from ' + self.table
        veldlist = []

        Opendb.TableObjs.hcur.execute(Sqlstmt)
        rr = Opendb.TableObjs.hcur.fetchone()
        for x in Opendb.TableObjs.hcur.description:
            veldnm = strip(x[0])
            self.__GetFldDefinition(veldnm,x)
            veldlist.append(veldnm)

        self.columns = tuple(veldlist)
        setattr(self.__class__,"columns",self.columns)

--------- snip ----------------

This way I don't need to specify the columns in the Class definitions of
the SQLDict definition of the objects.

I am also using the length parameter of the fields. In the previous
version of pyPgSQL this was all working perfectly. However, in the
current version, if I have a char field, no length is returned. So the
program crashes when it wants to use this length.

Has anyone had any experience with this?

Kind regards,
D.Kniep




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01