From: "Jim Weirich" <jweirich / one.net>


> On Mon, 2002-11-11 at 23:37, Gavin Sinclair wrote:
>
> > I very much doubt that there is a problem with the '@' character.  What
data
> > type is your email address in the database?  One gotcha with DBI is that
> > queries always return Strings.
>
> That's not entirely true.  It tends to be dependent upon the database
> driver being used (this recently came to my attention).  The PostgreSQL
> driver very carefully converts the SQL data types to native Ruby types.
> Evidently the Oracle driver does not do this.  This is a major
> incompatibility in the drivers that should be ironed out (IMHO).

Good idea.

> > I recommend the following things:
>
> [... strong agreement with the given list, with comments on ...]
>
> >  - convert the row to a hash (row.to_h) so you know exactly what
> >    you're dealing with
>
> I almost never do this.  Do you do this because you use hash methods
> that aren't supported on a row object?  The original intent was that the
> row would look sufficiently like a hash so that you wouldn't have to
> convert it.  If still feel the need, perhaps it is not "sufficient"
> enough.

I do it because I haven't seen any documentation that says how a row is
supposed to behave, only code, and while I noticed the hash-like behaviour, I
just don't trust it.  DBI::Row#[] is complicated, so I don't trust it.  I
always want to use a row as a hash, so the safest thing is to convert it.  At
least then if there is a problem, I could be confident in reporting a bug!
Furthermore, I see nothing lost by converting.

Note: when I say I don't trust the code, I mean no slight against the code
writer.  I just don't trust my ability to determine how I'm supposed to use it
from looking at the code.

> -- Jim Weirich     jweirich / one.net    http://w3.one.net/~jweirich

Gavin