public static function db() { if (self::$db == NULL) { self::$db = new SQLiteDatabase(":memory:"); //sqlite_open(":memory:"); self::$db->createFunction('REGEXP', array('cw_sqlite','cw_sqlite_regex'), 2); self::loaddb(self::$db); } return self::$db; }