diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index 46e6544c4..23b81a587 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -267,7 +267,7 @@ public function getDeclaration($name, array $field) ' ' . $field['check'] : ''; $comment = (isset($field['comment']) && $field['comment']) ? - " COMMENT '" . $field['comment'] . "'" : ''; + " COMMENT " . $this->conn->quote($field['comment'], 'text') : ''; $method = 'get' . $field['type'] . 'Declaration'; diff --git a/tests/Ticket/DC709TestCase.php b/tests/Ticket/DC709TestCase.php new file mode 100644 index 000000000..d34c0d52e --- /dev/null +++ b/tests/Ticket/DC709TestCase.php @@ -0,0 +1,47 @@ +. + */ + +/** + * Doctrine_Ticket_DC709_TestCase + * + * @package Doctrine + * @author John Kary + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.doctrine-project.org + * @since 1.0 + * @version $Revision$ + */ +class Doctrine_Ticket_DC709_TestCase extends Doctrine_UnitTestCase +{ + public function testTest() + { + $dbh = new Doctrine_Adapter_Mock('mysql'); + + $conn = Doctrine_Manager::getInstance()->connection($dbh, 'mysql', false); + + $sql = $conn->export->createTableSql('mytable', array( + 'name' => array('type' => 'string', 'length' => 255, 'comment' => "This comment isn't breaking") + )); + + $this->assertEqual($sql[0], "CREATE TABLE mytable (name VARCHAR(255) COMMENT 'This comment isn''t breaking') ENGINE = INNODB"); + } +} \ No newline at end of file