Jonathan Scott Duff wrote:
I'm kind of looking for a way to get perl out from in between the DBMS and
PDL. Sure, I can pull all of the data from the DBMS into perl-space and
then
create a piddle from that, but it would be nicer if there were a way to do
something like this:
use PDL;
use DBI;
use DBI2PDL; # okay, this name sucks, but work with me here :)
# ...
my $p = $sth->fetchrow_pdl; # or ...
my $q = $sth->fetchall_pdl; # or whatever ...
Basically I'm thinking that this hypothetical module would add *_pdl
routines that would complement the *_array routines of DBI. Of course
there
will have to be some smarts to deal with non-numeric columns and such, but
that's a detail best left for an actual implementation. :-)
I don't know enough about PDL's insides to know just how possible this is
and I just realized that I probably don't know enough about DBI's insides
either.
-Scott
Disclaimer: I'm blissfully ignorant of PDL other than knowing its
a number crunching tool.
1. Consider a DBI subclass (as a DBIx extension, e.g., DBIx::PDL).
Presumably, adding a couple functions such as you're after
should be straightforward, while preserving all the other
DBI semantics/syntax.
2. And (as an SQL fanboy) I'd consider the ultimate
disintermediation: a DBI subclass to make it appear that PDL
was running in the DBMS. See DBIx::Chart for a similar concept
applied to charting.
It would be interesting to see a SQL extension with matrix
operators (perhaps as some sort of exotic JOIN ?):
my $dbh = DBIx::PDL->connect($dsn, $user, $passwd);
my $results = $dbh->selectall_arrayref(
'SELECT * from
(SELECT * from TABLE1) a X
(SELECT * FROM TABLE2) b');
(Yes, my claims to sanity are often disputed).
Dean Arnold
Presicient Corp.