本文整理汇总了PHP中Output::verbose方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::verbose方法的具体用法?PHP Output::verbose怎么用?PHP Output::verbose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::verbose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load($db)
{
foreach ($this->buildQueries() as $query) {
Output::verbose($query);
if (!$db->query($query)) {
Output::verbose("Fail\n{$query}\n{$db->error}");
}
}
}
示例2: runStrategy
public function runStrategy()
{
$db = Helper::getDbObject();
$tmpdb = Helper::getTmpDbObject();
Helper::loadTmpDb($tmpdb);
$diff = new dbDiff($db, $tmpdb);
$difference = $diff->getDifference();
if (!count($difference['up']) && !count($difference['down'])) {
echo 'Your database has no changes from last revision' . PHP_EOL;
return false;
}
$version = Helper::getCurrentVersion();
$filename = Helper::get('savedir') . "/migration{$version}.php";
$content = Helper::createMigrationContent($version, $difference);
file_put_contents($filename, $content);
Output::verbose("file: {$filename} written!");
$vTab = Helper::get('versiontable');
$db->query("INSERT INTO `{$vTab}` SET rev={$version}");
return true;
}
示例3: getConstraintForColumn
protected function getConstraintForColumn(mysqli $connection, $table, $col_name)
{
$q = "select database() as dbname";
$res = $connection->query($q);
$row = $res->fetch_array(MYSQLI_ASSOC);
$dbname = $row['dbname'];
Output::verbose("DATABASE: {$row['dbname']}");
$sql = "SELECT k.CONSTRAINT_SCHEMA,k.CONSTRAINT_NAME,k.TABLE_NAME,k.COLUMN_NAME,k.REFERENCED_TABLE_NAME,k.REFERENCED_COLUMN_NAME, r.UPDATE_RULE, r.DELETE_RULE FROM information_schema.key_column_usage k LEFT JOIN information_schema.referential_constraints r ON r.CONSTRAINT_SCHEMA = k.CONSTRAINT_SCHEMA AND k.REFERENCED_TABLE_NAME=r.REFERENCED_TABLE_NAME LEFT JOIN information_schema.table_constraints t ON t.CONSTRAINT_SCHEMA = r.CONSTRAINT_SCHEMA WHERE k.constraint_schema='{$dbname}' AND t.CONSTRAINT_TYPE='FOREIGN KEY' AND k.TABLE_NAME='{$table}' AND r.TABLE_NAME='{$table}' AND t.TABLE_NAME='{$table}' AND k.COLUMN_NAME='{$col_name}'";
Output::verbose($sql);
$res = $connection->query($sql);
$row = $res->fetch_array(MYSQLI_ASSOC);
if (!count($row)) {
return false;
}
$constraint = array('table' => $table, 'name' => $row['CONSTRAINT_NAME'], 'column' => $row['COLUMN_NAME'], 'reference' => array('table' => $row['REFERENCED_TABLE_NAME'], 'column' => $row['REFERENCED_COLUMN_NAME'], 'update' => $row['UPDATE_RULE'], 'delete' => $row['DELETE_RULE']));
//echo "=================\n\n\n\=========";
//var_dump($constraint);
return $constraint;
}
示例4: runDown
/**
* Revert this migration
*/
public function runDown()
{
foreach ($this->buildPredown() as $query) {
Output::verbose('PREDOWN: ' . $query);
if ($this->db->query($query)) {
Output::verbose("Ok");
} else {
Output::verbose($this->db->error);
}
}
foreach ($this->buildDown() as $query) {
Output::verbose('DOWN:' . $query);
$this->db->query($query);
}
foreach ($this->buildPostdown() as $query) {
Output::verbose('POSTDOWN: ' . $query);
if ($this->db->query($query)) {
Output::verbose("Ok");
} else {
Output::verbose($this->db->error);
}
}
$verT = Helper::get('versiontable');
$rev = $this->getRev();
$query = "DELETE FROM `{$verT}` WHERE `rev`={$rev}";
Output::verbose($query);
$this->db->query($query);
}
示例5: getTmpDbObject
static function getTmpDbObject()
{
$config = self::getConfig();
$tmpname = $config['db'] . '_' . self::getCurrentVersion();
$config['db'] = $tmpname;
$db = self::getDbObject();
$db->query("create database `{$config['db']}`");
$tmpdb = self::getDbObject($config);
$tmpdb->query("SET FOREIGN_KEY_CHECKS = 0");
register_shutdown_function(function () use($config, $tmpdb) {
Output::verbose("database {$config['db']} has been dropped");
$tmpdb->query("DROP DATABASE `{$config['db']}`");
});
return $tmpdb;
}