8 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/};
10 #warn "$dsn $user $pass";
12 # Probably best to pass the DBQ option in the DSN to specify a specific
13 # libray. Something like:
14 # DBICTEST_DB2_400_DSN='dbi:ODBC:dsn=MyAS400;DBQ=MYLIB'
15 plan skip_all => 'Set $ENV{DBICTEST_DB2_400_DSN}, _USER and _PASS to run this test'
16 unless ($dsn && $user);
20 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
22 my $dbh = $schema->storage->dbh;
24 eval { $dbh->do("DROP TABLE artist") };
28 artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
30 rank INTEGER default 13 not null,
34 # Just to test loading, already in Core
35 $schema->class('Artist')->load_components('PK::Auto');
37 # test primary key handling
38 my $new = $schema->resultset('Artist')->create({ name => 'foo' });
39 ok($new->artistid, "Auto-PK worked");
43 $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
45 my $it = $schema->resultset('Artist')->search( {},
47 order_by => 'artistid'
50 is( $it->count, 3, "LIMIT count ok" );
51 is( $it->next->name, "foo", "iterator->next ok" );
53 is( $it->next->name, "Artist 2", "iterator->next ok" );
54 is( $it->next, undef, "next past end of resultset ok" );
56 my $test_type_info = {
58 'data_type' => 'INTEGER',
63 'data_type' => 'VARCHAR',
68 'data_type' => 'INTEGER',
73 'data_type' => 'CHAR',
80 my $type_info = $schema->storage->columns_info_for('artist');
81 is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');
85 $dbh->do("DROP TABLE artist") if $dbh;