Skip to content

Commit 4e2e585

Browse files
committed
Add a test
1 parent 23bb561 commit 4e2e585

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

t/10-resultset-blob.t

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# $Id: 01-col-inheritance.t 989 2005-09-23 19:58:01Z btrott $
2+
3+
use strict;
4+
use warnings;
5+
6+
use lib 't/lib';
7+
8+
$Data::ObjectDriver::DEBUG = 0;
9+
use Test::More;
10+
use DodTestUtil;
11+
BEGIN { eval { require Crypt::URandom; 1 } or plan skip_all => 'requires Crypt::URandom' }
12+
13+
BEGIN { DodTestUtil->check_driver }
14+
15+
plan tests => 3;
16+
17+
setup_dbs({
18+
global => [ qw( wines ) ],
19+
});
20+
21+
use Wine;
22+
use Storable;
23+
24+
my $wine = Wine->new;
25+
$wine->name("Saumur Champigny, Le Grand Clos 2001");
26+
$wine->rating(4);
27+
28+
## generate some binary data (SQL_BLOB / MEDIUMBLOB)
29+
my $binary = Crypt::URandom::urandom(300);
30+
$wine->content($binary);
31+
ok($wine->save, 'Object saved successfully');
32+
33+
my $iter;
34+
35+
$iter = Data::ObjectDriver::Iterator->new(sub {});
36+
my $wine_id = $wine->id;
37+
undef $wine;
38+
$wine = Wine->lookup($wine_id);
39+
40+
ok $wine;
41+
ok $wine->content eq $binary;
42+
43+
# TODO: bulk_insert doesn't support blob yet. We need to change some of its API so that we can call column_def in each dbd's bulk_insert
44+
45+
disconnect_all($wine);
46+
teardown_dbs(qw( global ));

0 commit comments

Comments
 (0)