示例#1
0
//*******************************************************
// 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";
//======================================================
// Standard Query
//======================================================
include "{$test_dir}/standard_query.inc.php";
//======================================================
// Prepared Query
示例#2
0
 public function start_fieldset($legend = '', $fs_attrs = false, $l_attrs = false)
 {
     $fs_content = '';
     if (!is_array($fs_attrs)) {
         $fs_attrs = array();
     }
     if ($legend != '') {
         if (!is_array($l_attrs)) {
             $l_attrs = array();
         }
         $fs_content = trim(xhe('legend', $legend, $l_attrs));
     }
     $this->start_section('fieldset', $fs_attrs, $fs_content);
 }
示例#3
0
$strsql3 = 'delete from contacts where id IN (?, ?, ?, ?, ?)';
$data1->prepare($strsql3);
$affect_rows = $data1->execute(array('iiiii', 0, 10, 11, 12, 13));
print div(xhe('strong', 'Affected Rows: ') . $affect_rows);
$data1->rollback();
//***********************************************************************
// Rows should still exist
//***********************************************************************
print_sub_header('They should still be there...');
$data1->prepare($strsql);
$affect_rows = $data1->execute(array('iiii', 10, 11, 12, 13));
print div(xhe('strong', 'Affected Rows: ') . $affect_rows);
$data = $data1->data_key_assoc('id');
print_array($data);
//***********************************************************************
// Delete four rows and commit
//***********************************************************************
print_sub_header('Deleted the four rows that were added then committed.');
$data1->prepare($strsql3);
$affect_rows = $data1->execute(array('iiiii', 0, 10, 11, 12, 13));
print div(xhe('strong', 'Affected Rows: ') . $affect_rows);
$data1->commit();
//***********************************************************************
// Rows should NOT exist
//***********************************************************************
print_sub_header('They should be gone.');
$data1->prepare($strsql);
$affect_rows = $data1->execute(array('iiii', 10, 11, 12, 13));
$data = $data1->data_key_assoc('id');
print div(xhe('strong', 'Affected Rows: ') . $affect_rows);
print_array($data);
示例#4
0
// 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 or ID not IN (1, 2, 3, 4)';
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.';
$no_trans_msg = 'Data Source Type "' . xhe('em', $data_source_type) . '" does not support transactions.';
//***********************************************************************
// Quick Database Actions Options
//***********************************************************************
$qdba_opts = array('debug' => 1);
//***********************************************************************
//***********************************************************************
// Begin Tests
//***********************************************************************
//***********************************************************************
//======================================================
// Record Set List
//======================================================
include "{$test_dir}/rs_list.inc.php";
//======================================================
// Standard Query
示例#5
0
 protected function header_cell($cell, $content)
 {
     $attrs = array();
     //---------------------------------------------------
     // Check for global Column Attributes
     //---------------------------------------------------
     if (isset($this->rs_attrs['header_attrs'][$cell])) {
         $attrs = $this->rs_attrs['header_attrs'][$cell];
     }
     //---------------------------------------------------
     // Return "cell" element
     //---------------------------------------------------
     if ($this->escape_data) {
         return xhe('cell', xml_escape($content), $attrs);
     } else {
         return xhe('cell', htmlentities($content), $attrs);
     }
 }
示例#6
0
 function select($opts, $attrs = false)
 {
     if ($attrs !== false && !is_array($attrs)) {
         trigger_error('Attributes must be an array.');
         return false;
     }
     $inset = '';
     if (!is_array($opts)) {
         $inset = $opts;
     } else {
         foreach ($opts as $val) {
             $inset .= $val;
         }
     }
     return xhe('select', $inset, $attrs);
 }