mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-16 22:39:52 +08:00
Merge branch 'master' of https://github.com/yiisoft/yii2 into jui-tabs
This commit is contained in:
@@ -156,14 +156,14 @@ class Schema extends \yii\db\Schema
|
||||
{
|
||||
$column = new ColumnSchema();
|
||||
|
||||
$column->name = $info['COLUMN_NAME'];
|
||||
$column->allowNull = $info['IS_NULLABLE'] == 'YES';
|
||||
$column->dbType = $info['DATA_TYPE'];
|
||||
$column->name = $info['column_name'];
|
||||
$column->allowNull = $info['is_nullable'] == 'YES';
|
||||
$column->dbType = $info['data_type'];
|
||||
$column->enumValues = array(); // mssql has only vague equivalents to enum
|
||||
$column->isPrimaryKey = null; // primary key will be determined in findColumns() method
|
||||
$column->autoIncrement = $info['IsIdentity'] == 1;
|
||||
$column->autoIncrement = $info['is_identity'] == 1;
|
||||
$column->unsigned = stripos($column->dbType, 'unsigned') !== false;
|
||||
$column->comment = $info['Comment'] === null ? '' : $column['Comment'];
|
||||
$column->comment = $info['comment'] === null ? '' : $info['comment'];
|
||||
|
||||
$column->type = self::TYPE_STRING;
|
||||
if (preg_match('/^(\w+)(?:\(([^\)]+)\))?/', $column->dbType, $matches)) {
|
||||
@@ -191,11 +191,11 @@ class Schema extends \yii\db\Schema
|
||||
|
||||
$column->phpType = $this->getColumnPhpType($column);
|
||||
|
||||
if ($info['COLUMN_DEFAULT'] == '(NULL)') {
|
||||
$info['COLUMN_DEFAULT'] = null;
|
||||
if ($info['column_default'] == '(NULL)') {
|
||||
$info['column_default'] = null;
|
||||
}
|
||||
if ($column->type !== 'timestamp' || $info['COLUMN_DEFAULT'] !== 'CURRENT_TIMESTAMP') {
|
||||
$column->defaultValue = $column->typecast($info['COLUMN_DEFAULT']);
|
||||
if ($column->type !== 'timestamp' || $info['column_default'] !== 'CURRENT_TIMESTAMP') {
|
||||
$column->defaultValue = $column->typecast($info['column_default']);
|
||||
}
|
||||
|
||||
return $column;
|
||||
@@ -221,9 +221,9 @@ class Schema extends \yii\db\Schema
|
||||
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
[t1].*,
|
||||
COLUMNPROPERTY(OBJECT_ID([t1].[table_schema] + '.' + [t1].[table_name]), [t1].[column_name], 'IsIdentity') AS IsIdentity,
|
||||
CONVERT(VARCHAR, [t2].[value]) AS Comment
|
||||
[t1].[column_name], [t1].[is_nullable], [t1].[data_type], [t1].[column_default],
|
||||
COLUMNPROPERTY(OBJECT_ID([t1].[table_schema] + '.' + [t1].[table_name]), [t1].[column_name], 'IsIdentity') AS is_identity,
|
||||
CONVERT(VARCHAR, [t2].[value]) AS comment
|
||||
FROM {$columnsTableName} AS [t1]
|
||||
LEFT OUTER JOIN [sys].[extended_properties] AS [t2] ON
|
||||
[t1].[ordinal_position] = [t2].[minor_id] AND
|
||||
|
||||
@@ -1364,7 +1364,7 @@ class Html
|
||||
return Yii::$app->getRequest()->getUrl();
|
||||
} else {
|
||||
$url = Yii::getAlias($url);
|
||||
if ($url[0] === '/' || strpos($url, '://')) {
|
||||
if ($url[0] === '/' || $url[0] === '#' || strpos($url, '://')) {
|
||||
return $url;
|
||||
} else {
|
||||
return Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
namespace yii\web;
|
||||
|
||||
use Yii;
|
||||
use yii\base\HttpException;
|
||||
use yii\base\InvalidRouteException;
|
||||
|
||||
/**
|
||||
* Application is the base class for all application classes.
|
||||
@@ -25,6 +27,7 @@ class Application extends \yii\base\Application
|
||||
/**
|
||||
* Processes the request.
|
||||
* @return integer the exit status of the controller action (0 means normal, non-zero values mean abnormal)
|
||||
* @throws HttpException if the request cannot be resolved.
|
||||
*/
|
||||
public function processRequest()
|
||||
{
|
||||
@@ -32,7 +35,11 @@ class Application extends \yii\base\Application
|
||||
Yii::setAlias('@wwwroot', dirname($request->getScriptFile()));
|
||||
Yii::setAlias('@www', $request->getBaseUrl());
|
||||
list ($route, $params) = $request->resolve();
|
||||
return $this->runAction($route, $params);
|
||||
try {
|
||||
return $this->runAction($route, $params);
|
||||
} catch (InvalidRouteException $e) {
|
||||
throw new HttpException(404, $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
private $_homeUrl;
|
||||
|
||||
Reference in New Issue
Block a user