On Fri, Oct 17, 2003 at 09:08:22AM -0700, Dean Arnold wrote:
> > On Thu, Oct 16, 2003 at 02:12:36PM -0700, Dean Arnold wrote:
> > > Has anyone attempted to write a DBD
> > > using Inline::C (or C++) ? I'm looking into updating a driver
> > > to selectively switch between a pure Perl implementation,
> > > and a native C i/f to a low level vendor API library if its available, in order
> > > to get more performance/functionality. Inline::C looked 
> > > like an attractive alternative (esp w/ Inline::Struct) to all the XS 
> > > madness. This would allow the driver to exploit Perl's 
> > > strenghts for parsing SQL, mapping things w/ hashes, etc, but
> > > use the vendor lib for the low level data movement, as opposed
> > > to writing a complete DBD in C/XS.
> > 
> > I don't think any DBD is pure C/XS. All have a significant amount of perl.
> > 
> > Driver authors wanting to use C don't have to write _any_ XS if they
> > use the Driver.xst template mechanism (which is strongly recommended).
> > 
> > Then just add some logic around the "bootstrap()" method call in
> > the .pm file. The .pm file can implement the same methods as the
> > C/XS code and, if the c/XS code hasn't been bootstraped, then the
> > perl methods will be called instead. Simple.
> > 
> > Tim.
> 
> 
> Hmmm, guess its been a while since I've hacked on DBD::ODBC,
> but it sure seemed like a lot of XS and C. But I was very much an XS
> newbie at the time, so perhaps my view is jaundiced.
> 
> Perhaps my question is also colored by the fact that I already
> have a pure Perl driver, and am just looking to adapt to a vendor
> lib for the low-level protocol calls. This notion probably arises from
> Inline::Struct more than Inline::C, since the API I'm using
> is driven primarily from a well-defined 'C' struct, with just a handful
> of method calls. Based on Inline::Struct's POD, it seems pretty
> easy to directly manipulate a C struct directly from Perl, then
> make a simple Inline::C function wrapper (with a tiny bit
> of perlguts'ness) to drive the execution.
> 
> And now I'm designing out loud, so I'll shut up...but will still likely
> pursue this concept; it probably wouldn't work well for other function-based
> APIs like ODBC, but for data structure driven APIs, esp from a pre-existing
> pure Perl driver, it looks promising.

Yes, sounds fine. But I'd still strongly recommend using Driver.xst
if possible as it encapsulates some aspects of the DBI/DBD interface.
It may make sense to use both Driver.xst and Inline::Struct.

Tim.

Reply via email to