topical media & game development

talk show tell print

server-php-sqlite-memory.php / php

  // create a new memory only database
  db = new SQLiteDatabase(":memory:");
  // Create a 2-column table bar & insert 2 rows into it
  /* For improved performance the entire query block is wrapped inside a transaction. */
          CREATE TABLE bar ( id INTEGER PRIMARY KEY, id2 );
          INSERT INTO bar (id2) VALUES(1);
          INSERT INTO bar (id2) VALUES(2);
  // will print "2 insert queries"
  echo db->changes()." insert queries\n";
  // will print "last inserted row id: 2"
  echo "last inserted row id: ".db->lastInsertRowid();

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.