本文整理汇总了PHP中ADORecordSet类的典型用法代码示例。如果您正苦于以下问题:PHP ADORecordSet类的具体用法?PHP ADORecordSet怎么用?PHP ADORecordSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ADORecordSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBTimeStamp
function DBTimeStamp($ts)
{
if (is_string($ts)) {
$d = ADORecordSet::UnixTimeStamp($ts);
}
return 'TO_DATE(' . date($this->fmtTimeStamp, $ts) . ",'RRRR-MM-DD, HH:MI:SS AM')";
}
示例2: DBTimeStamp
function DBTimeStamp($ts)
{
if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
if (is_object($ts)) $ds = $ts->format($this->fmtDate);
else $ds = adodb_date($this->fmtTimeStamp,$ts);
return 'TO_DATE('.$ds.",'RRRR-MM-DD, HH:MI:SS AM')";
}
示例3: DBTimeStamp
function DBTimeStamp($ts)
{
if (empty($ts) && $ts !== 0) {
return 'null';
}
if (is_string($ts)) {
$ts = ADORecordSet::UnixTimeStamp($ts);
}
return 'TO_DATE(' . date($this->fmtTimeStamp, $ts) . ",'RRRR-MM-DD, HH:MI:SS AM')";
}
示例4: _getObjectsFromResult
/**
* @param ADORecordSet $rs
* @return Model_WebapiKey[]
*/
private static function _getObjectsFromResult($rs)
{
$objects = array();
while (!$rs->EOF) {
$object = new Model_WebapiKey();
$object->id = intval($rs->fields['id']);
$object->nickname = $rs->fields['nickname'];
$object->access_key = $rs->fields['access_key'];
$object->secret_key = $rs->fields['secret_key'];
$rights = $rs->fields['rights'];
if (!empty($rights)) {
@($object->rights = unserialize($rights));
}
$objects[$object->id] = $object;
$rs->MoveNext();
}
return $objects;
}
示例5:
function &GetRowAssoc($upper = true)
{
if ($this->fetchMode == PGSQL_ASSOC && !$upper) {
return $this->fields;
}
$row =& ADORecordSet::GetRowAssoc($upper);
return $row;
}
示例6: GetRowAssoc
function GetRowAssoc($upper = true)
{
if ($this->fetchMode == MYSQL_ASSOC && !$upper) {
$row = $this->fields;
} else {
$row = ADORecordSet::GetRowAssoc($upper);
}
return $row;
}
示例7: db_fetch_array
/**
* Retrieve the next row returned from a specific database query
* @param bool|ADORecordSet $p_result Database Query Record Set to retrieve next result for.
* @return array Database result
*/
function db_fetch_array(&$p_result)
{
global $g_db, $g_db_type;
if ($p_result->EOF) {
return false;
}
# mysql obeys FETCH_MODE_BOTH, hence ->fields works, other drivers do not support this
if ($g_db_type == 'mysql' || $g_db_type == 'odbc_mssql' || $g_db_type == 'mssqlnative') {
$t_array = $p_result->fields;
$p_result->MoveNext();
return $t_array;
} else {
$t_row = $p_result->GetRowAssoc(false);
static $t_array_result;
static $t_array_fields;
if ($t_array_result != $p_result) {
// new query
$t_array_result = $p_result;
$t_array_fields = null;
} else {
if ($t_array_fields === null) {
$p_result->MoveNext();
return $t_row;
}
}
$t_convert = false;
$t_fieldcount = $p_result->FieldCount();
for ($i = 0; $i < $t_fieldcount; $i++) {
if (isset($t_array_fields[$i])) {
$t_field = $t_array_fields[$i];
} else {
$t_field = $p_result->FetchField($i);
$t_array_fields[$i] = $t_field;
}
switch ($t_field->type) {
case 'bool':
switch ($t_row[$t_field->name]) {
case 'f':
$t_row[$t_field->name] = false;
break;
case 't':
$t_row[$t_field->name] = true;
break;
}
$t_convert = true;
break;
default:
break;
}
}
if ($t_convert == false) {
$t_array_fields = null;
}
$p_result->MoveNext();
return $t_row;
}
}
示例8: _getObjectsFromResult
/**
* @param ADORecordSet $rs
* @return Model_WatcherMailFilter[]
*/
private static function _getObjectsFromResult($rs)
{
$objects = array();
while (!$rs->EOF) {
$object = new Model_WatcherMailFilter();
$object->id = $rs->fields['id'];
$object->pos = $rs->fields['pos'];
$object->name = $rs->fields['name'];
$object->created = $rs->fields['created'];
$object->is_disabled = intval($rs->fields['is_disabled']);
$object->worker_id = intval($rs->fields['worker_id']);
if (null != @($criteria_ser = $rs->fields['criteria_ser'])) {
if (false === @($object->criteria = unserialize($criteria_ser))) {
$object->criteria = array();
}
}
if (null != @($actions_ser = $rs->fields['actions_ser'])) {
if (false === ($object->actions = unserialize($actions_ser))) {
$object->actions = array();
}
}
$objects[$object->id] = $object;
$rs->MoveNext();
}
return $objects;
}
示例9: _getObjectsFromResultSet
private static function _getObjectsFromResultSet(ADORecordSet $rs)
{
$objects = array();
while (!$rs->EOF) {
$tag = new CloudGlueTag();
$tag->id = intval($rs->fields['id']);
$tag->name = $rs->fields['name'];
$objects[$tag->id] = $tag;
$rs->MoveNext();
}
return $objects;
}
示例10: GetRowAssoc
public function GetRowAssoc($upper = true)
{
if ($this->fetchMode == MYSQLI_ASSOC && !$upper) {
return $this->fields;
}
$row = ADORecordSet::GetRowAssoc($upper);
return $row;
}
示例11: DBTimeStamp
function DBTimeStamp($ts)
{
if (empty($ts) && $ts !== 0) {
return 'null';
}
if (is_string($ts)) {
$ts = ADORecordSet::UnixTimeStamp($ts);
}
// See #8387 for more details
// original: return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'YYYY-MM-DD HH24:MI:SS')";
return adodb_date($this->fmtTimeStamp, $ts);
}
示例12: testdb
//.........这里部分代码省略.........
$fld = $rs->FetchField($i);
print "<br> Field name is " . $fld->name;
print " " . $rs->Fields($fld->name);
}
}
print "<p>NUM TEST 2<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = $db->query('select * from adoxyz order by id');
for ($i = 0; $i < $rs->FieldCount(); $i++) {
$fld = $rs->FetchField($i);
print "<br> Field name is " . $fld->name;
print " " . $rs->Fields($fld->name);
}
print "<p>ASSOC Test of SelectLimit<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->selectlimit('select * from adoxyz order by id', 3, 4);
$cnt = 0;
while ($rs && !$rs->EOF) {
$cnt += 1;
if (!isset($rs->fields['firstname'])) {
print "<br><b>ASSOC returned numeric field</b></p>";
break;
}
$rs->MoveNext();
}
if ($cnt != 3) {
print "<br><b>Count should be 3, instead it was {$cnt}</b></p>";
}
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($db->sysDate) {
$saved = $db->debug;
$db->debug = 1;
$rs = $db->Execute("select {$db->sysDate} from adoxyz where id=1");
if (ADORecordSet::UnixDate(date('Y-m-d')) != $rs->UnixDate($rs->fields[0])) {
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>";
示例13: testdb
//.........这里部分代码省略.........
$fld = $rs->FetchField($i);
print "<br> Field name is " . $fld->name;
print " " . $rs->Fields($fld->name);
}
}
print "<p>NUM TEST 2<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = $db->query('select * from ADOXYZ order by id');
for ($i = 0; $i < $rs->FieldCount(); $i++) {
$fld = $rs->FetchField($i);
print "<br> Field name is " . $fld->name;
print " " . $rs->Fields($fld->name);
}
print "<p>ASSOC Test of SelectLimit<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->selectlimit('select * from ADOXYZ order by id', 3, 4);
$cnt = 0;
while ($rs && !$rs->EOF) {
$cnt += 1;
if (!isset($rs->fields['firstname'])) {
print "<br><b>ASSOC returned numeric field</b></p>";
break;
}
$rs->MoveNext();
}
if ($cnt != 3) {
print "<br><b>Count should be 3, instead it was {$cnt}</b></p>";
}
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($db->sysDate) {
$saved = $db->debug;
$db->debug = 1;
$rs = $db->Execute("select {$db->sysDate} from ADOXYZ where id=1");
if (ADORecordSet::UnixDate(date('Y-m-d')) != $rs->UnixDate($rs->fields[0])) {
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,\'He, he\' he,\'"\' q 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);
if (PHP_VERSION < 5) {
print "<pre>";
rs2tabout($rs);
print "</pre>";
}
#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");
示例14: GetRowAssoc
function GetRowAssoc($upper = ADODB_ASSOC_CASE)
{
if ($this->fetchMode == MYSQL_ASSOC && $upper == ADODB_ASSOC_CASE_LOWER) {
$row = $this->fields;
} else {
$row = ADORecordSet::GetRowAssoc($upper);
}
return $row;
}
示例15: getNextByLoadId
/**
* Get next temporary stats record by load id.
* @param $loadId string
* @return mixed array or false if the end of
* records is reached.
*/
function getNextByLoadId($loadId)
{
if (!$this->_result || $this->_loadId != $loadId) {
$this->_result = $this->_getGrouped($loadId);
$this->_loadId = $loadId;
}
if ($this->_result->EOF) {
return false;
}
$row = $this->_result->GetRowAssoc(false);
$this->_result->MoveNext();
return $row;
}