-// connect to database
-mysql_pconnect($server, $username, $password) or die("Could not connect");
-mysql_select_db($database) or die("Could not select database");
+ $db = new SQLiteDatabase($dbFile);
+ if (!$hasDB) {
+ $db->query(readCreateSql());
+ }
+ return $db;
+}
+
+function readCreateSql() {
+ $filename = "grid-demo.sql";
+ $file = fopen($filename, 'r');
+ $data = fread($file, filesize($filename));
+ fclose($file);
+ return $data;
+}