[DB-SIG] a little help please

Andy Dustman adustman@comstar.net
Thu, 9 Mar 2000 01:24:23 -0500 (EST)


On Wed, 8 Mar 2000, Garrett Gradisar wrote:

> 
> #BEGIN CODE
> from pg import DB
> 
> x = pg.DB('ggroup', None, -1, None, None, 'ggroup', '*******')
> #open connection to database ggroup, user ggroup, password deleted to
> #protect me.
> 
> newq = 'select id,sname,lname,rcolor,weeks,whenw,blocksize,perweek '
> newq = newq+'from require'
> 
> r = x.query(newq) # Get all data from table require in order
> 
> print r # the fields are in order here
> 
> print r.dictresult() 
> #when I do this the fields are no longer in the currect order
> 
> #END CODE
> 
> why? what am I doing wrong, my sql query specifies the correct order and
> when I print r, it looks fine, but then if i use dictresult() the order changes.
> 
> I need them in the correct order so I can print them in an html table.

I would guess this is because r.dictresult() returns results as a
dictionary, which are not ordered. But I know nothing about this pg
module; this is just a guess. 

-- 
andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
"Therefore, sweet knights, if you may doubt your strength or courage, 
come no further, for death awaits you all, with nasty, big, pointy teeth!"