Skip Menu |

This queue is for tickets about the DBIx-VersionedDDL CPAN distribution.

Report information
The Basics
Id: 55550
Status: resolved
Priority: 0/
Queue: DBIx-VersionedDDL

People
Owner: Nobody in particular
Requestors: Alan [...] Wave2.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: (no value)



Subject: Failing to replace -- comments correctly
While trying to upgrade using a sql script like the following: -- -- Table structure for table `user_roles` -- CREATE TABLE `user_roles` ( `user_id` int(11) NOT NULL DEFAULT '0', `role_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`user_id`,`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; VersionedDDL creates the schema_version and inserts a success value, however the table is not created. It looks like the comment sequence is not being removed correctly and instead results in the whole command (up to the semicolon) being parsed by MySQL as one long comment. I believe it is due to the way the comments are substituted ( $ddl =~ s/--.*$/ /g; ). If I add the m option to the pattern match (to treat the string as multiple lines) this seems to fix the problem ( $ddl =~ s/--.*$/ /mg; ). It would also be handy if you could add other comment styles as I often see the # character used within scripts for one liners. This page lists the styles for MySQL: http://dev.mysql.com/doc/refman/5.1/en/comments.html Many thanks for your work on this - the module is extremely handy!. Distribution name: DBIx-VersionedDDL-0.05 Perl Version: v5.10.1 Operating System: FreeBSD 8.0-RELEASE
Hi, This should be fixed in v0.06 ... now winging its way to CPAN. Please test and let me know if it fixes your issue. Dan On Sun Mar 14 05:58:07 2010, wave2 wrote: Show quoted text
> While trying to upgrade using a sql script like the following: > > -- > -- Table structure for table `user_roles` > -- > > CREATE TABLE `user_roles` ( > `user_id` int(11) NOT NULL DEFAULT '0', > `role_id` int(11) NOT NULL DEFAULT '0', > PRIMARY KEY (`user_id`,`role_id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > VersionedDDL creates the schema_version and inserts a success value, > however the table is > not created. > > It looks like the comment sequence is not being removed correctly and > instead results in the > whole command (up to the semicolon) being parsed by MySQL as one long > comment. > > I believe it is due to the way the comments are substituted ( $ddl =~ > s/--.*$/ /g; ). > > If I add the m option to the pattern match (to treat the string as > multiple lines) this seems to > fix the problem ( $ddl =~ s/--.*$/ /mg; ). > > It would also be handy if you could add other comment styles as I > often see the # character > used within scripts for one liners. > > This page lists the styles for MySQL: > http://dev.mysql.com/doc/refman/5.1/en/comments.html > > Many thanks for your work on this - the module is extremely handy!. > > Distribution name: DBIx-VersionedDDL-0.05 > Perl Version: v5.10.1 > Operating System: FreeBSD 8.0-RELEASE
Subject: Re: [rt.cpan.org #55550] Failing to replace -- comments correctly
Date: Wed, 17 Mar 2010 19:54:58 +0000
To: bug-DBIx-VersionedDDL [...] rt.cpan.org
From: Alan Snelson <alan.snelson [...] gmail.com>
Hi Dan, Tested against MySQL will all comment styles and it worked a treat. Thanks for the speedy fix and enhancements!. Alan On 17 Mar 2010, at 08:37, Dan Horne via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=55550 > > > Hi, > > This should be fixed in v0.06 ... now winging its way to CPAN. Please > test and let me know if it fixes your issue. > > Dan > > On Sun Mar 14 05:58:07 2010, wave2 wrote:
>> While trying to upgrade using a sql script like the following: >> >> -- >> -- Table structure for table `user_roles` >> -- >> >> CREATE TABLE `user_roles` ( >> `user_id` int(11) NOT NULL DEFAULT '0', >> `role_id` int(11) NOT NULL DEFAULT '0', >> PRIMARY KEY (`user_id`,`role_id`) >> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; >> >> VersionedDDL creates the schema_version and inserts a success value, >> however the table is >> not created. >> >> It looks like the comment sequence is not being removed correctly and >> instead results in the >> whole command (up to the semicolon) being parsed by MySQL as one long >> comment. >> >> I believe it is due to the way the comments are substituted ( $ddl =~ >> s/--.*$/ /g; ). >> >> If I add the m option to the pattern match (to treat the string as >> multiple lines) this seems to >> fix the problem ( $ddl =~ s/--.*$/ /mg; ). >> >> It would also be handy if you could add other comment styles as I >> often see the # character >> used within scripts for one liners. >> >> This page lists the styles for MySQL: >> http://dev.mysql.com/doc/refman/5.1/en/comments.html >> >> Many thanks for your work on this - the module is extremely handy!. >> >> Distribution name: DBIx-VersionedDDL-0.05 >> Perl Version: v5.10.1 >> Operating System: FreeBSD 8.0-RELEASE
> > >
You're welcome