[Bast-commits] r8233 -
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon Jan 4 11:14:21 GMT 2010
Author: caelum
Date: 2010-01-04 11:14:20 +0000 (Mon, 04 Jan 2010)
New Revision: 8233
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
Log:
ugly hack to ignore bad tables for ODBC/MSSQL
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm 2010-01-03 23:30:51 UTC (rev 8232)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm 2010-01-04 11:14:20 UTC (rev 8233)
@@ -38,6 +38,36 @@
$self->_set_quote_char_and_name_sep;
}
+# drop bad tables when constructing list
+sub _tables_list {
+ my $self = shift;
+
+ my @tables = $self->next::method(@_);
+ my @filtered_tables;
+
+ for my $table (@tables) {
+ my $full_quoted_table;
+ if($self->{db_schema}) {
+ $full_quoted_table = $self->{db_schema} . $self->{_namesep} .
+ $self->_quote_table_name($table);
+ } else {
+ $full_quoted_table = $self->_quote_table_name($table);
+ }
+ my $dbh = $self->schema->storage->dbh;
+ my $sth = $dbh->prepare($self->schema->storage->sql_maker
+ ->select(\$full_quoted_table, undef, \'1 = 0'));
+ eval { $sth->execute };
+ if (not $@) {
+ push @filtered_tables, $table;
+ }
+ else {
+ warn "Bad table or view '$table', ignoring.\n";
+ }
+ }
+
+ return @filtered_tables;
+}
+
# remove 'IDENTITY' from column data_type
sub _columns_info_for {
my $self = shift;
More information about the Bast-commits
mailing list