Menu

#1 recordset.keys() issue

closed
nobody
None
5
2003-11-17
2003-11-16
Anonymous
No

winghing@netvigator.com

recordset.keys() duplicate its content when call more
than one time within the same script,

e.g.

while rs.next():
for k in rs.keys():
print "%s : %s" % (k, rs.fields[k].value)

will should multiple duplicate line repeated due to
duplicate of rs.keys() content.

please correct!

Discussion

  • Jonathan M. Franz

    • status: open --> closed
     
  • Jonathan M. Franz

    Logged In: YES
    user_id=395179

    This is expected behaivor - calling .keys() returns all of the
    column-names in the result-set, reguardless of when called.
    If you are seeing multiple copies of the keys in your example,
    it is because you have multiple rows in your resultset - and
    thus .keys() is being called for each record in your resultset.
    If this is not correct, please give us a more detailed example,
    with what DB module you are using, and what query you are
    using, and some example data from the table(s) in question so
    that we may investigate further.

     

Log in to post a comment.