3 use dbixcsl_common_tests;
7 my $dsn = $ENV{DBICTEST_SYBASE_DSN} || '';
8 my $user = $ENV{DBICTEST_SYBASE_USER} || '';
9 my $password = $ENV{DBICTEST_SYBASE_PASS} || '';
11 my $tester = dbixcsl_common_tests->new(
13 auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
16 password => $password,
20 CREATE TABLE sybase_loader_test1 (
21 id INTEGER IDENTITY NOT NULL PRIMARY KEY,
23 charfield VARCHAR(10) DEFAULT 'foo',
24 computed_dt AS getdate()
28 drop => [ qw/ sybase_loader_test1 / ],
31 my ($schema, $monikers, $classes) = @_;
33 my $rs = $schema->resultset($monikers->{sybase_loader_test1});
34 my $rsrc = $rs->result_source;
36 is $rsrc->column_info('id')->{data_type},
38 'INTEGER IDENTITY data_type is correct';
40 is $rsrc->column_info('id')->{is_auto_increment},
42 'INTEGER IDENTITY is_auto_increment => 1';
45 local $TODO = 'timestamp introspection broken';
47 is $rsrc->column_info('ts')->{data_type},
49 'timestamps have the correct data_type';
52 is $rsrc->column_info('charfield')->{data_type},
54 'VARCHAR has correct data_type';
57 local $TODO = 'constant DEFAULT introspection';
59 is $rsrc->column_info('charfield')->{default_value},
61 'constant DEFAULT is correct';
64 is $rsrc->column_info('charfield')->{size},
66 'VARCHAR(10) has correct size';
68 ok ((exists $rsrc->column_info('computed_dt')->{data_type}
69 && (not defined $rsrc->column_info('computed_dt')->{data_type})),
70 'data_type for computed column exists and is undef')
71 or diag "Data type is: ",
72 $rsrc->column_info('computed_dt')->{data_type}
76 local $TODO = 'default_value for computed columns';
78 my $computed_dt_default =
79 $rsrc->column_info('computed_dt')->{default_value};
81 ok ((ref $computed_dt_default eq 'SCALAR'),
82 'default_value for computed column is a scalar ref')
83 # or diag "default_value is: ", $computed_dt_default
86 eval { is $$computed_dt_default,
88 'default_value for computed column is correct' };
94 if( !$dsn || !$user ) {
95 $tester->skip_tests('You need to set the DBICTEST_SYBASE_DSN, _USER, and _PASS environment variables');