1 use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_db2_400';
7 use DBIx::Class::Optional::Dependencies ();
11 # Probably best to pass the DBQ option in the DSN to specify a specific
12 # libray. Something like:
13 # DBICTEST_DB2_400_DSN='dbi:ODBC:dsn=MyAS400;DBQ=MYLIB'
14 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/};
18 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
20 my $dbh = $schema->storage->dbh;
22 eval { $dbh->do("DROP TABLE artist") };
26 artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
28 rank INTEGER default 13 not null,
32 # Just to test loading, already in Core
33 $schema->class('Artist')->load_components('PK::Auto');
35 # test primary key handling
36 my $new = $schema->resultset('Artist')->create({ name => 'foo' });
37 ok($new->artistid, "Auto-PK worked");
41 $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
43 my $it = $schema->resultset('Artist')->search( {},
45 order_by => 'artistid'
48 is( $it->count, 3, "LIMIT count ok" );
49 is( $it->next->name, "foo", "iterator->next ok" );
51 is( $it->next->name, "Artist 2", "iterator->next ok" );
52 is( $it->next, undef, "next past end of resultset ok" );
54 my $test_type_info = {
56 'data_type' => 'INTEGER',
61 'data_type' => 'VARCHAR',
66 'data_type' => 'INTEGER',
71 'data_type' => 'CHAR',
78 my $type_info = $schema->storage->columns_info_for('artist');
79 is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');
83 my $dbh = eval { $schema->storage->_dbh };
84 $dbh->do("DROP TABLE artist") if $dbh;