1 package dbixcsl_mssql_extra_tests;
14 CREATE TABLE [mssql_loader_test1.dot] (
15 id INT IDENTITY NOT NULL PRIMARY KEY,
20 CREATE TABLE mssql_loader_test3 (
21 id INT IDENTITY NOT NULL PRIMARY KEY
25 CREATE VIEW mssql_loader_test4 AS
26 SELECT * FROM mssql_loader_test3
30 "[mssql_loader_test1.dot]",
35 my ($schema, $monikers, $classes) = @_;
37 # Test that the table above (with '.' in name) gets loaded correctly.
39 $schema->resultset($monikers->{'[mssql_loader_test1.dot]'}) }),
40 'got a resultset for table with dot in name');
42 ok((my $from = eval { $rs->result_source->from }),
43 'got an $rsrc->from for table with dot in name');
45 is ref($from), 'SCALAR', '->table with dot in name is a scalar ref';
47 is eval { $$from }, "[mssql_loader_test1.dot]",
48 '->table with dot in name has correct name';
50 # Test that identity columns do not have 'identity' in the data_type, and do
51 # have is_auto_increment.
52 my $identity_col_info = $schema->resultset($monikers->{loader_test10})
53 ->result_source->column_info('id10');
55 is $identity_col_info->{data_type}, 'int',
56 q{'INT IDENTITY' column has data_type => 'int'};
58 is $identity_col_info->{is_auto_increment}, 1,
59 q{'INT IDENTITY' column has is_auto_increment => 1};
61 # Test that a bad view (where underlying table is gone) is ignored.
62 $storage = $schema->storage;
64 my $dbh = $storage->dbh;
65 $dbh->do("DROP TABLE mssql_loader_test3");
69 local $SIG{__WARN__} = sub { push @warnings, $_[0] };
72 ok ((grep /^Bad table or view 'mssql_loader_test4'/, @warnings),
76 $schema->resultset($monikers->{mssql_loader_test4})
77 } qr/Can't find source/,
78 'no source registered for bad view';
82 # Clean up the bad view
86 my $dbh = $storage->dbh;
88 "CREATE TABLE mssql_loader_test3 (id INT IDENTITY NOT NULL PRIMARY KEY)",
89 "DROP VIEW mssql_loader_test4",
90 "DROP TABLE mssql_loader_test3",