DBIx::Class parser stubs
Justin Hunter [Tue, 23 Mar 2010 20:32:19 +0000 (13:32 -0700)]
lib/SQL/Translator/Grammar/DBIx/Class.pm [new file with mode: 0644]
lib/SQL/Translator/Parser/DDL/DBIx/.Class.pm.swp [new file with mode: 0644]
lib/SQL/Translator/Parser/DDL/DBIx/Class.pm [new file with mode: 0644]
t/999dbic_parser.t [new file with mode: 0644]

diff --git a/lib/SQL/Translator/Grammar/DBIx/Class.pm b/lib/SQL/Translator/Grammar/DBIx/Class.pm
new file mode 100644 (file)
index 0000000..190bb21
--- /dev/null
@@ -0,0 +1,3 @@
+use MooseX::Declare;
+role SQL::Translator::Grammar::DBIx::Class {
+}
diff --git a/lib/SQL/Translator/Parser/DDL/DBIx/.Class.pm.swp b/lib/SQL/Translator/Parser/DDL/DBIx/.Class.pm.swp
new file mode 100644 (file)
index 0000000..eaaeb27
Binary files /dev/null and b/lib/SQL/Translator/Parser/DDL/DBIx/.Class.pm.swp differ
diff --git a/lib/SQL/Translator/Parser/DDL/DBIx/Class.pm b/lib/SQL/Translator/Parser/DDL/DBIx/Class.pm
new file mode 100644 (file)
index 0000000..a20fb1b
--- /dev/null
@@ -0,0 +1,20 @@
+use MooseX::Declare;
+role SQL::Translator::Parser::DDL::DBIx::Class {
+    use MooseX::Types::Moose qw();
+    use MooseX::MultiMethods;
+    use SQL::Translator::Constants qw(:sqlt_types :sqlt_constants);
+    use aliased 'SQL::Translator::Object::Column';
+    use aliased 'SQL::Translator::Object::Constraint';
+    use aliased 'SQL::Translator::Object::ForeignKey';
+    use aliased 'SQL::Translator::Object::Index';
+    use aliased 'SQL::Translator::Object::PrimaryKey';
+    use aliased 'SQL::Translator::Object::Procedure';
+    use aliased 'SQL::Translator::Object::Schema';
+    use aliased 'SQL::Translator::Object::Table';
+    use aliased 'SQL::Translator::Object::View';
+
+    multi method parse(Schema $data) { $data }
+
+    multi method parse(Str $data) {
+    }
+}
diff --git a/t/999dbic_parser.t b/t/999dbic_parser.t
new file mode 100644 (file)
index 0000000..dbb0420
--- /dev/null
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+use Test::More;
+use SQL::Translator;
+use SQL::Translator::Constants qw(:sqlt_types :sqlt_constants);
+
+my $t   = SQL::Translator->new( trace => 0, from => 'DBIx::Class' );
+$| = 1;
+
+my $sql = '';
+
+my $data   = $t->parse( $sql );
+my $schema = $t->schema;
+
+isa_ok( $schema, 'SQL::Translator::Object::Schema', 'Schema object' );
+
+done_testing;