[Tutor] Mysql BLOB strangeness?

Adam Cripps kabads at gmail.com
Fri Mar 17 15:15:32 CET 2006

I'm trying to build a mini-CMS for my class to manage a single
webpage, using CGI and mysql. The children will be storing their main
content in a BLOB within a Mysql database.

When I query the content column, I get a strange return like this:

array('c', 'This is a test ')

- when the only text I entered in was 'This is a test'.

When I query mysql directly through a prompt, I get 'This is a test'.

Does a CGI query get mangled text from a blob? My other VARCHAR
columns are fine.


def query(statement):
    results = []
    myrowcount = int(mycursor.rowcount)
    for i in range (0, myrowcount):
        myrow = mycursor.fetchone()
    return results

reportquery = "select id, title, content, published from report"
reportlist = query(reportquery)
print "<p>" + str(reportlist) + "</p>"

id = primary key, integer, not null
title = varchar(255)
content = blob
published = char(1), default ='n'

I've tried using looking at
reportlist[0][2][1], but that just returns 'T' - which is obviously
the T in 'This'.

PGP key: 0x7111B833

More information about the Tutor mailing list