Subject: | SQLite schema scanner using the wrong quote |
Hi,
Schema::Loader failed to handle a SQLite schema of mine which was using
excessive quoting of identifiers (it was generated). For example.
CREATE TABLE "foo" (
"thing" INTEGER PRIMARY KEY
);
The problem is the regex its using to strip off "CREATE TABLE foo" is
looking for words, spaces or SINGLE quotes. SQL identifiers are quoted
with double quotes.
Here's a patch. Sorry there's no test, the Schema::Loader tests are a
bit opaque.
--- a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm
+++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm
@@ -62,7 +62,7 @@ sub _sqlite_parse_table {
$sth->finish;
# Cut "CREATE TABLE ( )" blabla...
- $sql =~ /^[\w\s']+\((.*)\)$/si;
+ $sql =~ /^[\w\s"]+\((.*)\)$/si;
my $cols = $1;
# strip single-line comments