perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bunce <Tim.Bu...@pobox.com>
Subject Re: [OT] Inspired by closing comments from the UBB thread. (fwd)
Date Thu, 02 Aug 2001 01:44:24 GMT
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.

Mime
View raw message