Author: simon
Date: Fri Dec  5 07:27:11 2008
New Revision: 33511

Modified:
   trunk/ext/SQLite3/test.p6

Log:
Turn this into a DBDI-based test. Dear test fairies: please make it output TAP.


Modified: trunk/ext/SQLite3/test.p6
==============================================================================
--- trunk/ext/SQLite3/test.p6   (original)
+++ trunk/ext/SQLite3/test.p6   Fri Dec  5 07:27:11 2008
@@ -1,5 +1,16 @@
-use SQLite3;
-our $db := SQLite::open("test.db");
-our $st := SQLite::prepare($db, "CREATE TABLE foo (bar)");
-SQLite::step($st);
-SQLite::finalize($st);
+use DBDI;
+my $conn = DBDI::DriverManager.getConnection("dbdi:SQLite3:test.db", "", "");
+my $stm = $conn.createStatement();
+my $rs = $stm.executeUpdate("CREATE TABLE foo (bar, baz)");
+
+my $stm = $conn.prepareStatement("INSERT INTO foo (bar, baz) VALUES (?, ?)");
+$stm.bind(1, 123);
+$stm.bind(2, "Thingy");
+$stm.executeUpdate();
+
+my $stm2 = $conn.createStatement();
+my $rs = $stm2.executeQuery("SELECT baz, bar FROM foo");
+while ($rs.next()) {
+    say $rs.getCol(1);
+    say $rs.getCol("baz");
+}

Reply via email to