mysql + mxdatetime query problem--datetime not returned sometimes

Chris bit_bucket5 at hotmail.com
Fri Oct 26 10:27:10 EDT 2001


Experiencing a weird problem retrieving a datetime value from a mysql
db.  Here's what I'm doing, roughly:

connection = MySQLdb.connect(db = DB_NAME)
cursor = connection.cursor()
cursor.execute('select date_entered, description '
                 'from issue_actions '
                 'where issue_id = ' + selectedIssueId +
                 ' order by date_entered')
actions = cursor.fetchall()

...do stuff iterating thru actions, this select works perfectly....

cursor.execute('select description, when_opened from issues where id =
' + selectedIssueId)
result = cursor.fetchone()

This retrieves the tuple ('issue description',).  The mxDateTime
object is missing.  Every other select I run that gets a datetime
works fine.  This single instance always just returns the description.
 If I run this series of commands in the interactive window, all works
fine--datetime object is returned (this is in a cgi script, so
debugging is a bit harder).  If I go into mysql and run it all is
fine.  I'm completely confused re what's going wrong here.

Any ideas?

Disclaimer: I'm a database and mysql newbie.

Many thanks for any pointers.

-Chris



More information about the Python-list mailing list