DBI stub class ? (using sqlcmd)
Posted in 2000
Topics: Performance & Tuning
I'm looking for (or wanted to ask about before I write one) a stub DBI class, a replacement, API compatible with DBI:Informix, but not using DBI. A Perl class that simply translates the -> prepare, -> fetch methods into a simple pipe to "sqlcmd" for example. I want to test/measure how much DBI is better in terms of performance than coding something like : open(QUERY,"$query |");while (<QUERY>) { ... }; close(QUERY); instead of $db->prepare($Query);while ($sth->fetch) { ... } so maybe there exists a class that has the DBI interface (a "plug-in" replacement for DBI) but that simply does a popen() to "sqlcmd" ? Then I could "drop" that class into the application and everything would work for both the sqlcmd class and the DBI classes, so I could go back and profile this....
On Thu, 15 Jun 2000 20:30:27 GMT David Stes wrote:
>
> I'm looking for (or wanted to ask about before I write one) a stub DBI
> class, a replacement, API compatible with DBI:Informix, but not using
> DBI.
>
> A Perl class that simply translates the -> prepare, -> fetch methods
> into a simple pipe to "sqlcmd" for example.
>
> I want to test/measure how much DBI is better in terms of performance
> than coding something like :
>
> open(QUERY,"$query |");while (<QUERY>) { ... }; close(QUERY);
>
> instead of
>
> $db->prepare($Query);while ($sth->fetch) { ... }
>
> so maybe there exists a class that has the DBI interface (a "plug-in"
> replacement for DBI) but that simply does a popen() to "sqlcmd" ?
>
> Then I could "drop" that class into the application and everything would
> work for both the sqlcmd class and the DBI classes, so I could go back
> and profile this....
I dont know of such a thing. But my first thought would be to use DBI
itself and then create your own DBD module to interact with the database
in the way that you want. This way you are guaranteed to have a fully
compliant interface - your DBD module need only fully implement those
methods you require. You might want to look at DBD::XBase for a pure
Perl DBD module. Of course all the SQL parsing and so forth will be done
by whatever program you care to use. I posted an example of using
dbaccess in this way awhile back use IPC::Open2 in omp.lang.perl.misc ...
/J\\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>