本文整理匯總了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];
}