本文整理汇总了PHP中Reflector::getDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP Reflector::getDatabase方法的具体用法?PHP Reflector::getDatabase怎么用?PHP Reflector::getDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reflector
的用法示例。
在下文中一共展示了Reflector::getDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTags
/**
* Compiles and returns the tags.
*
* @return array
*/
public function getTags()
{
// Get affected database and tables, add prefixes
$database = $this->prefix($this->reflector->getDatabase(), self::PREFIX_DATABASE);
// Get affected tables, don't add prefixes yes
$tables = $this->reflector->getTables();
// If rows should not be considered, we don't have to differ between specific and unspecific queries
// We can simply prefix all tables with the database and return them
if ($this->considerRows === false) {
return $this->prefix($tables, $database);
}
// Get affected rows as multidimensional array per table
$rows = $this->reflector->getRows();
// Create the table tags with corresponding prefix
// Depending on whether the queries are specific or not
$tags = $this->getTableTags($tables, $rows);
// Then we loop trough all these tags and add a tag for each row
// Consisting of the prefixed table and the row with prefix
foreach ($tables as $table) {
if (!isset($rows[$table])) {
continue;
}
$tablePrefix = $this->prefix($table, self::PREFIX_TABLE_SPECIFIC);
$rowPrefix = $this->prefix(self::PREFIX_ROW, $tablePrefix);
$tags = array_merge($tags, $this->prefix($rows[$table], $rowPrefix));
}
return $this->prefix($tags, $database);
}
示例2: getHash
/**
* Returns the hash.
*
* @return string
*/
public function getHash()
{
// Never remove the database from the identifier
// Most SQL queries do not include the target database
$identifier = $this->reflector->getDatabase() . $this->reflector->getSql() . serialize($this->reflector->getParameters());
return md5($identifier);
}