<?PHP
require_once('PDOwrap.php');
error_reporting(E_ALL);
ini_set('display_errors', 'on');
header('Content-Type: text/plain');
$dbw = new PDOwrap('sqlite::memory:');
print_r($dbw->fetchAll('SELECT ? as a, 2 as b, 3 as c UNION SELECT ?, DATE(\'now\'), TIME(\'now\') UNION SELECT ?, 8, 9', [23, 12, 22]));
$SQL = <<< 'END_SQL'
CREATE TABLE [users] (
[login] TEXT NOT NULL,
[paswd] TEXT,
[autht] TEXT,
[email] TEXT,
[created] TEXT NOT NULL,
[logined] TEXT,
[deleted] TEXT
)
END_SQL;
$dbw->exec($SQL);
$dbw->exec('CREATE INDEX [idx_user_auth] ON [users] ([login], [paswd])');
$dbw->exec('INSERT INTO [users] ([login], [paswd], [created], [deleted]) VALUES (\'admin\', \'\', DATETIME(\'now\'), DATETIME(\'now\'))');
$dbw->exec2('INSERT INTO [users] ([login], [paswd], [created]) VALUES (?, ?, DATETIME(\'now\'))', ['User1', md5('password')]);
$SQL = 'INSERT INTO [users] ([login], [paswd], [created]) VALUES (:user, :pass, DATETIME("now"))';
$dbw->exec2($SQL, [
'user' => 'User2',
'pass' => md5('password2')
]);
var_dump($dbw->lastInsertId());
print_r($dbw->fetchAll('SELECT [login], [created], [logined] FROM [users] WHERE [deleted] IS NULL'));