本文整理汇总了PHP中Am_Query::getSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Query::getSql方法的具体用法?PHP Am_Query::getSql怎么用?PHP Am_Query::getSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Query
的用法示例。
在下文中一共展示了Am_Query::getSql方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderOut
public function renderOut(&$out)
{
$titles = array();
$this->ds->clearFields()->clearOrder()->toggleAutoGroupBy(false);
foreach ($this->fields as $field) {
/* @var $field Am_Grid_Field */
$name = $field->getFieldName();
$stm = $this->stms[$name];
$this->ds->addField(sprintf("SUM({$stm})", $name), '_' . $name);
$titles['_' . $name] = $field->getFieldTitle();
}
$totals = array();
foreach (Am_Di::getInstance()->db->selectRow($this->ds->getSql()) as $key => $val) {
$totals[] = sprintf('%s %s: <strong>%s</strong>', ___('Total'), $titles[$key], Am_Currency::render($val));
}
$count = count($this->grid->getFields());
$tr = sprintf('<tr><td class="grid-total" colspan="%d">%s</td></td>', $count, implode(',', $totals));
$out = preg_replace('|(<tr>\\s*<th>)|', str_replace('$', '\\$', $tr) . '\\1', $out);
}