[Bast-commits] r6409 - in
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI:
. ODBC
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon May 25 02:00:16 GMT 2009
Author: caelum
Date: 2009-05-25 02:00:15 +0000 (Mon, 25 May 2009)
New Revision: 6409
Added:
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC/
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm
Log:
initial hackage, will be cleaned up
Added: branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm (rev 0)
+++ branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm 2009-05-25 02:00:15 UTC (rev 6409)
@@ -0,0 +1,16 @@
+package DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server;
+
+use base 'DBIx::Class::Schema::Loader::DBI::MSSQL';
+
+sub _tables_list {
+ my $self = shift;
+
+ my $dbh = $self->schema->storage->dbh;
+ my @tables = $dbh->tables(undef, $self->db_schema);
+ s/\Q$self->{_quoter}\E//g for @tables;
+ s/^.*\Q$self->{_namesep}\E// for @tables;
+
+ return @tables;
+}
+
+1;
Added: branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm (rev 0)
+++ branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm 2009-05-25 02:00:15 UTC (rev 6409)
@@ -0,0 +1,26 @@
+package DBIx::Class::Schema::Loader::DBI::ODBC;
+
+use strict;
+use warnings;
+use base 'DBIx::Class::Schema::Loader::DBI';
+use Carp::Clan qw/^DBIx::Class/;
+use Class::C3;
+
+our $VERSION = '0.04999_06';
+
+sub _rebless {
+ my $self = shift;
+ my $dbh = $self->schema->storage->dbh;
+
+# stolen from DBIC ODBC driver for MSSQL
+ my $dbtype = eval { $dbh->get_info(17) };
+ unless ( $@ ) {
+ # Translate the backend name into a perl identifier
+ $dbtype =~ s/\W/_/gi;
+ my $class = "DBIx::Class::Schema::Loader::DBI::ODBC::${dbtype}";
+ eval "require $class";
+ bless $self, $class unless $@;
+ }
+}
+
+1;
More information about the Bast-commits
mailing list