Hi, I'm being forced to use "import MySQLdb" to access a server....and am not getting all my data back.

I'm trying to send multiple queries all at once (for time reasons) and then extract the rows in bulk.
The queries have different number of columns;  For a contrived example;

script.db.query( '(SELECT Id, password, sessionFlags FROM account WHERE Id=(SELECT Id FROM ident where email="%s")); (SELECT * FROM identify);' % (prefix) )

resultStore = (script.db.store_result())
    result  = resultStore.fetch_row( maxrows=10 )
    result = str(result) + ":::"+str( resultStore.fetch_row(maxrows=10) )

This ought to return two result sets; and under php -- it does.
The first query, returns 1 row; the second returns 4 rows.

However, when I try to get the results using PYTHON's MySQLdb; I get
((2L, 'abcdefg', 0L),):::()

which is wrong...

I tried doing a "result store" twice, but executing it twice causes an exception;
(besides breaking the bulk transfer paradigm that I want ...)

Is this a bug in python/mySQLdb -- or is there another way this is supposed to be done?

--------------------------- Appendix (full code, with sensitive information foobar'd) -------------------

def m_database():
    global script
    import MySQLdb

    script.db = MySQLdb.connect(
        host = "foo.ipagemysql.com",
          user = "bar",
          passwd = "fooooobar",
        db = "bar"
      )

    prefix = "foobaaaaaaaaar...@eggsandspam.commedy.com"
script.db.query( '(SELECT Id, password, sessionFlags FROM account WHERE Id=(SELECT Id FROM identify where email="%s")); (SELECT * FROM identify);' % (prefix) )
    # Get the ID number for the account,
    # and then go get the password for verification purposes.
    resultStore = (script.db.store_result())
    result  = resultStore.fetch_row( maxrows=10 )

    # attempt to retrieve second query set
# resultStore = (script.db.store_result()) # This will cause an exception... so commented out.
    result = str(result) + ":::"+str( resultStore.fetch_row(maxrows=10) )

    script.db.close()
    return result


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to