Skip to content
Prev 3 / 1559 Next

RS-DBI using embedded Perl DBI

On Fri, May 04, 2001 at 06:32:18PM -0400, T Jake Luciani wrote:
Great. Saikat, David and I did the same sort of thing with JDBC.  It
is a good idea to leverage the existing code for the various
databases.  In S-JDBC interface, we were using the SJava package to
actually make the connection to Java. You appear to be using direct C
code to connect to Perl rather than the RSPerl package which provides
a way for embedding Perl in R. I do recognize some of the code that
seems to be taken from that package, so perhaps you are using it but I
don't thing directly, if it all.  You might find that using that
package simplifies the code a bit and makes it easier for others to
experiment with.
Yep. The problem is that some errors in Perl jumps straight to exit()
and _exit() rather than signalling an exception and returning control
to the caller, in this case the C code invoked from R.  The RSPerl
package has the same difficulty and I haven't found time to fix it
yet. A simple solution is to provide an alternative implementation of
Perl's fatal error handler routine. Then, when one links against the
Perl library to create RSPerlDBI.so, the routine in your C code will
be linked and used. This can be a bit tricky at times depending on
linkers, how Perl was compiled, etc. But, if your routine is called,
then it should throw and S error and the execution stack will return.
That's the basic approach I use in embedding unless I have more
specific needs.


BTW, I am on the r-sig-db mailing list, so there's no need mail me
separately.

  
    
Message-ID: <20010504192405.L10907@jessie.research.bell-labs.com>
In-Reply-To: <010401c0d4ea$14486b20$0201a8c0@me>; from jake@agere.com on Fri, May 04, 2001 at 06:32:18PM -0400