in reply to Data format verification for insertion into a database

I was just wondering if anyone ever put a module together that would verify the format of data before attempting insertion.

At one level, what constitutes correct format is application-specific.

At another level, things like data with embedded quotes can be handled automatically by DBI if you use parameter markers in your queries and pass values to execute(), where they'll be automagically quoted.

Could you be a little more specific about what you mean by "verification of data format"?

  • Comment on Re: Data format verification for insertion into a database

Replies are listed 'Best First'.
Re: Re: Data format verification for insertion into a database
by antirice (Priest) on Apr 25, 2003 at 06:17 UTC
    For instance: make certain that a date is in the proper sequence, make certain that something which is supposed to be an integer is most certainly an integer, etc. There are also other checks such as proper e-mail address formatting that I would like to see rolled up into one friendly module (outside of Email::Valid so I don't have to import 500 modules to know that my data is properly formatted). Hmmm..

    antirice    
    The first rule of Perl club is - use Perl
    The
    ith rule of Perl club is - follow rule i - 1 for i > 1

      There are also other checks such as proper e-mail address formatting that I would like to see rolled up into one friendly module ...

      As of yet, there is no such friendly module, at least as far as I know (though perhaps someone else knows better). You'll need to build up the verification you need from individual pieces.