-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for column inline comments in SQLite #819
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1176 We use Jira to track the state of pull requests and the versions they got |
$createSql = $this->_conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); | ||
$createSql = isset($createSql[0]['sql']) ? $createSql[0]['sql'] : ''; | ||
// inspect column collation and comments | ||
$createSql = $this->_conn->fetchColumn("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm... why is DBAL not using a prepared statement here? :|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -570,6 +578,14 @@ public function getForUpdateSql() | |||
/** | |||
* {@inheritDoc} | |||
*/ | |||
public function getInlineColumnCommentSQL($comment) | |||
{ | |||
return "--{$comment}\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we make sure here that $comment
does not contain \n
? Otherwise the generated SQL will be invalid. We could either strip newlines or throw exception...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
4fca981
to
c27e90f
Compare
$createSql = $this->_conn->fetchColumn( | ||
'SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = "table" AND name = ?', | ||
array(str_replace('.', '__', $table)) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hason this change is not part of your PR, is it? Can we try to not mix different things here?
@deeky666 This is necessary for correct handling custom types in ORM |
Added support for inline comments for SQLite fixes #1118
No description provided.