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


PHP Expression::build方法代码示例

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


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

示例1: build

 /**
  * @param OrderKeyword $component The component to be built.
  *
  * @return string
  */
 public static function build($component)
 {
     if (is_array($component)) {
         $ret = array();
         foreach ($component as $c) {
             $ret[] = static::build($c);
         }
         return implode(", ", $ret);
     } else {
         return Expression::build($component->field) . ' ' . $component->type;
     }
 }
开发者ID:nobodypb,项目名称:phpmyadmin,代码行数:17,代码来源:OrderKeyword.php

示例2: getTables

 /**
  * Gets a list of all tables used in this statement.
  *
  * @param Statement $statement Statement to be scanned.
  *
  * @return array
  */
 public static function getTables($statement)
 {
     $expressions = array();
     if ($statement instanceof InsertStatement || $statement instanceof ReplaceStatement) {
         $expressions = array($statement->into->dest);
     } elseif ($statement instanceof UpdateStatement) {
         $expressions = $statement->tables;
     } elseif ($statement instanceof SelectStatement || $statement instanceof DeleteStatement) {
         $expressions = $statement->from;
     } elseif ($statement instanceof AlterStatement || $statement instanceof TruncateStatement) {
         $expressions = array($statement->table);
     } elseif ($statement instanceof DropStatement) {
         if (!$statement->options->has('TABLE')) {
             // No tables are dropped.
             return array();
         }
         $expressions = $statement->fields;
     } elseif ($statement instanceof RenameStatement) {
         foreach ($statement->renames as $rename) {
             $expressions[] = $rename->old;
         }
     }
     $ret = array();
     foreach ($expressions as $expr) {
         if (!empty($expr->table)) {
             $expr->expr = null;
             // Force rebuild.
             $expr->alias = null;
             // Aliases are not required.
             $ret[] = Expression::build($expr);
         }
     }
     return $ret;
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:41,代码来源:Query.php

示例3: testBuild

 public function testBuild()
 {
     $component = array(new Expression('1 + 2', 'three'), new Expression('1 + 3', 'four'));
     $this->assertEquals(Expression::build($component), '1 + 2 AS `three`, 1 + 3 AS `four`');
 }
开发者ID:elrossco22,项目名称:sql-parser,代码行数:5,代码来源:ExpressionTest.php

示例4: build

 /**
  * @return string
  */
 public function build()
 {
     $fields = '';
     if (!empty($this->fields)) {
         if (is_array($this->fields)) {
             $fields = CreateDefinition::build($this->fields) . ' ';
         } elseif ($this->fields instanceof ArrayObj) {
             $fields = ArrayObj::build($this->fields);
         }
     }
     if ($this->options->has('DATABASE')) {
         return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . OptionsArray::build($this->entityOptions);
     } elseif ($this->options->has('TABLE')) {
         $partition = '';
         if (!empty($this->partitionBy)) {
             $partition .= "\nPARTITION BY " . $this->partitionBy;
         }
         if (!empty($this->partitionsNum)) {
             $partition .= "\nPARTITIONS " . $this->partitionsNum;
         }
         if (!empty($this->subpartitionBy)) {
             $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy;
         }
         if (!empty($this->subpartitionsNum)) {
             $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum;
         }
         if (!empty($this->partitions)) {
             $partition .= "\n" . PartitionDefinition::build($this->partitions);
         }
         return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . $fields . OptionsArray::build($this->entityOptions) . $partition;
     } elseif ($this->options->has('VIEW')) {
         return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . $fields . ' AS ' . TokensList::build($this->body) . ' ' . OptionsArray::build($this->entityOptions);
     } elseif ($this->options->has('TRIGGER')) {
         return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . OptionsArray::build($this->entityOptions) . ' ' . 'ON ' . Expression::build($this->table) . ' ' . 'FOR EACH ROW ' . TokensList::build($this->body);
     } elseif ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
         $tmp = '';
         if ($this->options->has('FUNCTION')) {
             $tmp = 'RETURNS ' . DataType::build($this->return);
         }
         return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . ParameterDefinition::build($this->parameters) . ' ' . $tmp . ' ' . TokensList::build($this->body);
     } else {
         return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . TokensList::build($this->body);
     }
     return '';
 }
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:48,代码来源:CreateStatement.php

示例5: build

 /**
  * @param AlterOperation $component The component to be built.
  *
  * @return string
  */
 public static function build($component)
 {
     $ret = OptionsArray::build($component->options) . ' ';
     if (!empty($component->field)) {
         $ret .= Expression::build($component->field) . ' ';
     }
     $ret .= TokensList::build($component->unknown);
     return $ret;
 }
开发者ID:rushi963,项目名称:phpmyadmin,代码行数:14,代码来源:AlterOperation.php

示例6: build

 /**
  * @return string
  */
 public function build()
 {
     $tmp = array();
     foreach ($this->altered as $altered) {
         $tmp[] = $altered::build($altered);
     }
     return 'ALTER ' . OptionsArray::build($this->options) . ' TABLE ' . Expression::build($this->table) . ' ' . implode(', ', $tmp);
 }
开发者ID:urstrulymahesh,项目名称:phpmyadmin,代码行数:11,代码来源:AlterStatement.php

示例7: build

 /**
  * @param JoinKeyword[] $component The component to be built.
  *
  * @return string
  */
 public static function build($component)
 {
     $ret = array();
     foreach ($component as $c) {
         $ret[] = ($c->type === 'JOIN' ? 'JOIN ' : $c->type . ' JOIN ') . Expression::build($c->expr) . ' ON ' . Condition::build($c->on);
     }
     return implode(' ', $ret);
 }
开发者ID:nobodypb,项目名称:phpmyadmin,代码行数:13,代码来源:JoinKeyword.php

示例8: build

 /**
  * @param IntoKeyword $component The component to be built.
  *
  * @return string
  */
 public static function build($component)
 {
     if ($component->dest instanceof Expression) {
         $columns = !empty($component->columns) ? '(' . implode(', ', $component->columns) . ')' : '';
         return Expression::build($component->dest) . $columns;
     } else {
         return 'OUTFILE "' . $component->dest . '"';
     }
 }
开发者ID:WSDC-NITWarangal,项目名称:phpmyadmin,代码行数:14,代码来源:IntoKeyword.php

示例9: build

 /**
  * @param RenameOperation $component The component to be built.
  *
  * @return string
  */
 public static function build($component)
 {
     if (is_array($component)) {
         $values = array();
         foreach ($component as $c) {
             $values[] = static::build($c);
         }
         return implode(', ', $values);
     } else {
         return Expression::build($component->old) . ' TO ' . Expression::build($component->new);
     }
 }
开发者ID:WSDC-NITWarangal,项目名称:phpmyadmin,代码行数:17,代码来源:RenameOperation.php


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