本文整理汇总了PHP中DBModel::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP DBModel::fetch方法的具体用法?PHP DBModel::fetch怎么用?PHP DBModel::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBModel
的用法示例。
在下文中一共展示了DBModel::fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate
public function activate()
{
if ($this->_list !== null) {return false;}
list ($qs, $args) = $this->getSQLQuery();
$q = DB::prepare($qs);
$q->execute($args);
$this->_list = array();
$this->rewind();
foreach ($q->fetchAll() as $row)
{
$this->_list[] = DBModel::fetch($row, $this->_from);
}
return true;
}
示例2: fetch
protected function fetch($row)
{
return DBModel::fetch($row, $this->_table);
}
示例3: activate
public function activate()
{
if ($this->_list !== null) {return false;}
$this->_list = array();
$joins = array();
foreach ($this->_tableOtherKeys as $key => $other)
{
$joins[] = $this->_table.'.'.$other .'='.$this->_otherName.'.'.$this->_otherKeys[$key];
}
$wheres = array();
$args = array();
foreach ($this->_tableThisKeys as $key => $tableKey)
{
$wheres[] = $this->_table.'.'.$tableKey.'=:'.$tableKey;
$keyName = $this->_thisKeys[$key].'_db';
$args[':'.$tableKey] = $this->_instance->$keyName;
}
$query = 'SELECT '.$this->_otherName.'.* FROM ' . $this->_table.
' JOIN ' . $this->_otherName.' ON '. implode(', ', $joins) .
' WHERE ' . implode (' AND ', $wheres);
$q = DB::prepare($query);
$q->execute($args);
foreach ($q->fetchAll() as $row)
{
$this->_list[] = DBModel::fetch($row, $this->_otherName);
}
$this->rewind();
return true;
}
示例4: retrieve
private function retrieve($args)
{
list($queryExpressions, $queryArgs) = $this->params($args);
$q = DB::prepare('SELECT * FROM ' . $this->_class.
' WHERE ' . implode(' AND ', $queryExpressions) .
' ORDER BY sequence');
$q->execute($queryArgs);
$res = array();
foreach ($q->fetchAll() as $row)
{
$res[] = DBModel::fetch($row, $this->_class);
}
return $res;
}