mirror of
https://github.com/xivapi/ffxiv-datamining.git
synced 2026-07-24 10:59:11 +00:00
39 lines
660 B
PHP
39 lines
660 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Libra Database
|
||
|
|
*
|
||
|
|
* @version 1.0
|
||
|
|
* @author Josh Freeman <josh@viion.co.uk>
|
||
|
|
*/
|
||
|
|
|
||
|
|
use \PDO;
|
||
|
|
|
||
|
|
class LiteDatabase
|
||
|
|
{
|
||
|
|
protected $connection;
|
||
|
|
|
||
|
|
function __construct($sqlite)
|
||
|
|
{
|
||
|
|
if (!file_exists($sqlite)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
// create connection
|
||
|
|
$this->connection = new PDO('sqlite:'. $sqlite);
|
||
|
|
if (!$this->connection) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sql($sql)
|
||
|
|
{
|
||
|
|
if (!$this->connection) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
$query = $this->connection->prepare($sql);
|
||
|
|
$query->execute();
|
||
|
|
return $query->fetchAll();
|
||
|
|
}
|
||
|
|
}
|