本文整理汇总了PHP中SelectQuery::getFieldsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::getFieldsCount方法的具体用法?PHP SelectQuery::getFieldsCount怎么用?PHP SelectQuery::getFieldsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::getFieldsCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toDialectStringSelect
protected function toDialectStringSelect($query, Dialect $dialect)
{
$fields = array();
foreach ($this->fields as $var => $val) {
$fields[] = $dialect->quoteField($var);
}
if (!$fields) {
throw new WrongStateException('what should i insert?');
}
if ($this->select->getFieldsCount() != count($fields)) {
throw new WrongStateException('count of select fields must be equal with count of insert fields');
}
$fields = implode(', ', $fields);
return $query . "({$fields}) (" . $this->select->toDialectString($dialect) . ")";
}
示例2: getCustomRowList
public function getCustomRowList(SelectQuery $query, $expires = Cache::DO_NOT_CACHE)
{
if ($query->getFieldsCount() !== 1) {
throw new WrongArgumentException('you should select only one row when using this method');
}
if ($expires !== Cache::DO_NOT_CACHE && ($list = $this->getCachedByQuery($query))) {
if ($list === Cache::NOT_FOUND) {
throw new CachedObjectNotFoundException();
}
return $list;
} elseif ($list = DBPool::getByDao($this->dao)->queryColumn($query)) {
if (Cache::DO_NOT_CACHE === $expires) {
return $list;
} else {
return $this->cacheByQuery($query, $list, $expires);
}
} else {
throw new ObjectNotFoundException("empty list" . (defined('__LOCAL_DEBUG__') ? " for such query - " . $query->toDialectString(DBPool::me()->getByDao($this->dao)->getDialect()) : null));
}
}