DBIx-Custom / t / access.t /
Newer Older
35 lines | 0.943kb
added Microsoft access .mdb ...
Yuki Kimoto authored on 2011-08-20
1
use Test::More;
2
use strict;
3
use warnings;
4
use utf8;
5

            
6
use FindBin;
7
use DBIx::Custom;
8

            
9
my $dbi;
10
my $dsn;
11
my $args;
12
my $database = "$FindBin::Bin/access.mdb";
13

            
14
$dsn = "dbi:ODBC:driver=Microsoft Access Driver (*.mdb);dbq=$database";
15

            
added Microsoft Access 2010 ...
Yuki Kimoto authored on 2011-08-20
16
plan skip_all => 'Microsoft access(ODBC, *.mdb) private test' unless -f "$FindBin::Bin/run/access.run"
added Microsoft access .mdb ...
Yuki Kimoto authored on 2011-08-20
17
  && eval { $dbi = DBIx::Custom->connect(dsn => $dsn); 1 };
18
plan 'no_plan';
19

            
20
my $model;
21
my $result;
22
my $rows;
23

            
24
eval { $dbi->execute("drop table table1") };
25
$dbi->execute("create table table1 (key1 varchar(255), key2 varchar(255))");
26
$model = $dbi->create_model(table => 'table1');
27
$model->insert({key1 => 1, key2 => 2});
28
$model->insert({key1 => 4, key2 => 5});
29
$model->insert({key1 => 6, key2 => 7});
30
$model->update({key2 => 3}, where => {key1 => 1});
31
$model->delete(where => {key1 => 6});
32
$rows = $model->select->all;
33
is_deeply($rows, [{key1 => 1, key2 => 3}, {key1 => 4, key2 => 5}]);
34
is($model->count, 2);
35