本文整理汇总了PHP中StringHelper::indent方法的典型用法代码示例。如果您正苦于以下问题:PHP StringHelper::indent方法的具体用法?PHP StringHelper::indent怎么用?PHP StringHelper::indent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringHelper
的用法示例。
在下文中一共展示了StringHelper::indent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public function prepare(DataSourceHandler $handler, array $sqls)
{
$indent = str_pad('', Statement::$INDENT_NESTED);
$block = NULL;
foreach ($sqls as $sql) {
$block .= "\n{$indent}" . StringHelper::indent($sql, Statement::$INDENT_NESTED, FALSE) . ';';
}
return "BEGIN{$block}\nEND;";
}
示例2: prepare
public function prepare(DataSourceHandler $handler, array $sqls) {
$indent = str_pad('', SelectStatementPrint::INDENT);
$block = NULL;
foreach ($sqls as $sql) {
$block .= "\n$indent" . StringHelper::indent($sql, SelectStatementPrint::INDENT, FALSE) . ';';
}
return "BEGIN$block\nEND;";
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:10,代码来源:OraclePrepareManipulationStatementBatchImpl.php
示例3: apply
public function apply(DataSourceHandler $handler, &$sql, $startWith, $limit)
{
$firstRecordNumber = isset($startWith) && $startWith > 0 ? $startWith + 1 : NULL;
$sql = 'SELECT n.*' . (isset($firstRecordNumber) ? ', rownum AS original_rownum' : '') . ' FROM (' . "\n" . StringHelper::indent($sql, Statement::$INDENT_SELECT_SECTION_ELEMENT, TRUE) . ') n';
$lastRecordNumber = isset($limit) ? (isset($firstRecordNumber) ? $firstRecordNumber : 1) + $limit - 1 : NULL;
if (isset($lastRecordNumber)) {
$sql .= "\n WHERE rownum <= " . $lastRecordNumber;
}
if (isset($firstRecordNumber)) {
$sql = "SELECT * FROM (\n" . StringHelper::indent($sql, Statement::$INDENT_SELECT_SECTION_ELEMENT, TRUE) . ")\n WHERE original_rownum >= " . $firstRecordNumber;
}
}
示例4: assemble
public static function assemble($isSubqueryRequired, array $columnNames = NULL, AssembledSections $assembledSections = NULL, $indent = 0, $indentBlockStart = TRUE) {
if (isset($assembledSections->select)) {
$sql = "SELECT $assembledSections->select"
. "\n FROM $assembledSections->from"
. (isset($assembledSections->where) ? "\n WHERE $assembledSections->where" : '')
. (isset($assembledSections->groupBy) ? "\n GROUP BY $assembledSections->groupBy" : '')
. (isset($assembledSections->having) ? "\nHAVING $assembledSections->having" : '');
}
else {
if (isset($assembledSections->where) || isset($assembledSections->groupBy) || isset($assembledSections->having)) {
throw new UnsupportedOperationException(t("Additional sections could not be added to assembled SQL statement"));
}
$sql = $assembledSections->from;
}
if ($isSubqueryRequired) {
$assembledSubquerySections = new AssembledSections(
self::$TABLE_ALIAS__SOURCE . '.' . (isset($columnNames) ? implode(', ' . self::$TABLE_ALIAS__SOURCE . '.', $columnNames) : '*'),
'(' . StringHelper::indent($sql, SelectStatementPrint::INDENT__SUBQUERY, FALSE) . ') ' . self::$TABLE_ALIAS__SOURCE,
NULL,
NULL,
NULL);
$sql = self::assemble(FALSE, NULL, $assembledSubquerySections, $indent, $indentBlockStart);
}
else {
$sql = StringHelper::indent($sql, $indent, $indentBlockStart);
}
return $sql;
}
示例5: countRecords
protected function countRecords(DataControllerCallContext $callcontext, DataSourceMetaData $datasource, array $statements)
{
$countIdentifier = 'record_count';
$TABLE_ALIAS__COUNT = 'c';
$count = count($statements);
$requestedColumnNames = array();
// No columns are requested
$sql = '';
for ($i = 0; $i < $count; $i++) {
$statement = $statements[$i];
list($isSubqueryRequired, $assembledSections) = $statement->prepareSections($requestedColumnNames);
if ($i > 0) {
$sql .= "\n UNION\n";
}
$sql .= $isSubqueryRequired ? "SELECT COUNT(*) AS {$countIdentifier}\n FROM (" . Statement::assemble(FALSE, NULL, $assembledSections, Statement::$INDENT_SUBQUERY, FALSE) . ') ' . $TABLE_ALIAS__COUNT : Statement::assemble(FALSE, NULL, new AssembledSections("COUNT(*) AS {$countIdentifier}", $assembledSections->from, $assembledSections->where, $assembledSections->groupBy, $assembledSections->having));
}
if ($count > 1) {
$tableAlias = $TABLE_ALIAS__COUNT . '_sum';
$sql = "SELECT SUM({$tableAlias}.{$countIdentifier}) AS {$countIdentifier}\n FROM (" . StringHelper::indent($sql, Statement::$INDENT_SUBQUERY, TRUE) . ") {$tableAlias}";
}
LogHelper::log_info(new StatementLogMessage('*.count', $sql));
$records = $this->executeQuery($callcontext, $datasource, $sql, new PassthroughResultFormatter());
return $records[0][$countIdentifier];
}