Subject: | fix mysql schema loader for enums with empty string |
Date: | Wed, 12 Jun 2013 15:16:43 +0200 (CEST) |
To: | bug-DBIx-Class-Schema-Loader [...] rt.cpan.org |
From: | Martin SolĨiansky <martin.solciansky [...] bubble.eu> |
when mysql enum contains an empty string (''), the regexp fails to provide correct values.
for example:
enum('','string1','string2') fails.
possible solution:
--- DBIx/Class/Schema/Loader/DBI/mysql.pm.orig 2013-02-26 17:35:52.000000000 +0100
+++ DBIx/Class/Schema/Loader/DBI/mysql.pm 2013-06-12 14:54:07.000000000 +0200
@@ -269,7 +269,7 @@
delete $info->{extra}{list};
- while ($column_type =~ /'((?:[^']* (?:''|\\')* [^']*)* [^\\'])',?/xg) {
+ while ($column_type =~ /'((?:(?:[^']* (?:''|\\')* [^']*)* [^\\'])|)',?/xg) {
my $el = $1;
$el =~ s/''/'/g;
push @{ $info->{extra}{list} }, $el;