Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
7d6871d8
Commit
7d6871d8
authored
May 23, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
cf225677
34c3669c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Schema.php
framework/yii/db/mssql/Schema.php
+12
-12
No files found.
framework/yii/db/mssql/Schema.php
View file @
7d6871d8
...
...
@@ -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
[
'
IsI
dentity'
]
==
1
;
$column
->
autoIncrement
=
$info
[
'
is_i
dentity'
]
==
1
;
$column
->
unsigned
=
stripos
(
$column
->
dbType
,
'unsigned'
)
!==
false
;
$column
->
comment
=
$info
[
'
Comment'
]
===
null
?
''
:
$info
[
'C
omment'
];
$column
->
comment
=
$info
[
'
comment'
]
===
null
?
''
:
$info
[
'c
omment'
];
$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].[
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
IsI
dentity,
CONVERT(VARCHAR, [t2].[value]) AS
C
omment
[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_i
dentity,
CONVERT(VARCHAR, [t2].[value]) AS
c
omment
FROM {$columnsTableName} AS [t1]
LEFT OUTER JOIN [sys].[extended_properties] AS [t2] ON
[t1].[ordinal_position] = [t2].[minor_id] AND
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment