ignore type_info errors from DBD::Sybase+MSSQL
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI.pm
index 600e269..c0042cf 100644 (file)
@@ -203,8 +203,8 @@ sub _filter_tables {
     my $constraint   = $opts->{constraint};
     my $exclude      = $opts->{exclude};
 
-    @tables = grep { /$constraint/ } @$tables if defined $constraint;
-    @tables = grep { ! /$exclude/  } @$tables if defined $exclude;
+    @tables = grep { /$constraint/ } @tables if defined $constraint;
+    @tables = grep { ! /$exclude/  } @tables if defined $exclude;
 
     TABLE: for my $table (@tables) {
         try {
@@ -326,10 +326,10 @@ sub _table_comment {
 
     my $comments_table = $self->table_comments_table;
 
-    my ($comment) = try { $self->dbh->selectrow_array(<<"EOF", {}, $table->name) };
+    my ($comment) = try { $self->dbh->selectrow_array(<<"EOF") };
 SELECT comment_text
 FROM $comments_table
-WHERE table_name = ?
+WHERE table_name = @{[ $self->dbh->quote($table->name) ]}
 EOF
 
     return $comment;
@@ -340,11 +340,11 @@ sub _column_comment {
 
     my $comments_table = $self->column_comments_table;
 
-    my ($comment) = try { $self->dbh->selectrow_array(<<"EOF", {}, $table->name, $column_name) };
+    my ($comment) = try { $self->dbh->selectrow_array(<<"EOF") };
 SELECT comment_text
 FROM $comments_table
-WHERE table_name = ?
-AND column_name = ?
+WHERE table_name = @{[ $self->dbh->quote($table->name) ]}
+AND column_name = @{[ $self->dbh->quote($column_name) ]}
 EOF
         
     return $comment;
@@ -504,7 +504,9 @@ sub _columns_info_for {
 sub _dbh_type_info_type_name {
     my ($self, $type_num) = @_;
 
-    my $type_info = $self->dbh->type_info($type_num);
+    # We wrap it in a try block for MSSQL+DBD::Sybase, which can have issues.
+    # TODO investigate further
+    my $type_info = try { $self->dbh->type_info($type_num) };
     
     return $type_info ? $type_info->{TYPE_NAME} : undef;
 }