当前位置: 首页>>代码示例>>PHP>>正文


PHP SqlFormatter::tab方法代码示例

本文整理汇总了PHP中SqlFormatter::tab方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlFormatter::tab方法的具体用法?PHP SqlFormatter::tab怎么用?PHP SqlFormatter::tab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqlFormatter的用法示例。


在下文中一共展示了SqlFormatter::tab方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Format SQL for SQL editors
 *
 * @package PhpMyAdmin
 */
require_once 'libraries/common.inc.php';
require_once 'libraries/sql-formatter/lib/SqlFormatter.php';
$query = isset($_POST['sql']) ? $_POST['sql'] : '';
SqlFormatter::$tab = "\t";
$query = SqlFormatter::format($query, false);
$response = PMA_Response::getInstance();
$response->addJSON("sql", $query);
开发者ID:mercysmart,项目名称:naikelas,代码行数:15,代码来源:db_sql_format.php

示例2: foreach

 /**
  *  Shows the debugging console, <i>if</i> {@link debug} is TRUE and the viewer's IP address is in the
  *  {@link debugger_ip} array (or <i>$debugger_ip</i> is an empty array).
  *
  *  <i>This method must be called after all the queries in a script, preferably before </body>!</i>
  *
  *  <b>You should ALWAYS have this method called at the end of your scripts and control whether the debugging console
  *  will show or not with the {@link debug} property.</b>
  *
  *  @param  boolean $return         (Optional) If set to TRUE, the output will be returned instead of being printed
  *                                  to the screen.
  *
  *                                  Default is FALSE.
  *
  *  @return void
  */
 function show_debug_console($return = false)
 {
     // if
     if ($this->debug && is_array($this->debugger_ip) && (empty($this->debugger_ip) || in_array($_SERVER['REMOTE_ADDR'], $this->debugger_ip))) {
         // include the SqlFormatter library
         require 'includes/SqlFormatter.php';
         // set some properties for the formatter
         SqlFormatter::$number_attributes = SqlFormatter::$boundary_attributes = 'class="symbol"';
         SqlFormatter::$quote_attributes = 'class="string"';
         SqlFormatter::$reserved_attributes = 'class="keyword"';
         SqlFormatter::$tab = '    ';
         // if warnings are not disabled
         if (!$this->disable_warnings) {
             // if there are any warning messages iterate through them
             foreach (array_keys($this->warnings) as $warning) {
                 // add them to the debugging console
                 $this->_log('warnings', array('message' => $this->language['warning_' . $warning]), false);
             }
         }
         // blocks to be shown in the debugging console
         $blocks = array('errors' => array('counter' => 0, 'identifier' => 'e', 'generated' => ''), 'successful-queries' => array('counter' => 0, 'identifier' => 'sq', 'generated' => ''), 'unsuccessful-queries' => array('counter' => 0, 'identifier' => 'uq', 'generated' => ''), 'warnings' => array('counter' => 0, 'identifier' => 'w', 'generated' => ''), 'globals' => array('generated' => ''));
         // there are no warnings
         $warnings = false;
         // prepare output for each block
         foreach (array_keys($blocks) as $block) {
             $output = '';
             // if there is any information for the current block
             if (isset($this->debug_info[$block])) {
                 // iterate through the error message
                 foreach ($this->debug_info[$block] as $debug_info) {
                     // increment the messages counter
                     $counter = ++$blocks[$block]['counter'];
                     $identifier = $blocks[$block]['identifier'];
                     // if block is about queries
                     if ($block == 'successful-queries' || $block == 'unsuccessful-queries') {
                         // format and highlight query
                         $debug_info['query'] = SqlFormatter::format($debug_info['query']);
                     }
                     // all blocks are enclosed in tables
                     $output .= '
                         <table cellspacing="0" cellpadding="0" border="0" class="zdc-entry' . ($counter % 2 == 0 ? ' even' : '') . (isset($debug_info['highlight']) && $debug_info['highlight'] == 1 ? ' zdc-highlight' : '') . '">
                             <tr>
                                 <td class="zdc-counter" valign="top">' . str_pad($counter, 3, '0', STR_PAD_LEFT) . '</td>
                                 <td class="zdc-data">
                     ';
                     // are there any error messages issued by the script?
                     if (isset($debug_info['message']) && trim($debug_info['message']) != '') {
                         $output .= '
                             <div class="zdc-box zdc-error">
                                 ' . $debug_info['message'] . '
                             </div>
                         ';
                     }
                     // are there any error messages issued by MySQL?
                     if (isset($debug_info['error']) && trim($debug_info['error']) != '') {
                         $output .= '
                             <div class="zdc-box zdc-error">
                                 ' . $debug_info['error'] . '
                             </div>
                         ';
                     }
                     // are there any warning messages issued by the script?
                     if (isset($debug_info['warning']) && trim($debug_info['warning']) != '') {
                         $output .= '
                             <div class="zdc-box zdc-error">' . $debug_info['warning'] . '
                             </div>
                         ';
                         // set a flag so that we show in the minimized debugging console that there are warnings
                         $warnings = true;
                     }
                     // is there a query to be displayed?
                     if (isset($debug_info['query'])) {
                         $output .= '
                             <div class="zdc-box' . (isset($debug_info['transaction']) && $debug_info['transaction'] ? ' zdc-transaction' : '') . '">' . preg_replace('/^\\<br\\>/', '', html_entity_decode($debug_info['query'])) . '
                             </div>
                         ';
                     }
                     // start generating the actions box
                     $output .= '
                         <div class="zdc-box zdc-actions">
                             <ul>
                     ';
                     // actions specific to successful queries
                     if ($block == 'successful-queries') {
//.........这里部分代码省略.........
开发者ID:stefangabos,项目名称:zebra_database,代码行数:101,代码来源:Zebra_Database.php

示例3: testSqlFormatter_format

 /**
  * Test for SqlFormatter::format
  *
  * @return void
  *
  * @dataProvider formatDataProvider
  */
 public function testSqlFormatter_format($query, $expected)
 {
     SqlFormatter::$tab = "\t";
     $this->assertEquals($expected, SqlFormatter::format($query, false));
 }
开发者ID:xtreme-jamil-shamy,项目名称:phpmyadmin-cf,代码行数:12,代码来源:SqlFormatter_test.php


注:本文中的SqlFormatter::tab方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。