本文整理汇总了PHP中PMA\libraries\Table::showCreate方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::showCreate方法的具体用法?PHP Table::showCreate怎么用?PHP Table::showCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA\libraries\Table
的用法示例。
在下文中一共展示了Table::showCreate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getForeigners
/**
* Gets all Relations to foreign tables for a given table or
* optionally a given column in a table
*
* @param string $db the name of the db to check for
* @param string $table the name of the table to check for
* @param string $column the name of the column to check for
* @param string $source the source for foreign key information
*
* @return array db,table,column
*
* @access public
*/
function PMA_getForeigners($db, $table, $column = '', $source = 'both')
{
$cfgRelation = PMA_getRelationsParam();
$foreign = array();
if ($cfgRelation['relwork'] && ($source == 'both' || $source == 'internal')) {
$rel_query = '
SELECT `master_field`,
`foreign_db`,
`foreign_table`,
`foreign_field`
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db']) . '.' . PMA\libraries\Util::backquote($cfgRelation['relation']) . '
WHERE `master_db` = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'
AND `master_table` = \'' . PMA\libraries\Util::sqlAddSlashes($table) . '\' ';
if (mb_strlen($column)) {
$rel_query .= ' AND `master_field` = ' . '\'' . PMA\libraries\Util::sqlAddSlashes($column) . '\'';
}
$foreign = $GLOBALS['dbi']->fetchResult($rel_query, 'master_field', null, $GLOBALS['controllink']);
}
if (($source == 'both' || $source == 'foreign') && mb_strlen($table)) {
$tableObj = new Table($table, $db);
$show_create_table = $tableObj->showCreate();
if ($show_create_table) {
$parser = new SqlParser\Parser($show_create_table);
/**
* @var CreateStatement $stmt
*/
$stmt = $parser->statements[0];
$foreign['foreign_keys_data'] = SqlParser\Utils\Table::getForeignKeys($stmt);
}
}
/**
* Emulating relations for some information_schema tables
*/
$isInformationSchema = mb_strtolower($db) == 'information_schema';
$isMysql = mb_strtolower($db) == 'mysql';
if (($isInformationSchema || $isMysql) && ($source == 'internal' || $source == 'both')) {
if ($isInformationSchema) {
$relations_key = 'information_schema_relations';
include_once './libraries/information_schema_relations.lib.php';
} else {
$relations_key = 'mysql_relations';
include_once './libraries/mysql_relations.lib.php';
}
if (isset($GLOBALS[$relations_key][$table])) {
foreach ($GLOBALS[$relations_key][$table] as $field => $relations) {
if ((!mb_strlen($column) || $column == $field) && (!isset($foreign[$field]) || !mb_strlen($foreign[$field]))) {
$foreign[$field] = $relations;
}
}
}
}
return $foreign;
}