On Fri, Sep 14, 2007 at 08:10:01AM -0000, Julian Edwards wrote:
> "sbpph.status" = Published
>
> For some reason this query:
> query = """
> SELECT bpn.name, bpr.version, c.name
> FROM binarypackagerelease bpr, binarypackagename bpn, component c,
> securebinarypackagepublishinghistory sbpph, distroarchrelease dar
> WHERE
> bpr.binarypackagename = bpn.id AND
> sbpph.binarypackagerelease = bpr.id AND
> sbpph.component = c.id AND
> sbpph.distroarchrelease = dar.id AND
> sbpph.status = %s AND dar.id in (%s)
> """ % (dbschema.PackagePublishingStatus.PUBLISHED, dar_ids)
>
> is generating the dbschema's *title* instead of its enum value.
That's because you simply convert the PUBLISHED enum item to a string.
You need to sql quote it, using sqlvalues() or quote(), if you're going
to use it in a SQL query.
On Fri, Sep 14, 2007 at 08:10:01AM -0000, Julian Edwards wrote: lease bpr, binarypackagename bpn, component c, kagepublishingh istory sbpph, distroarchrelease dar gename = bpn.id AND kagerelease = bpr.id AND hrelease = dar.id AND PackagePublishi ngStatus. PUBLISHED, dar_ids)
> "sbpph.status" = Published
>
> For some reason this query:
> query = """
> SELECT bpn.name, bpr.version, c.name
> FROM binarypackagere
> securebinarypac
> WHERE
> bpr.binarypacka
> sbpph.binarypac
> sbpph.component = c.id AND
> sbpph.distroarc
> sbpph.status = %s AND dar.id in (%s)
> """ % (dbschema.
>
> is generating the dbschema's *title* instead of its enum value.
That's because you simply convert the PUBLISHED enum item to a string.
You need to sql quote it, using sqlvalues() or quote(), if you're going
to use it in a SQL query.