From: Austin Ziegler Date: 2006-09-27T04:50:00+09:00 Subject: Re: Fixnum/String randomly changing type On 9/26/06, Sam Web wrote: > I am seeing some odd behavior that look to me to like it could be a bug > in Ruby. Being new to the language, however, I wanted to see if there > was another explanation. I am using Ruby 1.8.4 on an Intel Mac. The > code at the bottom of this message is an excerpt from a class in a > larger script. It is using DBI to pull 10 fields from a MySQL database. > The first 9 are integers (tinyint(4) in the database) and the last is a > string (varchar(255) in the database). When I run the below program as > is, the puts outputs: My guess, based on what you're seeing, is that something special is being done on the #each by either DBI or the DBD driver for MySQL. It sees that it's really a Fixnum value that it's supposed to be returning, and converts it for you. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca