Menu

new behavior

Help
nttaylor
2006-10-27
2012-09-19
  • nttaylor

    nttaylor - 2006-10-27

    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?

     
    • Andy Dustman

      Andy Dustman - 2006-10-27

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.