本文整理汇总了PHP中RSFilter函数的典型用法代码示例。如果您正苦于以下问题:PHP RSFilter函数的具体用法?PHP RSFilter怎么用?PHP RSFilter使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RSFilter函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testdb
//.........这里部分代码省略.........
}
#print " CacheFlush ";
#$db->CacheFlush();
$date = $db->SQLDate('d-m-M-Y-\\QQ h:i:s A');
$sql = "SELECT {$date} from ADOXYZ";
print "<p>Test SQLDate: " . htmlspecialchars($sql) . "</p>";
$rs = $db->SelectLimit($sql, 1);
$d = date('d-m-M-Y-') . 'Q' . ceil(date('m') / 3.0) . date(' h:i:s A');
if (!$rs) {
Err("SQLDate query returned no recordset");
} else {
if ($d != $rs->fields[0]) {
Err("SQLDate 1 failed expected: <br>act:{$d} <br>sql:" . $rs->fields[0]);
}
}
$date = $db->SQLDate('d-m-M-Y-\\QQ h:i:s A', $db->DBDate("1974-02-25"));
$sql = "SELECT {$date} from ADOXYZ";
print "<p>Test SQLDate: " . htmlspecialchars($sql) . "</p>";
$db->debug = 1;
$rs = $db->SelectLimit($sql, 1);
$ts = ADOConnection::UnixDate('1974-02-25');
$d = date('d-m-M-Y-', $ts) . 'Q' . ceil(date('m', $ts) / 3.0) . date(' h:i:s A', $ts);
if (!$rs) {
Err("SQLDate query returned no recordset");
echo $db->ErrorMsg(), '<br>';
} else {
if ($d != reset($rs->fields)) {
Err("SQLDate 2 failed expected: <br>act:{$d} <br>sql:" . $rs->fields[0] . ' <br>' . $db->ErrorMsg());
}
}
print "<p>Test Filter</p>";
$db->debug = 1;
$rs = $db->SelectLimit('select * from ADOXYZ where id < 3 order by id');
$rs = RSFilter($rs, 'do_strtolower');
if (trim($rs->fields[1]) != 'caroline' && trim($rs->fields[2]) != 'miranda') {
err('**** RSFilter failed');
print_r($rs->fields);
}
rs2html($rs);
$db->debug = 1;
print "<p>Test Replace</p>";
$ret = $db->Replace('ADOXYZ', array('id' => 1, 'firstname' => 'Caroline', 'lastname' => 'Miranda'), array('id'), $autoq = true);
if (!$ret) {
echo "<p>Error in replacing existing record</p>";
} else {
$saved = $db->debug;
$db->debug = 0;
$savec = $ADODB_COUNTRECS;
$ADODB_COUNTRECS = true;
$rs = $db->Execute('select * FROM ADOXYZ where id=1');
$db->debug = $saved;
if ($rs->RecordCount() != 1) {
$cnt = $rs->RecordCount();
rs2html($rs);
print "<b>Error - Replace failed, count={$cnt}</b><p>";
}
$ADODB_COUNTRECS = $savec;
}
$ret = $db->Replace('ADOXYZ', array('id' => 1000, 'firstname' => 'Harun', 'lastname' => 'Al-Rashid'), array('id', 'firstname'), $autoq = true);
if ($ret != 2) {
print "<b>Replace failed: </b>";
}
print "test A return value={$ret} (2 expected) <p>";
$ret = $db->Replace('ADOXYZ', array('id' => 1000, 'firstname' => 'Sherazade', 'lastname' => 'Al-Rashid'), 'id', $autoq = true);
if ($ret != 1) {
if ($db->dataProvider == 'ibase' && $ret == 2) {
示例2: testdb
//.........这里部分代码省略.........
print "<p><b>Invalid date {$rs->fields[0]}</b></p>";
} else {
print "<p>Passed \$sysDate test ({$rs->fields[0]})</p>";
}
print_r($rs->FetchField(0));
print time();
$db->debug = $saved;
} else {
print "<p><b>\$db->sysDate not defined</b></p>";
}
print "<p>Test CSV</p>";
include_once '../toexport.inc.php';
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->SelectLimit('select id,firstname,lastname,created,\'The "young man", he said\' from adoxyz', 10);
print "<pre>";
print rs2csv($rs);
print "</pre>";
$rs = $db->SelectLimit('select id,firstname,lastname,created,\'The "young man", he said\' from adoxyz', 10);
print "<pre>";
rs2tabout($rs);
print "</pre>";
//print " CacheFlush ";
//$db->CacheFlush();
$date = $db->SQLDate('d-m-Y-\\QQ');
$sql = "SELECT {$date} from ADOXYZ";
print "<p>Test SQLDate: " . htmlspecialchars($sql) . "</p>";
$rs = $db->SelectLimit($sql, 1);
$d = date('d-m-Y-') . 'Q' . ceil(date('m') / 3.0);
if ($d != $rs->fields[0]) {
Err("SQLDate failed expected: {$d}, sql:" . $rs->fields[0]);
}
print "<p>Test Filter</p>";
$rs = $db->SelectLimit('select * from ADOXYZ where id < 3 order by id');
$rs = RSFilter($rs, 'do_strtolower');
if (trim($rs->fields[1]) != 'caroline' && trim($rs->fields[2]) != 'miranda') {
err('**** RSFilter failed');
print_r($rs->fields);
}
rs2html($rs);
$db->debug = 1;
print "<p>Test Replace</p>";
$ret = $db->Replace('adoxyz', array('id' => 1, 'firstname' => 'Caroline', 'lastname' => 'Miranda'), array('id'), $autoq = true);
if (!$ret) {
echo "<p>Error in replacing existing record</p>";
} else {
$saved = $db->debug;
$db->debug = 0;
$savec = $ADODB_COUNTRECS;
$ADODB_COUNTRECS = true;
$rs = $db->Execute('select * FROM ADOXYZ where id=1');
$db->debug = $saved;
if ($rs->RecordCount() != 1) {
$cnt = $rs->RecordCount();
rs2html($rs);
print "<b>Error - Replace failed, count={$cnt}</b><p>";
}
$ADODB_COUNTRECS = $savec;
}
$ret = $db->Replace('adoxyz', array('id' => 1000, 'firstname' => 'Harun', 'lastname' => 'Al-Rashid'), array('id', 'firstname'), $autoq = true);
if ($ret != 2) {
print "<b>Replace failed: </b>";
}
print "test A return value={$ret} (2 expected) <p>";
$ret = $db->Replace('adoxyz', array('id' => 1000, 'firstname' => 'Sherazade', 'lastname' => 'Al-Rashid'), 'id', $autoq = true);
if ($ret != 1) {
if ($db->dataProvider == 'ibase' && $ret == 2) {