Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Does Parrot have a database interface or API

By: a guest on Feb 28th, 2012  |  syntax: None  |  size: 0.43 KB  |  views: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. use DBDI;
  2. my $conn = DBDI::DriverManager.getConnection(
  3.     "dbdi:SQLite3:test.db", "", "");
  4. my $stm = $conn.createStatement();
  5. my $rs = $stm.executeUpdate("CREATE TABLE foo (bar, baz)");
  6. my $stm = $conn.prepareStatement(
  7.     "    INSERT INTO foo (bar, baz) VALUES (?, ?)");
  8. $stm.setColumn(1, 123);
  9. $stm.setColumn(2, "Thingy");
  10. $stm.executeUpdate();
  11.        
  12. $conn.prepareStatement( Q:sql<INSERT INTO foo (bar, baz) VALUES($bar, $baz)> );