當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。