//------------------------------------------------------------- // There should be four records //------------------------------------------------------------- print_sub_header('There should be 4 records now...'); print_array(qdb_list($data_source, $strsql0)); //------------------------------------------------------------- // Delete the Four Rows //------------------------------------------------------------- print_sub_header('Delete the 4 rows...'); qdb_list($data_source, $strsql01); //------------------------------------------------------------- // Commit //------------------------------------------------------------- print_sub_header('Commit...'); $data1->commit(); //------------------------------------------------------------- // There should be no records now //------------------------------------------------------------- print_sub_header('There should be 0 records now...'); print_array(qdb_list($data_source, $strsql0)); } else { print div($no_setup_msg, array('class' => 'message_box no_setup')); } //*********************************************************************** // Turn on auto commit //*********************************************************************** $data1->auto_commit(true); print_sub_header('Turning Auto Commit ON'); } else { print div($no_trans_msg, array('class' => 'message_box notice')); }
$data1->prepare($strsql2); $data1->execute($params); $data1->commit(); print_sub_header('Inserted two rows and committed. They should exist...'); $data1->prepare($strsql); $data1->execute(array(&$param1, &$param2)); $data = $data1->data_key_assoc('id'); print_array($data); print_sub_header('Deleted the two rows that were added then rolled back.'); $strsql3 = 'delete from contacts where id IN (?, ?)'; $data1->prepare($strsql3); $data1->execute(array(&$param1, &$param2)); $data1->rollback(); //$data1->commit(); print_sub_header('They should still be there...'); $data1->prepare($strsql); $data1->execute(array(&$param1, &$param2)); $data = $data1->data_key_assoc('id'); print_array($data); print_sub_header('Deleted the two rows that were added then committed.'); $data1->prepare($strsql3); $data1->execute(array(&$param1, &$param2)); $data1->commit(); print_sub_header('They should gone.'); $data1->prepare($strsql); $data1->execute(array(&$param1, &$param2)); $data = $data1->data_key_assoc('id'); print_array($data); // Stop Benchmark $cb->stop_timer(); $cb->print_results(true);
<?php //*********************************************************************** //*********************************************************************** // Test Database Interface Object //*********************************************************************** //*********************************************************************** print_header('Test Database Interface Object'); // Create New Object $contact = new contact(); // Dump Table Info print_sub_header('Create Object, Show Table Info'); $contact->dump(); // Load a new record and dump it to screen print_sub_header('Load Empty Record'); $contact->load(''); $contact->dump('data'); // Load an existing record and dump it to screen print_sub_header('Load Existing Record'); $contact->load(1); $contact->dump('data');