28 lines
592 B
PHP
28 lines
592 B
PHP
|
<?php
|
||
|
/**
|
||
|
* SQLite connnection
|
||
|
*/
|
||
|
class SQLiteConnection {
|
||
|
/**
|
||
|
* PDO instance
|
||
|
* @var type
|
||
|
*/
|
||
|
private $pdo;
|
||
|
|
||
|
/**
|
||
|
* return in instance of the PDO object that connects to the SQLite database
|
||
|
* @return \PDO
|
||
|
*/
|
||
|
public function connect() {
|
||
|
if ($this->pdo == null) {
|
||
|
try {
|
||
|
$this->pdo = new \PDO("sqlite:" . Config::PATH_TO_SQLITE_FILE);
|
||
|
} catch (\PDOException $e) {
|
||
|
// handle the exception here
|
||
|
}
|
||
|
|
||
|
}
|
||
|
return $this->pdo;
|
||
|
}
|
||
|
}
|
||
|
?>
|