2013-04-09 13:05:49 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* poche, a read it later open source system
|
|
|
|
*
|
|
|
|
* @category poche
|
|
|
|
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
|
|
|
|
* @copyright 2013
|
|
|
|
* @license http://www.wtfpl.net/ see COPYING file
|
|
|
|
*/
|
|
|
|
|
|
|
|
class db {
|
|
|
|
var $handle;
|
2013-04-17 13:32:57 +00:00
|
|
|
function __construct($path) {
|
2013-04-09 13:05:49 +00:00
|
|
|
$this->handle = new PDO($path);
|
2013-04-17 13:11:57 +00:00
|
|
|
$this->handle->exec('CREATE TABLE IF NOT EXISTS "entries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "title" VARCHAR, "url" VARCHAR UNIQUE , "is_read" INTEGER DEFAULT 0, "is_fav" INTEGER DEFAULT 0, "content" BLOB)');
|
2013-04-09 13:05:49 +00:00
|
|
|
$this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
}
|
|
|
|
|
2013-04-17 13:32:57 +00:00
|
|
|
public function getHandle() {
|
2013-04-09 13:05:49 +00:00
|
|
|
return $this->handle;
|
|
|
|
}
|
|
|
|
}
|