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


PHP Connection::getDatabaseReflection方法代码示例

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


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

示例1: createJoins

 protected function createJoins($val, $inner = FALSE)
 {
     $driver = $this->connection->getSupplementalDriver();
     $reflection = $this->connection->getDatabaseReflection();
     $joins = array();
     preg_match_all('~\\b([a-z][\\w.:]*[.:])([a-z]\\w*)(\\s+IS\\b|\\s*<=>)?~i', $val, $matches);
     foreach ($matches[1] as $names) {
         $parent = $this->name;
         if ($names !== "{$parent}.") {
             // case-sensitive
             preg_match_all('~\\b([a-z][\\w]*)([.:])~', $names, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 list(, $name, $delimiter) = $match;
                 if ($delimiter === ':') {
                     list($table, $primary) = $reflection->getHasManyReference($parent, $name);
                     $column = $reflection->getPrimary($parent);
                 } else {
                     list($table, $column) = $reflection->getBelongsToReference($parent, $name);
                     $primary = $reflection->getPrimary($table);
                 }
                 $joins[$name] = ' ' . (!isset($joins[$name]) && $inner && !isset($match[3]) ? 'INNER' : 'LEFT') . ' JOIN ' . $driver->delimite($table) . ($table !== $name ? ' AS ' . $driver->delimite($name) : '') . ' ON ' . $driver->delimite($parent) . '.' . $driver->delimite($column) . ' = ' . $driver->delimite($name) . '.' . $driver->delimite($primary);
                 $parent = $name;
             }
         }
     }
     return $joins;
 }
开发者ID:exesek,项目名称:nette20login,代码行数:27,代码来源:Selection.php

示例2: __construct

 /**
  * Creates filtered table representation.
  *
  * @param  string  database table name
  * @param  Nette\Database\Connection
  */
 public function __construct($table, Nette\Database\Connection $connection)
 {
     $this->name = $table;
     $this->connection = $connection;
     $this->primary = $connection->getDatabaseReflection()->getPrimary($table);
     $this->sqlBuilder = new SqlBuilder($this);
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:13,代码来源:Selection.php

示例3:

 function __construct($table, Nette\Database\Connection $connection)
 {
     $this->name = $table;
     $this->connection = $connection;
     $this->primary = $connection->getDatabaseReflection()->getPrimary($table);
     $this->delimitedName = $this->tryDelimite($this->name);
     $this->delimitedPrimary = $connection->getSupplementalDriver()->delimite($this->primary);
 }
开发者ID:Vrtak-CZ,项目名称:NJLogParser,代码行数:8,代码来源:nette.min.php

示例4:

implements\Iterator,\ArrayAccess,\Countable{protected$connection;protected$name;protected$primary;protected$rows;protected$data;protected$select=array();protected$where=array();protected$conditions=array();protected$parameters=array();protected$order=array();protected$limit=NULL;protected$offset=NULL;protected$group='';protected$having='';protected$checkReferenceNewKeys=FALSE;protected$referenced=array();protected$referencing=array();protected$accessed;protected$prevAccessed;protected$keys=array();protected$delimitedName;protected$delimitedPrimary;function
__construct($table,Nette\Database\Connection$connection){$this->name=$table;$this->connection=$connection;$this->primary=$connection->getDatabaseReflection()->getPrimary($table);$this->delimitedName=$this->tryDelimite($this->name);$this->delimitedPrimary=$connection->getSupplementalDriver()->delimite($this->primary);}function
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:2,代码来源:loader.php


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