Revision history for Perl extension DBIx::Class::Schema::Loader
+ - fix loading MySQL views on older MySQL versions (RT#47399)
+
0.06001 2010-04-10 01:31:12
- fix type info for MSSQL
- fix MSSQL collation detection on freetds tds version 8.0
my ($self, $table) = @_;
my $dbh = $self->schema->storage->dbh;
- my $table_def_ref = $dbh->selectrow_arrayref("SHOW CREATE TABLE `$table`")
- or croak ("Cannot get table definition for $table");
- my $table_def = $table_def_ref->[1] || '';
+
+ local $dbh->{RaiseError} = 0;
+ local $dbh->{PrintError} = 0;
+
+ my $table_def_ref = eval { $dbh->selectrow_arrayref("SHOW CREATE TABLE `$table`") };
+ my $table_def = $table_def_ref->[1];
+
+ return [] if not $table_def;
my $qt = qr/["`]/;
"set('foo', 'bar', 'baz')"
=> { data_type => 'set', extra => { list => [qw/foo bar baz/] } },
},
+ extra => {
+ create => [
+ q{
+ CREATE TABLE mysql_loader_test1 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ value varchar(100)
+ )
+ },
+ q{
+ CREATE VIEW mysql_loader_test2 AS SELECT * FROM mysql_loader_test1
+ },
+ ],
+ pre_drop_ddl => [ 'DROP VIEW mysql_loader_test2', ],
+ drop => [ 'mysql_loader_test1', ],
+ count => 1,
+ run => sub {
+ my ($schema, $monikers, $classes) = @_;
+
+ my $rsrc = $schema->resultset($monikers->{mysql_loader_test2})->result_source;
+
+ is $rsrc->column_info('value')->{data_type}, 'varchar',
+ 'view introspected successfully';
+ },
+ },
);
if( !$dsn || !$user ) {