I have a problem with unicode and tinyints. I have a table like this
CREATE TABLE `polls` (
`formid` int(10) unsigned NOT NULL default '0',
`qid` tinyint(2) unsigned NOT NULL default '0',
`type` tinyint(2) unsigned NOT NULL default '0',
`text` varchar(100) NOT NULL default '',
`created` timestamp(10) NOT NULL,
PRIMARY KEY (`formid`,`qid`,`type`)
) TYPE=InnoDB;
try this python code:
import MySQLdb
conn=MySQLdb.connect(host,user,password,database,unicode='iso-8859-1')
c=conn.cursor()
c.execute("SELECT * FROM polls")
c.fetchone()
It return the following...
(0L, u'0', u'0', u'Sista anv\xe4nda formid', '0401-12-14 45:00:00')
Where the formid is ok (Long), but qid and type are unicode strings. Bugg in cursor object? Am i doing anything wrong? Please help...
Another error is the field 'created'. It should be "04-01-12 14:45:00"...
/Hans
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a problem with unicode and tinyints. I have a table like this
CREATE TABLE `polls` (
`formid` int(10) unsigned NOT NULL default '0',
`qid` tinyint(2) unsigned NOT NULL default '0',
`type` tinyint(2) unsigned NOT NULL default '0',
`text` varchar(100) NOT NULL default '',
`created` timestamp(10) NOT NULL,
PRIMARY KEY (`formid`,`qid`,`type`)
) TYPE=InnoDB;
try this python code:
import MySQLdb
conn=MySQLdb.connect(host,user,password,database,unicode='iso-8859-1')
c=conn.cursor()
c.execute("SELECT * FROM polls")
c.fetchone()
It return the following...
(0L, u'0', u'0', u'Sista anv\xe4nda formid', '0401-12-14 45:00:00')
Where the formid is ok (Long), but qid and type are unicode strings. Bugg in cursor object? Am i doing anything wrong? Please help...
Another error is the field 'created'. It should be "04-01-12 14:45:00"...
/Hans