Beispiel #1
0
 // TODO: Test database triggers (can be used in db.php).
 //~ $db->createFunction('dbModifiedCallback', 'dbModifiedCallback', 0);
 // {AFTER | BEFORE} {DELETE | INSERT | UPDATE } ON table
 //~ $db->exec("CREATE TRIGGER dbchange AFTER UPDATE ON user
 //~ BEGIN
 //~ dbModifiedCallback();
 //~ END");
 //~ $db = new DBConnector('palma.db');
 echo "Tables=" . $db->querySingle('SELECT count(*) FROM sqlite_master WHERE type="table"') . "\n";
 var_dump($db->query("SELECT * from sqlite_master"));
 $address = $db->ipAddress();
 $db->addUser('testuser1', $address);
 //~ $db->addUser('testuser2', $address);
 //~ $db->addUser('testuser3', $address);
 //~ $db->addUser('testuser4', $address);
 $users = $db->getUsers();
 $db->enableUser('testuser1');
 var_dump($users);
 $db->delUser('haenger', $address);
 $db->delUser('ivwz', $address);
 $db->delUser('skrieg', $address);
 $db->delUser('testuser1', $address);
 $db->delUser('testuser2', $address);
 $db->delUser('testuser3', $address);
 $db->delUser('testuser4', $address);
 echo "Query=" . $db->querySingle('select name from user') . "\n";
 echo "Query=" . $db->querySingle('select count(name) from user') . "\n";
 echo "Query=" . $db->querySingle('select value from setting where key="layout"') . "\n";
 $db->close();
 //~ $db = new DBConnector('palma.db');
 //~ $users = $db->getUsers();