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


PHP Zend_Db_Adapter_Abstract::quoteColumnAs方法代码示例

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


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

示例1: _renderColumnsClauseToString

 /**
  * @return string
  */
 protected function _renderColumnsClauseToString()
 {
     $columns = array();
     foreach ($this->_parts[self::COLUMNS] as $columnEntry) {
         list($correlationName, $column, $alias) = $columnEntry;
         if ($column instanceof Zend_Db_Expr) {
             $columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
         } else {
             if ($column == '*') {
                 $column = new Zend_Db_Expr('*');
                 $alias = null;
             }
             if (empty($correlationName)) {
                 $columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
             } else {
                 $columns[] = $this->_adapter->quoteColumnAs(array($correlationName, $column), $alias, true);
             }
         }
     }
     return implode(', ', $columns);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:24,代码来源:Select.php

示例2: _renderColumns

 /**
  * Render DISTINCT clause
  *
  * @param string   $sql SQL query
  * @return string
  */
 protected function _renderColumns($sql)
 {
     if (!count($this->_parts[self::COLUMNS])) {
         return null;
     }
     $columns = array();
     foreach ($this->_parts[self::COLUMNS] as $columnEntry) {
         list($correlationName, $column, $alias) = $columnEntry;
         if ($column instanceof Zend_Db_Expr) {
             $columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
         } else {
             if ($column == self::SQL_WILDCARD) {
                 $column = new Zend_Db_Expr(self::SQL_WILDCARD);
                 $alias = null;
             }
             if (empty($correlationName)) {
                 $columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
             } else {
                 $columns[] = $this->_adapter->quoteColumnAs(array($correlationName, $column), $alias, true);
             }
         }
     }
     return $sql .= ' ' . implode(', ', $columns);
 }
开发者ID:Mendim,项目名称:gtv-resources,代码行数:30,代码来源:Select.php

示例3: quoteColumnAs

 /**
  * Quote a column identifier and alias.
  *
  * @param string|array|Zend_Db_Expr $ident The identifier or expression.
  * @param string                    $alias An alias for the column.
  * @param boolean                   $auto  (optional) If true, heed the AUTO_QUOTE_IDENTIFIERS config option.
  * @return string The quoted identifier and alias.
  */
 public function quoteColumnAs($ident, $alias, $auto = false)
 {
     return $this->_adapter->quoteColumnAs($ident, $alias, $auto);
 }
开发者ID:cwcw,项目名称:cms,代码行数:12,代码来源:Abstract.php

示例4: __toString

 /**
  * Converts this object to an SQL SELECT string.
  *
  * @todo use $this->_adapter->quoteColumns() for non-PDO adapters
  * @todo use $this->_adapter->quoteTableNames() for non-PDO adapters
  * @todo use prepared queries for PDO adapters instead of constructing all the SQL ourselves
  *           like in Adapter/Abstract.php.html:query()
  * @return string This object as a SELECT string.
  */
 public function __toString()
 {
     // initial SELECT [DISTINCT] [FOR UPDATE]
     $sql = "SELECT";
     if ($this->_parts[self::DISTINCT]) {
         $sql .= " DISTINCT";
     }
     if ($this->_parts[self::FOR_UPDATE]) {
         $sql .= " FOR UPDATE";
     }
     $sql .= "\n\t";
     // add columns
     if ($this->_parts[self::COLUMNS]) {
         $columns = array();
         foreach ($this->_parts[self::COLUMNS] as $correlationName => $columnList) {
             foreach ($columnList as $alias => $column) {
                 if (!is_string($alias)) {
                     $alias = null;
                 }
                 if ($column instanceof Zend_Db_Expr) {
                     $columns[] = $this->_adapter->quoteColumnAs($column, $alias);
                 } else {
                     if ($column == '*') {
                         $column = new Zend_Db_Expr('*');
                         $alias = null;
                     }
                     if (empty($correlationName)) {
                         $columns[] = $this->_adapter->quoteColumnAs($column, $alias);
                     } else {
                         $columns[] = $this->_adapter->quoteColumnAs(array($correlationName, $column), $alias);
                     }
                 }
             }
         }
         $sql .= implode(",\n\t", $columns);
     }
     // from these joined tables
     if ($this->_parts[self::FROM]) {
         $from = array();
         // array_pop()
         foreach ($this->_parts[self::FROM] as $correlationName => $table) {
             $tmp = '';
             if (empty($from)) {
                 // First table is named alone ignoring join information
                 $tmp .= $this->_adapter->quoteTableAs($table['tableName'], $correlationName);
             } else {
                 // Subsequent tables may have joins
                 if (!empty($table['joinType'])) {
                     $tmp .= ' ' . strtoupper($table['joinType']) . ' ';
                 }
                 $tmp .= $this->_adapter->quoteTableAs($table['tableName'], $correlationName);
                 if (!empty($table['joinCondition'])) {
                     $tmp .= ' ON ' . $table['joinCondition'];
                 }
             }
             // add the table name and condition
             // add to the list
             $from[] = $tmp;
         }
         // add the list of all joins
         if (!empty($from)) {
             $sql .= "\nFROM " . implode("\n", $from);
         }
         // with these where conditions
         if ($this->_parts[self::WHERE]) {
             $sql .= "\nWHERE\n\t";
             $sql .= implode("\n\t", $this->_parts[self::WHERE]);
         }
         // grouped by these columns
         if ($this->_parts[self::GROUP]) {
             $sql .= "\nGROUP BY\n\t";
             $l = array();
             foreach ($this->_parts[self::GROUP] as $term) {
                 $l[] = $this->_adapter->quoteIdentifier($term);
             }
             $sql .= implode(",\n\t", $l);
         }
         // having these conditions
         if ($this->_parts[self::HAVING]) {
             $sql .= "\nHAVING\n\t";
             $sql .= implode("\n\t", $this->_parts[self::HAVING]);
         }
     }
     // ordered by these columns
     if ($this->_parts[self::ORDER]) {
         $sql .= "\nORDER BY\n\t";
         $l = array();
         foreach ($this->_parts[self::ORDER] as $term) {
             if (is_array($term)) {
                 $l[] = $this->_adapter->quoteIdentifier($term[0]) . ' ' . $term[1];
             } else {
//.........这里部分代码省略.........
开发者ID:jorgenils,项目名称:zend-framework,代码行数:101,代码来源:Select.php


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