From d9250b0ac3bbd13b17ab6a0a8b53a887471c21f6 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Thu, 3 May 2012 10:59:08 +0200 Subject: [PATCH] remove segfaulting sqlite example, point to working DBDish/*.pm6 modules instead --- README.markdown | 7 ++- examples/sqlite3.p6 | 103 -------------------------------------------- 2 files changed, 3 insertions(+), 107 deletions(-) delete mode 100644 examples/sqlite3.p6 diff --git a/README.markdown b/README.markdown index da3e17e..acf51fc 100644 --- a/README.markdown +++ b/README.markdown @@ -197,6 +197,9 @@ send in a patch. ;-) The examples directory contains various examples of how to use Zavolaj. +More examples can be found in the lib/DBDish/ directory of the DBIsh repository +at https://github.com/perl6/DBIish/. + ### MySQL There is an exmaple of using the MySQL client library. There is a Rakudo project @@ -228,10 +231,6 @@ You can look at the results via a normal mysql connection: SHOW TABLES; SELECT * FROM nom; -### SQLite3 - -May not be working...let us know if you get success! - ### Microsoft Windows The win32-api-call.p6 script shows a Windows API call done from Perl 6. diff --git a/examples/sqlite3.p6 b/examples/sqlite3.p6 deleted file mode 100644 index fb5c605..0000000 --- a/examples/sqlite3.p6 +++ /dev/null @@ -1,103 +0,0 @@ -# sqlite3.p6 - -# An attempt to use libsqlite3-dev via zavolaj and Parrot NCI; - -# This example does not work yet, because Parrot probably needs at least -# the following signatures added to parrot/src/nci/extra_thunks.nci: -# -# iptppp sqlite3_exec() -# iptipp sqlite3_prepare_v2() -# iptttppppp sqlite3_table_column_metadata() -# -# There will probably be others that will only become apparent after -# these are tried out. - -use NativeCall; - -# -------- foreign function definitions in alphabetical order ---------- - -# See http://sqlite.org/capi3ref.html and http://sqlite.org/quickstart.html - -sub sqlite3_close( OpaquePointer $ppDB ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_column_count( OpaquePointer $ppStmt ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_column_text( OpaquePointer $ppStmt, Int $iCol ) - returns Str - is native('libsqlite3') - { ... } - -sub sqlite3_column_type( OpaquePointer $ppStmt, Int $iCol ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_exec( OpaquePointer $ppDB, Str $sql_command, OpaquePointer $callback, OpaquePointer $callbackarg0, OpaquePointer $error_pointer ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_finalize( OpaquePointer $ppStmt ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_open( Str $filename, OpaquePointer $ppDB ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_open_v2( Str $filename, OpaquePointer $ppDB, Int $flags, Str $zVfs ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_prepare_v2( OpaquePointer $ppDB, Str $sql_command, Int $nByte, OpaquePointer $ppStmt, OpaquePointer $pzTail ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_step( OpaquePointer $ppStmt ) - returns Int - is native('libsqlite3') - { ... } - -sub sqlite3_table_column_metadata(OpaquePointer $ppDB, Str $zDbName, Str $zTableName, Str $zColumnName, Positional of Str $pzDataType, Positional of Str $pzCollSeq, Positional of Int $pNotNull, Positional of Int $pPrimaryKey, Positional of Int $pAutoinc ) - returns Int - is native('libsqlite3') - { ... } - -# ----------------------- main example program ------------------------- - -my OpaquePointer $db; -my OpaquePointer $stmt; -my OpaquePointer $pzTail; -my Positional of Str $pzDataType; -my Positional of Str $pzCollSeq; -my Positional of Int $pNotNull; -my Positional of Int $pPrimaryKey; -my Positional of Int $pAutoinc; - -my $status = sqlite3_open( "test.db", $db ); -say "open status $status"; -$status = sqlite3_exec( $db, "CREATE TABLE a ( b INT );", pir::null__P(), pir::null__P(), pir::null__P() ); -say "exec status $status"; -$status = sqlite3_prepare_v2( $db, "CREATE TABLE a ( b INT );", 0, $stmt, $pzTail ); -say "prepare status $status"; -$status = sqlite3_table_column_metadata($db,"","","",$pzDataType,$pzCollSeq,$pNotNull,$pPrimaryKey,$pAutoinc); -say "table_column_metadata status $status"; -$status = sqlite3_column_text( $stmt, 1 ); -say "step status $status"; -$status = sqlite3_step( $stmt ); -say "step status $status"; -$status = sqlite3_finalize( $stmt ); -say "finalize status $status"; -$status = sqlite3_close( $db ); -say "close status $status"; -