(no commit message)
[dbsrgits/DBIx-Class.git] / t / bindtype_columns.t
1 use strict;
2 use warnings;  
3
4 use Test::More;
5 use lib qw(t/lib);
6 use DBICTest;
7
8 my $schema = DBICTest->init_schema();
9
10 plan tests => 2;
11
12 # figure out if we've got a version of sqlite that is older than 3.2.6, in
13 # which case COUNT(DISTINCT()) doesn't work
14 my $is_broken_sqlite = 0;
15 my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
16     split /\./, $schema->storage->dbh->get_info(18);
17 if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
18     ( ($sqlite_major_ver < 3) ||
19       ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
20       ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
21     $is_broken_sqlite = 1;
22 }
23
24
25 #Bindtest
26 {
27         my $new = $schema->resultset("Artist")->new({
28         
29                 artistid=>25,
30                 name=>'JohnNapiorkowski',
31         });
32         
33         $new->update_or_insert;
34         
35         my $resultset = $schema->resultset("Artist")->find({artistid=>25});
36         
37         is($resultset->id, 25, 'Testing New ID');
38         is($resultset->name, 'JohnNapiorkowski', 'Testing New Name');
39 }
40
41