4 use DBIx::Class::Optional::Dependencies;
5 use DBIx::Class::Schema::Loader::DBI::ODBC::ACCESS ();
7 use dbixcsl_common_tests;
9 my %env2optdep = map { $_ => lc "test_rdbms_$_" } qw(MSACCESS_ODBC MSACCESS_ADO);
11 plan skip_all => 'requirements not satisfied: ' . (join ' OR ', map
12 { "[ @{[ DBIx::Class::Schema::Loader::Optional::Dependencies->req_missing_for( $_ ) ]} ]" }
15 { DBIx::Class::Schema::Loader::Optional::Dependencies->req_ok_for( $_ ) }
20 for my $type (keys %env2optdep) {
22 @conninfo{qw(dsn user password)} = map { $ENV{"DBICTEST_${type}_$_"} } qw(DSN USER PASS);
23 next unless $conninfo{dsn};
25 my $dep_group = $env2optdep{$type};
26 if (!DBIx::Class::Schema::Loader::Optional::Dependencies->req_ok_for($dep_group)) {
27 diag "Testing with DBICTEST_${type}_DSN needs " . DBIx::Class::Schema::Loader::Optional::Dependencies->req_missing_for($dep_group);
31 $dsns{$type} = \%conninfo;
34 my %ado_extra_types = (
35 'tinyint' => { data_type => 'tinyint', original => { data_type => 'byte' } },
36 'smallmoney' => { data_type => 'money', original => { data_type => 'currency' } },
37 'decimal' => { data_type => 'decimal' },
38 'decimal(3)' => { data_type => 'decimal', size => [3, 0] },
39 'decimal(3,3)'=> { data_type => 'decimal', size => [3, 3] },
40 'dec(5,5)' => { data_type => 'decimal', size => [5, 5] },
41 'numeric(2,2)'=> { data_type => 'decimal', size => [2, 2] },
42 'character' => { data_type => 'char', size => 255 },
43 'character varying(5)' => { data_type => 'varchar', size => 5 },
44 'nchar(5)' => { data_type => 'char', size => 5 },
45 'national character(5)' => { data_type => 'char', size => 5 },
46 'nvarchar(5)' => { data_type => 'varchar', size => 5 },
47 'national character varying(5)' => { data_type => 'varchar', size => 5 },
48 'national char varying(5)' => { data_type => 'varchar', size => 5 },
49 'smalldatetime' => { data_type => 'datetime' },
50 'uniqueidentifier' => { data_type => 'uniqueidentifier', original => { data_type => 'guid' } },
51 'text' => { data_type => 'text', original => { data_type => 'longchar' } },
52 'ntext' => { data_type => 'text', original => { data_type => 'longchar' } },
55 my $tester = dbixcsl_common_tests->new(
57 auto_inc_pk => 'AUTOINCREMENT PRIMARY KEY',
58 quote_char => [qw/[ ]/],
59 connect_info => [ map { $dsns{$_} } sort keys %dsns ],
61 # http://msdn.microsoft.com/en-us/library/bb208866(v=office.12).aspx
64 'autoincrement'=>{ data_type => 'integer', is_auto_increment => 1 },
65 'int' => { data_type => 'integer' },
66 'integer' => { data_type => 'integer' },
67 'long' => { data_type => 'integer' },
68 'integer4' => { data_type => 'integer' },
69 'smallint' => { data_type => 'smallint' },
70 'short' => { data_type => 'smallint' },
71 'integer2' => { data_type => 'smallint' },
72 'integer1' => { data_type => 'tinyint', original => { data_type => 'byte' } },
73 'byte' => { data_type => 'tinyint', original => { data_type => 'byte' } },
74 'bit' => { data_type => 'bit' },
75 'logical' => { data_type => 'bit' },
76 'logical1' => { data_type => 'bit' },
77 'yesno' => { data_type => 'bit' },
78 'money' => { data_type => 'money', original => { data_type => 'currency' } },
79 'currency' => { data_type => 'money', original => { data_type => 'currency' } },
80 'real' => { data_type => 'real' },
81 'single' => { data_type => 'real' },
82 'ieeesingle' => { data_type => 'real' },
83 'float4' => { data_type => 'real' },
84 'float' => { data_type => 'double precision', original => { data_type => 'double' } },
85 'float' => { data_type => 'double precision', original => { data_type => 'double' } },
86 'float8' => { data_type => 'double precision', original => { data_type => 'double' } },
87 'double' => { data_type => 'double precision', original => { data_type => 'double' } },
88 'ieeedouble' => { data_type => 'double precision', original => { data_type => 'double' } },
89 'number' => { data_type => 'double precision', original => { data_type => 'double' } },
92 'text(25)' => { data_type => 'varchar', size => 25 },
93 'char' => { data_type => 'char', size => 255 },
94 'char(5)' => { data_type => 'char', size => 5 },
95 'string(5)' => { data_type => 'varchar', size => 5 },
96 'varchar(5)' => { data_type => 'varchar', size => 5 },
99 'binary(10)' => { data_type => 'binary', size => 10 },
100 'varbinary(11)' => { data_type => 'varbinary', size => 11 },
103 'datetime' => { data_type => 'datetime' },
104 'time' => { data_type => 'datetime' },
105 'timestamp' => { data_type => 'datetime' },
108 'guid' => { data_type => 'uniqueidentifier', original => { data_type => 'guid' } },
111 'longchar' => { data_type => 'text', original => { data_type => 'longchar' } },
112 'longtext' => { data_type => 'text', original => { data_type => 'longchar' } },
113 'memo' => { data_type => 'text', original => { data_type => 'longchar' } },
114 'image' => { data_type => 'image', original => { data_type => 'longbinary' } },
115 'longbinary' => { data_type => 'image', original => { data_type => 'longbinary' } },
119 data_types_ddl_cb => sub {
122 package DBIXCSL_Test::DummySchema;
123 use base 'DBIx::Class::Schema';
125 my @connect_info = @{$dsns{MSACCESS_ODBC} || $dsns{MSACCESS_ADO}};
127 my $schema = DBIXCSL_Test::DummySchema->connect(@connect_info);
129 my $loader = DBIx::Class::Schema::Loader::DBI::ODBC::ACCESS->new(
134 my $conn = $loader->_ado_connection;
137 my $comm = Win32::OLE->new('ADODB.Command');
139 $comm->{ActiveConnection} = $conn;
140 $comm->{CommandText} = $ddl;
145 $tester->run_tests();
147 # vim:et sts=4 sw=4 tw=0: