[Chicago-talk] detecting whether a scalar is number or a string.

Ted Zlatanov tzz at lifelogs.com
Mon Jul 7 05:59:58 PDT 2008

On Sun, 6 Jul 2008 21:06:03 -0500 Andy Lester <andy at petdance.com> wrote: 

AL> On Jul 6, 2008, at 9:04 PM, Richard Reina wrote:

>> Thanks so much for the response.  It's just a one time use, throw
>> away script to validate data before it gets entered into a table.  I
>> will try your "low tech" way and if it works for me I am going to
>> run with it.

AL> Doesn't the database have validation on it, then?  Why not let the DB
AL> do that part of the job?

...because failing a networked, stateful transaction to a database is
far more costly than first checking if a number is valid?  Worse, some
databases don't even tell you which column generated the problem under
certain conditions.

I'd use Regexp::Common, with awareness of the DB schema.  You don't want
to pass a bigint to a table column that can't handle it, for example.


More information about the Chicago-talk mailing list