Пример #1
0
<?php

//***********************************************************************
// Standard Query
//***********************************************************************
print_header('Standard Query');
$strsql = 'select * from contacts where id IN (2, 4)';
$data1->data_query($strsql);
print_array($data1->data_assoc_result());
//***********************************************************************
// Standard Query using qdb_list()
//***********************************************************************
print_header('Standard Query using qdb_list()');
$strsql = 'select * from contacts where id IN (1, 3)';
print_array(qdb_list($data_source, $strsql));
Пример #2
0
include 'tests/contact.class.php';
//*******************************************************
// Test Directory
//*******************************************************
$test_dir = dirname(__FILE__) . '/tests';
//*******************************************************
// New Data Transaction
//*******************************************************
$data1 = new data_trans($data_source);
$data1->data_debug(true);
$data1->set_opt('make_bind_params_refs', 1);
//***********************************************************************
// Delete Rows with ID > 5
//***********************************************************************
$strsql00 = 'delete from contacts where id > 5';
qdb_list($data_source, $strsql00);
//***********************************************************************
// Messages
//***********************************************************************
$no_setup_msg = 'Invalid Setup.';
$no_bind_msg = 'Data Source Type "' . xhe('em', $data_source_type) . '" does not support bind parameters.';
//***********************************************************************
//***********************************************************************
// Begin Tests
//***********************************************************************
//***********************************************************************
//======================================================
// Record Set List
//======================================================
include "{$test_dir}/rs_list.inc.php";
//======================================================
Пример #3
0
<?php

//=================================================================
// Top Module Links
//=================================================================
$top_mod_links = array();
// Basic Tests
$top_mod_links["links"][] = array("link" => $this->page_url, "desc" => "Basic Tests", "image" => xml_escape($db_image));
// Database Transactions
$tmp_link = add_url_params($this->page_url, array("action" => "db_trans"), true);
$top_mod_links["links"][] = array("link" => $tmp_link, "desc" => "Transactions Tests", "image" => xml_escape($db_trans_image));
//=================================================================
// Pull a list records
//=================================================================
$strsql = "select * from contacts order by first_name, last_name";
$contacts = qdb_list($data_source, $strsql);
//=================================================================
// Alter dataset if Oracle or DB2
//=================================================================
lower_rec_keys($driver_type, $contacts);
foreach ($contacts as $key => $contact) {
    extract($contact);
    $edit_link = add_url_params($this->page_url, array("action" => "edit", "id" => $id));
    $delete_link = add_url_params($this->page_url, array("action" => "confirm_delete", "id" => $id));
    $contacts[$key]["edit"] = anchor($edit_link, $edit_image);
    $contacts[$key]["delete"] = anchor($delete_link, $delete_image);
    if (isset($change_id) && $id == $change_id) {
        $change_row = $key;
    }
}
//=================================================================
Пример #4
0
// Data_Trans Debug Setting
//------------------------------------------------
if ($tmp_debug) {
    $data1->data_debug(true);
}
//------------------------------------------------
// Insert Row #1
//------------------------------------------------
$data1->data_query($strsql1);
//------------------------------------------------
// Insert Row #2
//------------------------------------------------
if ($tmp_debug) {
    qdb_list($data_source, $strsql2, false, $qdba_opts);
} else {
    qdb_list($data_source, $strsql2);
}
//------------------------------------------------
// Insert Row #3
//------------------------------------------------
if ($tmp_debug) {
    qdb_exec($data_source, $strsql3, $params, false, $qdba_opts);
} else {
    qdb_exec($data_source, $strsql3, $params);
}
//------------------------------------------------
// Insert Row #4
//------------------------------------------------
//print_array($test_vals[3]);
$contact = new contact(false);
$contact->use_bind_params();
Пример #5
0
$data1->auto_commit(false);
//***********************************************************************
// Insert four test rows:
//***********************************************************************
print_sub_header('Insert four test rows using the data_trans (prepared), qdb_list(), qdb_exec(), and DIO.');
//-----------------------------------------------------------
// "data_trans" Prepared Query
//-----------------------------------------------------------
$strsql2 = 'insert into contacts (id, first_name, last_name, city, state) values (?, ?, ?, ?, ?)';
$data1->prepare($strsql2);
$affect_rows = $data1->execute(array('issss', 10, 'bob', 'bobson', 'Toowalk', 'MN'));
//-----------------------------------------------------------
// "qdb_list()"
//-----------------------------------------------------------
//$data1->execute(array('issss', 11, 'john', 'smith', 'Racine', 'WI'));
qdb_list($data_source, "\n\tinsert into contacts \n\t\t(id, first_name, last_name, city, state) \n\t\tvalues \n\t\t(11, 'john', 'smith', 'Racine', 'WI')\n");
//-----------------------------------------------------------
// "qdb_exec()"
//-----------------------------------------------------------
//$data1->execute(array('issss', 12, 'todd', 'tomom', 'Where', 'FL'));
$id = 12;
$fname = 'todd';
$lname = 'tomrom';
$city = 'Where';
$state = 'FL';
qdb_exec($data_source, $strsql2, array('issss', &$id, &$fname, &$lname, &$city, &$state));
//-----------------------------------------------------------
// "DIO"
//-----------------------------------------------------------
//$data1->execute(array('issss', 13, 'ricky', 'richards', 'Here', 'OH'));
// Create New Object