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


PHP Query::getTable方法代码示例

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


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

示例1: testShouldReturnRolesTable

 public function testShouldReturnRolesTable()
 {
     $query = new Query('roles');
     $result = $query->getTable();
     $expected = 'roles';
     $this->assertEquals($expected, $result);
 }
开发者ID:amaivsimau,项目名称:dojos,代码行数:7,代码来源:QueryTest.php

示例2: query

 public final function query(Query $query)
 {
     $result = $this->queryRaw($query->toDialectString($this->getDialect()));
     if ($query instanceof InsertQuery && !empty($this->sequencePool[$name = $query->getTable() . '_id'])) {
         $id = current($this->sequencePool[$name]);
         Assert::isTrue($id instanceof Identifier, 'identifier was lost in the way');
         $id->setId($this->getInsertId())->finalize();
         unset($this->sequencePool[$name][key($this->sequencePool[$name])]);
     }
     return $result;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:11,代码来源:Sequenceless.class.php

示例3: __construct

 /**
  * Throws UnexpectedValueException if the row class, either gleaned from Query::getTable() or
  * provided directly, does not exist.
  * Throws UnexpectedValueException if the above class does not have Model in its ancestry.
  *
  * @param Query $query
  * @param string $class = null
  */
 public function __construct(Query $query, $class = null)
 {
     if ($class) {
         $this->class = trim($class);
     } else {
         $this->class = trim(StringFormat::className($query->getTable()));
     }
     if (!class_exists($this->class)) {
         throw new UnexpectedValueException(sprintf('Class "%s" does not exist.', $this->class));
     }
     if (!is_a($this->class, 'Model', true)) {
         throw new UnexpectedValueException(sprintf('Class "%s" does not inherit from Model.', $this->class));
     }
     $this->query = $query;
 }
开发者ID:abcarroll,项目名称:DABL,代码行数:23,代码来源:QueryModelIterator.php

示例4: testGetTableTwoWordsWithAlias

 /**
  * @group subquery
  * @covers Query::getTable
  */
 function testGetTableTwoWordsWithAlias()
 {
     $q = new Query('SELECT testing', 'alias');
     $this->assertEquals('SELECT testing', $q->getTable());
 }
开发者ID:abcarroll,项目名称:DABL,代码行数:9,代码来源:QueryTest.php

示例5: install

 public function install(array $options = array())
 {
     $toret = false;
     $this->error_msg = false;
     if ($this->checkConnection()) {
         $drop_table = array_key_exists('drop_table', $options) ? $options['drop_table'] : false;
         $query = $this->getInstallSQL();
         if ($query) {
             if ($drop_table) {
                 $table = $this->getSource();
                 $drop_query = new CustomQuery('DROP TABLE IF EXISTS ' . Query::getTable($this) . '', array('connection' => $this->db));
                 $drop_query->execute();
                 Backend::addNotice('Dropping table ' . $table);
                 if (!empty($drop_query->error_msg)) {
                     $this->error_msg = $drop_query->error_msg;
                 }
             }
             $query = new CustomQuery($query, array('connection' => $this->db));
             $toret = $query->execute();
             if (!empty($query->error_msg)) {
                 $this->error_msg = $query->error_msg;
             }
         } else {
             if (class_exists('BackendError', false)) {
                 BackendError::add(get_class($this) . ': No Install SQL', 'install');
             }
             $this->error_msg = 'No Install SQL for ' . class_name($this);
         }
     } else {
         if (class_exists('BackendError', false)) {
             BackendError::add(get_class($this) . ': DB Connection Error', 'install');
         }
         $this->error_msg = 'DB Connection error';
     }
     return $toret;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:36,代码来源:DBObject.obj.php

示例6: join

 function join($type, $table, $conditions, array $options = array())
 {
     $this->query = false;
     $type = strtoupper($type);
     if (!in_array($type, array('RIGHT', 'LEFT', 'INNER', 'OUTER'))) {
         throw new Exception('Unsupported Join Type');
     }
     if (!is_array($conditions)) {
         $conditions = array($conditions);
     }
     if (!array_key_exists($type, $this->joins)) {
         $this->joins[$type] = array();
     }
     if ($table instanceof Query) {
         $table = $table->__toString();
         if (array_key_exists('alias', $options)) {
             $table = '(' . $table . ') AS ' . Query::enclose($options['alias']);
         } else {
             trigger_error('Joined sub queries should have aliases', E_USER_ERROR);
         }
     } else {
         $table = Query::getTable($table);
         if (array_key_exists('alias', $options)) {
             $table = Query::enclose($table) . ' AS ' . Query::enclose($options['alias']);
         }
     }
     if (array_key_exists($table, $this->joins[$type])) {
         $this->joins[$type][$table] = array_merge($this->joins[$type][$table], $conditions);
     } else {
         $this->joins[$type][$table] = $conditions;
     }
     return $this;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:33,代码来源:SelectQuery.obj.php


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