On Wed, Aug 01, 2001 at 05:29:10AM -0700, Daniel wrote:
> Nicely put Nick. There's already a Structured Query Language,
> And there's an easy to use abstraction called DBI up on CPAN.
> Feel free to use in application code thusly:
>
> my $statement = qq~
> SELECT field1, field2
> FROM table
> WHERE id = ?
> ~;
> my $ref;
> my $sth = $dbh->prepare($statement);
> foreach my $question (@questions) {
> $sth->execute($question);
> $ref = $sth->fetchrow_hashref;
> $sth->finish;
> &display_data($ref);
> }
Umm, these days I'd write loop that as:
foreach my $question (@questions) {
&display_data( $dbh->selectrow_arrayref($sth, undef, $question) );
}
:-)
Since ValueClick's been mentioned I'll point out that I now have the
task of exploring how to migrate all the embedded SQL code that Nick
mentioned from MySQL over to Oracle :-) [Hi Nick!]
I'm not a big fan of heavy abstractions and I'm pretty comfortable
with how much of the code is structured, in general.
I'm hoping that a mixture of new DBD::Oracle and DBI features, possibly
a DBD::Oracle::mysql subclass, and a sprinkling of DBIx::AnyDBD will
prove sufficient.
Combining that with using Oracle's ODBC gateway to make MySQL tables
appear live within Oracle should enable a smooth migration without a
sharp 'big bang' transition.
Of course, all this is just theory at the moment.
Tim.