本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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