<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Ok. I might be able to sleep tonight.<br><br>Even with Parrot 1.4 out, still getting build errors when trying to use ncigen for the SQLite3 extension.<br><br>On another front, the NCI functionality within Parrot seems to choke whenever requesting SQLite database connection handle and prepared statement handle no matter what type of PMC is passed as a parameter during the SQLite dynamic library function calls from within Parrot PIR. Using either Pointer, CPointer, UnManagedStruct, ManagedStruct, or ResizablePMCArray either segfaults or returns an erroneous value.<br><br>I decided to go deep and write some C code, basically wrapping both the sqlite3_open and sqlite3_prepare functions in the SQLite3 dynamic library and returning the pointers as the function return values rather than as a reference parameters.<br><br>This following PIR snippet calls my dynamic
 library (birdseed), the SQLite3 dynamic library, and obtains the last column value of a row returned from a prepared statement.<br><br><span style="font-family: courier,monaco,monospace,sans-serif;">.sub main :main</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; .local pmc sqllib, bslib</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; .local pmc fn_dbh, dbh, fn_sth, sth, fn_close, fn_step, fn_final, fn_col_t</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; bslib&nbsp; = loadlib "birdseed"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; sqllib = loadlib "sqlite3"</span><br style="font-family:
 courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; $S0 = "select * from dummy"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; fn_dbh&nbsp;&nbsp; = dlfunc bslib,&nbsp; "get_db_handle",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "pt"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; fn_sth&nbsp;&nbsp; = dlfunc bslib,&nbsp; "get_statement_handle", "ppt"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; fn_step&nbsp; = dlfunc sqllib, "sqlite3_step",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "ip"</span><br
 style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; fn_final = dlfunc sqllib, "sqlite3_finalize",&nbsp;&nbsp;&nbsp;&nbsp; "ip"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; fn_col_t = dlfunc sqllib, "sqlite3_column_text",&nbsp; "tpi"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; fn_close = dlfunc sqllib, "sqlite3_close",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "ip"</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; dbh = fn_dbh("dummy.db") </span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family:
 courier,monaco,monospace,sans-serif;">&nbsp; sth = fn_sth(dbh, "select * from dummy")</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp;</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; $I1 = fn_step(sth)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; say $I1</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; $S0 = fn_col_t(sth, 1)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; say $S0</span><br style="font-family:
 courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; $I2 = fn_final(sth)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; say $I2</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; $I3 = fn_close(dbh)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">&nbsp; say $I3</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">.end</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br style="font-family:
 courier,monaco,monospace,sans-serif;">Here is the resulting output from Parrot<br><br><span style="font-family: courier,monaco,monospace,sans-serif;">C:\t\dv\parrot\PARROT~1\birdseed&gt;parrot birdseed.pir<br>get_db_handle: got here<br>get_statement_handle: got here<br>100<br>This is tag 1<br>0<br>0</span><br><br>Basically, the line that reads "This is tag 1" is the second column of the first row returned from the table "dummy." The lines beginning with "get_" are being printf'd from my library. 100 is SQLITE_ROW (that is a row ready for plucking), and the 0's are SQLITE_OK.<br><br>So the trick now is to determine if the SQLite3.pir under &lt;parrot src tree&gt;/etc/SQLite3 can be retrofitted with the "potential" birdseed dynamic library and then be recognized by &lt;parrot src tree&gt;/etc/SQLite3/DBDI/Driver/SQLite3.pm.<br><br>More on this later ...<br><br>"Er uh, we're still doing the project, right?" :)<br><br><br><br>T<br><br><br><br>-- Todd
 Presta<br>
-- http://www.asciiville.com</td></tr></table>