PHP PDO key/value abstraction layer

source, phpdoc

create test database

require_once('kv.php'); $ds = new kvstore(new PDO($dsn,$user,$pass),'table-0'); $ds->dropTable(); $ds->createTable(); $ds->errorExceptions(); //$ds->errorSilent(); //$ds->errorWarning();

insert sample value and retrive it

$ds->set('key', 'value'); $v = $ds->get('key'); Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 no such table: table-0' in /usr/home/mt3o/domains/rashell.pl/public_html/kv.php:113 Stack trace: #0 /usr/home/mt3o/domains/rashell.pl/public_html/kv.php(113): PDO->prepare('REPLACE INTO `t...') #1 /usr/home/mt3o/domains/rashell.pl/public_html/kv_example.php(55): kvstore->set('key', 'value') #2 {main} thrown in /usr/home/mt3o/domains/rashell.pl/public_html/kv.php on line 113