Stephen Clouse <[EMAIL PROTECTED]> writes: > Is there any sane way to get at the DBI API from C? > > I have a fair amount of database-layer code in XS/C for speed. We still use DBI > because we do quite a bit of SQL from Perl, but then we also have this direct > OCI layer that does nasty things such as grabbing the Oracle handle pointers > from DBI, doing our own handle creation/prepares/executes and what not.
A large part of DBI is written in Perl, not C. Some DBDs are even pure-Perl, as far as I know. So calling DBI would, as far as I can see, mean pushing SV's (C representation of Perl values) on the Perl stack, running the appropriate Perl expression, then popping the results off the Perl stack. Whether that is considered sane would be a matter of personal opinion. It would be possible to call into DBD::Oracle XS/C code directly, but I am not sure that could be considered "using DBI", and would also make you vulnerable to internal changes between DBD::Oracle versions. And you would still need heavy SV manipulations. Could you give an example of where you need to use C instead of Perl for speed in DB access? I would think that with proper use of DBI, any time spent in the client Perl code would be dwarfed by time spent in OCI and in the server. - Kristian.
