Menu

#23 Data in field with datatype of TINYINT is returned as string

open
nobody
None
5
2006-01-12
2006-01-12
Anonymous
No

DB: MySQL Ver 14.7 Distrib 4.1.15
Ruby: 1.8.2

When I select data from a field with a datatype of
TINYINT, it is returned as a string, not an integer.

stHandle = @dbHandle.execute("select chk from table1
where id = 1")
rows = stHandle.fetch_all
row = rows[0]
row["chk"].class

This returns String

If I then change the data type in the database to
INTEGER, that code will return FIXNUM.

Discussion


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.