4 use DBIx::Class::Optional::Dependencies;
5 use DBIx::Class::Schema::Loader::DBI::ODBC::ACCESS ();
7 use dbixcsl_common_tests;
10 for (qw(MSACCESS_ODBC MSACCESS_ADO)) {
11 next unless $ENV{"DBICTEST_${_}_DSN"};
13 my $dep_group = lc "rdbms_$_";
14 if (!DBIx::Class::Optional::Dependencies->req_ok_for($dep_group)) {
15 diag 'You need to install ' . DBIx::Class::Optional::Dependencies->req_missing_for($dep_group)
20 $dsns{$_}{dsn} = $ENV{"DBICTEST_${_}_DSN"};
21 $dsns{$_}{user} = $ENV{"DBICTEST_${_}_USER"};
22 $dsns{$_}{password} = $ENV{"DBICTEST_${_}_PASS"};
25 plan skip_all => 'You need to set the DBICTEST_MSACCESS_ODBC_DSN, _USER and _PASS and/or the DBICTEST_MSACCESS_ADO_DSN, _USER and _PASS environment variables'
28 my %ado_extra_types = (
29 'tinyint' => { data_type => 'tinyint', original => { data_type => 'byte' } },
30 'smallmoney' => { data_type => 'money', original => { data_type => 'currency' } },
31 'decimal' => { data_type => 'decimal' },
32 'decimal(3)' => { data_type => 'decimal', size => [3, 0] },
33 'decimal(3,3)'=> { data_type => 'decimal', size => [3, 3] },
34 'dec(5,5)' => { data_type => 'decimal', size => [5, 5] },
35 'numeric(2,2)'=> { data_type => 'decimal', size => [2, 2] },
36 'character' => { data_type => 'char', size => 255 },
37 'character varying(5)' => { data_type => 'varchar', size => 5 },
38 'nchar(5)' => { data_type => 'char', size => 5 },
39 'national character(5)' => { data_type => 'char', size => 5 },
40 'nvarchar(5)' => { data_type => 'varchar', size => 5 },
41 'national character varying(5)' => { data_type => 'varchar', size => 5 },
42 'national char varying(5)' => { data_type => 'varchar', size => 5 },
43 'smalldatetime' => { data_type => 'datetime' },
44 'uniqueidentifier' => { data_type => 'uniqueidentifier', original => { data_type => 'guid' } },
45 'text' => { data_type => 'text', original => { data_type => 'longchar' } },
46 'ntext' => { data_type => 'text', original => { data_type => 'longchar' } },
49 my $tester = dbixcsl_common_tests->new(
51 auto_inc_pk => 'AUTOINCREMENT PRIMARY KEY',
52 quote_char => [qw/[ ]/],
53 connect_info => [ map { $dsns{$_} } sort keys %dsns ],
55 # http://msdn.microsoft.com/en-us/library/bb208866(v=office.12).aspx
58 'autoincrement'=>{ data_type => 'integer', is_auto_increment => 1 },
59 'int' => { data_type => 'integer' },
60 'integer' => { data_type => 'integer' },
61 'long' => { data_type => 'integer' },
62 'integer4' => { data_type => 'integer' },
63 'smallint' => { data_type => 'smallint' },
64 'short' => { data_type => 'smallint' },
65 'integer2' => { data_type => 'smallint' },
66 'integer1' => { data_type => 'tinyint', original => { data_type => 'byte' } },
67 'byte' => { data_type => 'tinyint', original => { data_type => 'byte' } },
68 'bit' => { data_type => 'bit' },
69 'logical' => { data_type => 'bit' },
70 'logical1' => { data_type => 'bit' },
71 'yesno' => { data_type => 'bit' },
72 'money' => { data_type => 'money', original => { data_type => 'currency' } },
73 'currency' => { data_type => 'money', original => { data_type => 'currency' } },
74 'real' => { data_type => 'real' },
75 'single' => { data_type => 'real' },
76 'ieeesingle' => { data_type => 'real' },
77 'float4' => { data_type => 'real' },
78 'float' => { data_type => 'double precision', original => { data_type => 'double' } },
79 'float' => { data_type => 'double precision', original => { data_type => 'double' } },
80 'float8' => { data_type => 'double precision', original => { data_type => 'double' } },
81 'double' => { data_type => 'double precision', original => { data_type => 'double' } },
82 'ieeedouble' => { data_type => 'double precision', original => { data_type => 'double' } },
83 'number' => { data_type => 'double precision', original => { data_type => 'double' } },
86 'text(25)' => { data_type => 'varchar', size => 25 },
87 'char' => { data_type => 'char', size => 255 },
88 'char(5)' => { data_type => 'char', size => 5 },
89 'string(5)' => { data_type => 'varchar', size => 5 },
90 'varchar(5)' => { data_type => 'varchar', size => 5 },
93 'binary(10)' => { data_type => 'binary', size => 10 },
94 'varbinary(11)' => { data_type => 'varbinary', size => 11 },
97 'datetime' => { data_type => 'datetime' },
98 'time' => { data_type => 'datetime' },
99 'timestamp' => { data_type => 'datetime' },
102 'guid' => { data_type => 'uniqueidentifier', original => { data_type => 'guid' } },
105 'longchar' => { data_type => 'text', original => { data_type => 'longchar' } },
106 'longtext' => { data_type => 'text', original => { data_type => 'longchar' } },
107 'memo' => { data_type => 'text', original => { data_type => 'longchar' } },
108 'image' => { data_type => 'image', original => { data_type => 'longbinary' } },
109 'longbinary' => { data_type => 'image', original => { data_type => 'longbinary' } },
113 data_types_ddl_cb => sub {
116 package DBIXCSL_Test::DummySchema;
117 use base 'DBIx::Class::Schema';
119 my @connect_info = @{$dsns{MSACCESS_ODBC} || $dsns{MSACCESS_ADO}};
121 my $schema = DBIXCSL_Test::DummySchema->connect(@connect_info);
123 my $loader = DBIx::Class::Schema::Loader::DBI::ODBC::ACCESS->new(
128 my $conn = $loader->_ado_connection;
131 my $comm = Win32::OLE->new('ADODB.Command');
133 $comm->{ActiveConnection} = $conn;
134 $comm->{CommandText} = $ddl;
139 $tester->run_tests();
141 # vim:et sts=4 sw=4 tw=0: