From: Rafael Kitover Date: Mon, 25 May 2009 02:00:15 +0000 (+0000) Subject: initial hackage, will be cleaned up X-Git-Tag: 0.04999_08~17^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=995edf3f035cbd35082df6d41230e84472ba4270;p=dbsrgits%2FDBIx-Class-Schema-Loader.git initial hackage, will be cleaned up --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm b/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm new file mode 100644 index 0000000..b4cdec3 --- /dev/null +++ b/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm @@ -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; diff --git a/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm new file mode 100644 index 0000000..5b956ab --- /dev/null +++ b/lib/DBIx/Class/Schema/Loader/DBI/ODBC/Microsoft_SQL_Server.pm @@ -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;