[Thousand-oaks-pm] Perl 6 Hackathon DB Progress

Todd Presta toddpresta at sbcglobal.net
Mon Jul 20 10:56:07 PDT 2009


Interesting progress on the DB front. I took a
detour and tried some Parrot experiments with SQLite3 using different
PMCs than used with the examples provided with Parrot itself. Hope I'm
on to something...could be a false lead though...

Basically,
after running the program (see github URL below), the following output
was provided: 0=SQLITE_OK, 21 = SQLITE_MISUSE, so everything after the first
statement is basically bogus. The main win is that there were no
segfaults (WinTel equivalent) at this point which appears to be a good sign. The biggest
problem encountered at this point is which PMC to use to store the
database connection handle returned from the sqlite3_open function. It
is defined in sqlite3.h as an opaque structure:

typedef struct sqlite3
 sqlite3;

************************************************************************
--- sqlite3.pir output ---
Opening database: rc=0
Ran prepare statement, rc=21
Ran step, rc=0
Ran finalize, rc=0
Ran close, rc=21
************************************************************************

http://github.com/asciiville/parrot-playground/blob/c07dbcff08a8f5d5d1033f21de2c33f379804981/sqlite3.pir

The
hope is that this experimentation could lead to an interim database
interface solution until that area stabilizes in Parrot/Rakudo. I did
ask around on #perl6 but it appears the emphasis is still on
stabilizing Rakudo core at this point. If the PIR solution works, it
can be used as a Parrot runtime library from within Rakudo, similar to
the way that other libraries like Digest::MD5 are used.



#!/usr/bin/perl6



Q:PIR {

  load_bytecode 'Digest/MD5.pir'

  .local pmc fn_md5, fn_print



  fn_md5   = get_hll_global ['Digest'], '_md5sum'

  fn_print = get_hll_global ['Digest'], '_md5_print'



  $P0 = fn_md5("foo") 

  fn_print($P0)



};



C:\t\dv\rakudo-perl6\perl6-playground>perl6 test-md5.p6

acbd18db4cc2f85cedef654fccc4a4d8


Also of note, Parrot has hooks into both PostgreSQL and MySQL, but I ran into a related set of problems with MySQL, mainly
 interfacing to the client libs. No experiments were done with Postgres though. And then again, maybe it is a WinTel thang. I'll try again on Linux too.

T







-- Todd Presta

-- http://www.asciiville.com

--- On Wed, 7/15/09, toddpresta at sbcglobal.net <toddpresta at sbcglobal.net> wrote:

From: toddpresta at sbcglobal.net <toddpresta at sbcglobal.net>
Subject: [Thousand-oaks-pm] Perl 6 Hackathon DB Progress
To: "perlmongers" <thousand-oaks-pm at mail.pm.org>
Date: Wednesday, July 15, 2009, 7:52 PM

Hey All,

Unless I'm missing something completely obvious, it doesn't seem like the SQLite3 extension is working too good at this point. I've built bleeding edge and pittsburgh with the corresponding versions of parrot using the --gen-parrot switch on both WinTel and Linux, but I have to go back and hack dependencies to get the extension to build at all. I got to a point where running a Perl 6 test in the parrot/ext/SQLite3/t directory would open/create a database, but then would immediately segfault. Running Perl 6 with a trace flag on the test program generated roughly 60Meg of output text before I had to login to another shell and kill my process. :)

I'm going to go back and do a fresh install of latest and greatest just for a reality check. Maybe it is time to ask around on IRC as well.

Since we're in mid-July,
 chances are that there will be another release of Rakudo any day now according to the release goals. When this happens, I will pull it down and try to build the
 extension again and peruse trac for whatever has changed. My gut feeling is that the REST approach using Perl 5 and DBI might be the most expedient means to get some level of data persistence at this point.

T







-- Todd Presta

-- http://www.asciiville.com
-----Inline Attachment Follows-----

_______________________________________________
Thousand-oaks-pm mailing list
Thousand-oaks-pm at pm.org
http://mail.pm.org/mailman/listinfo/thousand-oaks-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/thousand-oaks-pm/attachments/20090720/b9d5b495/attachment.html>


More information about the Thousand-oaks-pm mailing list