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


PHP Column::column方法代码示例

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


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

示例1: parse_column_annotation

 protected final function parse_column_annotation()
 {
     if (!isset($this->_class_id_)) {
         $this->_class_id_ = $this->_class_;
     }
     if (isset(self::$DAO[$this->_class_id_])) {
         $this->_columns_ = self::$DAO[$this->_class_id_]->columns;
         $this->_self_columns_ = self::$DAO[$this->_class_id_]->self_columns;
         $this->_conds_ = self::$DAO[$this->_class_id_]->conds;
         $this->_has_many_conds_ = self::$DAO[$this->_class_id_]->has_many_conds;
         $this->_alias_ = self::$DAO[$this->_class_id_]->alias;
         foreach (self::$DAO[$this->_class_id_]->has_dao as $name => $dao) {
             $this->{$name}($dao);
         }
         return;
     }
     $count = $this->_class_id_ === $this->_class_ ? 0 : (int) substr($this->_class_id_, strpos($this->_class_id_, "___") + 3);
     $has_hierarchy = isset($this->_hierarchy_) ? $this->_hierarchy_ - 1 : $this->_has_hierarchy_;
     $root_table_alias = "t" . $count++;
     $has_dao = array();
     foreach ($this->access_members() as $name => $value) {
         if ($this->a($name, "extra") !== "true") {
             $anon_cond = $this->a($name, "cond");
             $column_type = $this->a($name, "type");
             $column = new Column();
             $column->name($name);
             $column->column($this->a($name, "column", $name));
             $column->column_alias("c" . $count++);
             if ($anon_cond === null) {
                 if (class_exists($column_type) && is_subclass_of($column_type, "Dao")) {
                     throw new Exception("undef " . $name . " annotation 'cond'");
                 }
                 $column->table($this->_table_);
                 $column->table_alias($root_table_alias);
                 $column->primary($this->a($name, "primary"));
                 $column->auto($column_type === "serial");
                 $this->_self_columns_[$name] = $this->_columns_[] = $column;
                 $this->_alias_[$column->column_alias()] = $name;
             } else {
                 if (false !== strpos($anon_cond, "(")) {
                     $is_has = class_exists($column_type) && is_subclass_of($column_type, "Dao");
                     $is_has_many = $is_has && $this->a($name, "attr") === "a";
                     if ((!$is_has || $has_hierarchy > 0) && preg_match("/^(.+)\\((.*)\\)(.*)\$/", $anon_cond, $match)) {
                         list(, $self_var, $conds_string, $has_var) = $match;
                         list($self_var, $conds_string, $has_var) = Text::trim($self_var, $conds_string, $has_var);
                         $conds = array();
                         $ref_table = $ref_table_alias = null;
                         if (!empty($conds_string)) {
                             foreach (explode(",", $conds_string) as $key => $cond) {
                                 $tcc = explode(".", $cond, 3);
                                 if (sizeof($tcc) === 3) {
                                     list($t, $c1, $c2) = $tcc;
                                     $ref_table = $this->set_table_name($t);
                                     $ref_table_alias = "t" . $count++;
                                     $conds[] = Column::cond_instance($c1, "c" . $count++, $ref_table, $ref_table_alias);
                                     $conds[] = Column::cond_instance($c2, "c" . $count++, $ref_table, $ref_table_alias);
                                 } else {
                                     list($t, $c1) = $tcc;
                                     $ref_table = $this->set_table_name($t);
                                     $ref_table_alias = "t" . $count++;
                                     $conds[] = Column::cond_instance($c1, "c" . $count++, $ref_table, $ref_table_alias);
                                 }
                             }
                         }
                         if ($is_has_many) {
                             $this->a($name, "has_many", true);
                             $dao = new $column_type("_class_id_=" . $this->_class_ . "___" . $count++ . ",_class_access_=true");
                             $has_column = $dao->base_column($has_var);
                             $conds[] = Column::cond_instance($has_column->column(), "c" . $count++, $has_column->table(), $has_column->table_alias());
                             array_unshift($conds, Column::cond_instance($self_var, "c" . $count++, $this->_table_, $root_table_alias));
                             $dao->add_conds($conds);
                             $this->_has_many_conds_[$name] = array($dao, $has_var, $self_var);
                         } else {
                             if ($is_has) {
                                 $dao = new $column_type("_class_id_=" . $this->_class_ . "___" . $count++ . ",_hierarchy_=" . $has_hierarchy);
                                 $has_dao[$name] = $dao;
                                 $this->{$name}($dao);
                                 $this->_columns_ = array_merge($this->_columns_, $dao->columns());
                                 $this->_conds_ = array_merge($this->_conds_, $dao->conds());
                                 $this->a($name, "has", true);
                                 foreach ($dao->columns() as $column) {
                                     $this->_alias_[$column->column_alias()] = $name;
                                 }
                                 $has_column = $dao->base_column($has_var);
                                 $conds[] = Column::cond_instance($has_column->column(), "c" . $count++, $has_column->table(), $has_column->table_alias());
                             } else {
                                 $column->table($ref_table);
                                 $column->table_alias($ref_table_alias);
                                 $this->_columns_[] = $column;
                                 $this->_alias_[$column->column_alias()] = $name;
                             }
                             array_unshift($conds, Column::cond_instance($self_var, "c" . $count++, $this->_table_, $root_table_alias));
                             $this->add_conds($conds);
                         }
                     }
                 } else {
                     if ($anon_cond[0] === "@") {
                         $c = $this->base_column(substr($anon_cond, 1));
                         $column->table($c->table());
                         $column->table_alias($c->table_alias());
//.........这里部分代码省略.........
开发者ID:hisaboh,项目名称:w2t,代码行数:101,代码来源:Dao.php

示例2: column_alias_sql

 protected function column_alias_sql(Column $column, \ebi\Q $q, $alias = true)
 {
     $column_str = $alias ? $column->table_alias() . '.' . $this->quotation($column->column()) : $this->quotation($column->column());
     if ($q->ignore_case()) {
         return 'upper(' . $column_str . ')';
     }
     return $column_str;
 }
开发者ID:tokushima,项目名称:ebi,代码行数:8,代码来源:DbConnector.php


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