function connect() { $this->_conn = @sqlite_factory($this->_db_path); if ($this->_conn === null) { throw new Exception("Unable to connect to database: " . sqlite_error_string($this->_conn->lastError())); } # if # Create the database structure $dbStruct = new SpotStruct_sqlite($this); $dbStruct->createDatabase(); }
function connect() { if (!$this->_conn instanceof PDO) { $this->_conn = new PDO('sqlite:' . $this->_db_path); $this->_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); # Create the database structure $dbStruct = new SpotStruct_sqlite($this); $dbStruct->createDatabase(); } # if }
function analyze() { # Instantieeer een struct object switch($this->_dbEngine) { case 'mysql' : case 'pdo_mysql' : $dbStruct = new SpotStruct_mysql($this->_db); break; case 'pdo_pgsql' : $dbStruct = new SpotStruct_pgsql($this->_db); break; case 'pdo_sqlite' : $dbStruct = new SpotStruct_sqlite($this->_db); break; default : throw new Exception("Onbekende database engine"); } # switch $dbStruct->analyze(); } # analyze