} print "running column exists test...\n"; if (!$adb->columnExists('users', 'name')) { goDead("columnExists(name) failed."); } if (!$adb->columnExists('users', 'surname')) { goDead("columnExists(surname) failed."); } print "[OK] all well so far.\n"; if (!$adb->columnExists('users', 'date')) { goDead("columnExists(date) failed."); } print "clearing table...\n"; $adb->deleteRecords('users', ['1' => '1']); print "inserting record to users...\n"; $adb->insert('users', ['name' => 'Archangel', 'surname' => 'Design', 'date' => '791']); $testData = $adb->fetchOne('users', ['name' => 'Archangel', 'surname' => 'Design', 'date' => '791']); if (!is_array($testData)) { goDead("Insert, fetch test failed."); } if (!isset($testData['name']) || !isset($testData['surname']) || !isset($testData['date'])) { goDead("Fetch data test failed."); } if ($testData['name'] != 'Archangel' || $testData['surname'] != 'Design' || $testData['date'] != '791') { goDead("fetchOne returned unexpected data."); } print "[OK] insert works fine.\n"; /** * ===== UPDATE TEST ===== */ print "testing updates...\n";
<?php /** * Archangel DB 2 * www.archangel-design.com * @author Rafal Martinez-Marjanski */ require 'autoload_register.php'; $adb = new \ArchangelDB\ADB2(); $res = $adb->tableExists('users'); die; $res = $adb->insert('users', ['name' => 'Pascal', 'surname' => 'Picolo', 'date' => 'now()']); var_dump($adb->getLastQuery()); var_dump($adb->lastInsertId()); var_dump($adb->updateRecords('users', ['id' => 34, 'name' => 'Pascal', 'date' => '321321321'])); var_dump($adb->getLastQuery()); var_dump($adb->fetchAll('users'));