Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
6c789b30
Unverified
Commit
6c789b30
authored
Apr 10, 2020
by
Grégoire Paris
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3939 from morozov/issues/3937
Fix parsing column comments on SQLite
parents
86e563a3
a5a09a10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+1
-1
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+15
-0
No files found.
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
6c789b30
...
@@ -496,7 +496,7 @@ CREATE\sTABLE # Match "CREATE TABLE"
...
@@ -496,7 +496,7 @@ CREATE\sTABLE # Match "CREATE TABLE"
private
function
parseColumnCommentFromSQL
(
string
$column
,
string
$sql
)
:
?
string
private
function
parseColumnCommentFromSQL
(
string
$column
,
string
$sql
)
:
?
string
{
{
$pattern
=
'{[\s(,](?:\W'
.
preg_quote
(
$this
->
_platform
->
quoteSingleIdentifier
(
$column
))
.
'\W|\W'
.
preg_quote
(
$column
)
$pattern
=
'{[\s(,](?:\W'
.
preg_quote
(
$this
->
_platform
->
quoteSingleIdentifier
(
$column
))
.
'\W|\W'
.
preg_quote
(
$column
)
.
'\W)(?:\(
.
*?\)|[^,(])*?,?((?:(?!\n))(?:\s*--[^\n]*\n?)+)}i'
;
.
'\W)(?:\(
[^)]
*?\)|[^,(])*?,?((?:(?!\n))(?:\s*--[^\n]*\n?)+)}i'
;
if
(
preg_match
(
$pattern
,
$sql
,
$match
)
!==
1
)
{
if
(
preg_match
(
$pattern
,
$sql
,
$match
)
!==
1
)
{
return
null
;
return
null
;
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
6c789b30
...
@@ -278,4 +278,19 @@ SQL;
...
@@ -278,4 +278,19 @@ SQL;
// with an empty table, non autoincrement rowid is always 1
// with an empty table, non autoincrement rowid is always 1
$this
->
assertEquals
(
1
,
$lastUsedIdAfterDelete
);
$this
->
assertEquals
(
1
,
$lastUsedIdAfterDelete
);
}
}
public
function
testOnlyOwnCommentIsParsed
()
:
void
{
$table
=
new
Table
(
'own_column_comment'
);
$table
->
addColumn
(
'col1'
,
'string'
,
[
'length'
=>
16
]);
$table
->
addColumn
(
'col2'
,
'string'
,
[
'length'
=>
16
,
'comment'
=>
'Column #2'
]);
$table
->
addColumn
(
'col3'
,
'string'
,
[
'length'
=>
16
]);
$sm
=
$this
->
connection
->
getSchemaManager
();
$sm
->
createTable
(
$table
);
$this
->
assertNull
(
$sm
->
listTableDetails
(
'own_column_comment'
)
->
getColumn
(
'col1'
)
->
getComment
());
}
}
}
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