I recently upgraded to MySQLdb1.2.2b2 in an attempt to remedy another problem,
but the upgrade has caused some odd new behavior.
I also just upgraded MySQL itself to 5.0.24a, so this might also be the cause
of it, but I think it's because of the MySQLdb upgrade.
Anyway, the odd behavior is as follows:
>>> import MySQLdb
>>> db = MySQLdb.connect( ... )
>>> c = db.cursor()
>>> query = "SELECT m_name FROM directory"
>>> c.execute(query)
72L
>>> result = c.fetchall()
>>> result[0]
((None,)
>>> result[1]
(Set([]),))
The column "m_name" was created as char(1) - it's supposed to be a middle initial.
Now, if the value in that column is NULL, everything is fine, and my result set for
that row contains a "None". But things change if the value in column "m_name" is
the empty string "". In that case, the result set now contains a class object:
>>> type(result[1][0])
<class 'sets.Set'>
Shouldn't this be the empty string and not a class object? Or am I not aware of
some change?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It should be an empty string from what you are describing. I can't duplicate this with 1.2.2b2. Try removing all traces of MySQLdb from your site-packages and reinstalling.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I recently upgraded to MySQLdb1.2.2b2 in an attempt to remedy another problem,
but the upgrade has caused some odd new behavior.
I also just upgraded MySQL itself to 5.0.24a, so this might also be the cause
of it, but I think it's because of the MySQLdb upgrade.
Anyway, the odd behavior is as follows:
>>> import MySQLdb
>>> db = MySQLdb.connect( ... )
>>> c = db.cursor()
>>> query = "SELECT m_name FROM directory"
>>> c.execute(query)
72L
>>> result = c.fetchall()
>>> result[0]
((None,)
>>> result[1]
(Set([]),))
The column "m_name" was created as char(1) - it's supposed to be a middle initial.
Now, if the value in that column is NULL, everything is fine, and my result set for
that row contains a "None". But things change if the value in column "m_name" is
the empty string "". In that case, the result set now contains a class object:
>>> type(result[1][0])
<class 'sets.Set'>
Shouldn't this be the empty string and not a class object? Or am I not aware of
some change?
It should be an empty string from what you are describing. I can't duplicate this with 1.2.2b2. Try removing all traces of MySQLdb from your site-packages and reinstalling.