1 package dbixcsl_mssql_extra_tests;
11 CREATE TABLE [mssql_loader_test1.dot] (
12 id INT IDENTITY NOT NULL PRIMARY KEY,
17 CREATE TABLE mssql_loader_test3 (
18 id INT IDENTITY NOT NULL PRIMARY KEY
22 CREATE VIEW mssql_loader_test4 AS
23 SELECT * FROM mssql_loader_test3
27 'CREATE TABLE mssql_loader_test3 (id INT IDENTITY NOT NULL PRIMARY KEY)',
28 'DROP VIEW mssql_loader_test4',
31 '[mssql_loader_test1.dot]',
36 my ($schema, $monikers, $classes) = @_;
38 # Test that the table above (with '.' in name) gets loaded correctly.
40 $schema->resultset($monikers->{'[mssql_loader_test1.dot]'}) }),
41 'got a resultset for table with dot in name');
43 ok((my $from = eval { $rs->result_source->from }),
44 'got an $rsrc->from for table with dot in name');
46 is ref($from), 'SCALAR', '->table with dot in name is a scalar ref';
48 is eval { $$from }, "[mssql_loader_test1.dot]",
49 '->table with dot in name has correct name';
51 # Test that identity columns do not have 'identity' in the data_type, and do
52 # have is_auto_increment.
53 my $identity_col_info = $schema->resultset($monikers->{loader_test10})
54 ->result_source->column_info('id10');
56 is $identity_col_info->{data_type}, 'int',
57 q{'INT IDENTITY' column has data_type => 'int'};
59 is $identity_col_info->{is_auto_increment}, 1,
60 q{'INT IDENTITY' column has is_auto_increment => 1};
62 # Test that a bad view (where underlying table is gone) is ignored.
63 my $dbh = $schema->storage->dbh;
64 $dbh->do("DROP TABLE mssql_loader_test3");
68 local $SIG{__WARN__} = sub { push @warnings, $_[0] };
71 ok ((grep /^Bad table or view 'mssql_loader_test4'/, @warnings),
75 $schema->resultset($monikers->{mssql_loader_test4})
76 } qr/Can't find source/,
77 'no source registered for bad view';