From: Jason M. Mills Date: Tue, 10 Feb 2009 03:30:07 +0000 (-0800) Subject: Merge 'rt_bug_41083' into 'trunk' X-Git-Tag: v0.08240~91 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=553d61c42d75a595174a47d22c652ffe000efcd6;p=dbsrgits%2FDBIx-Class.git Merge 'rt_bug_41083' into 'trunk' --- 553d61c42d75a595174a47d22c652ffe000efcd6 diff --cc t/bindtype_columns.t index 1462d9b,05b514c..cf0649d --- a/t/bindtype_columns.t +++ b/t/bindtype_columns.t @@@ -18,9 -18,9 +18,11 @@@ my $dbh = $schema->storage->dbh { local $SIG{__WARN__} = sub {}; - $dbh->do('DROP TABLE IF EXISTS artist'); + $dbh->do('DROP TABLE IF EXISTS bindtype_test'); + + # the blob/clob are for reference only, will be useful when we switch to SQLT and can test Oracle along the way + + # the blob/clob are for reference only, will be useful when we switch to SQLT and can test Oracle along the way $dbh->do(qq[ CREATE TABLE bindtype_test ( @@@ -32,57 -32,19 +34,21 @@@ ],{ RaiseError => 1, PrintError => 1 }); } - my $big_long_string = "\x00\x01\x02 abcd" x 125000; - - my $new; - # test inserting a row - { - $new = $schema->resultset('BindType')->create({ bytea => $big_long_string }); - - ok($new->id, "Created a bytea row"); - is($new->bytea, $big_long_string, "Set the blob correctly."); - } - -# test primary key handling -my $big_long_string = 'abcd' x 250000; +# test retrieval of the bytea column +{ + my $row = $schema->resultset('BindType')->find({ id => $new->id }); + is($row->get_column('bytea'), $big_long_string, "Created the blob correctly."); +} - TODO: { - local $TODO = - 'Passing bind attributes to $sth->bind_param() should be implemented (it only works in $storage->insert ATM)'; + my $new = $schema->resultset('BindType')->create({ bytea => $big_long_string }); - my $rs = $schema->resultset('BindType')->search({ bytea => $big_long_string }); + ok($new->id, "Created a bytea row"); + is($new->bytea, $big_long_string, "Set the blob correctly."); - # search on the bytea column (select) - { - my $row = $rs->first; - is($row ? $row->id : undef, $new->id, "Found the row searching on the bytea column."); - } + my $rs = $schema->resultset('BindType')->find({ id => $new->id }); - # search on the bytea column (update) - { - my $new_big_long_string = $big_long_string . "2"; - $schema->txn_do(sub { - $rs->update({ bytea => $new_big_long_string }); - my $row = $schema->resultset('BindType')->find({ id => $new->id }); - is($row ? $row->get_column('bytea') : undef, $new_big_long_string, - "Updated the row correctly (searching on the bytea column)." - ); - $schema->txn_rollback; - }); - } + is($rs->get_column('bytea'), $big_long_string, "Created the blob correctly."); - # search on the bytea column (delete) - { - $schema->txn_do(sub { - $rs->delete; - my $row = $schema->resultset('BindType')->find({ id => $new->id }); - is($row, undef, "Deleted the row correctly (searching on the bytea column)."); - $schema->txn_rollback; - }); - } - } + $dbh->do("DROP TABLE bindtype_test"); - - +$dbh->do("DROP TABLE bindtype_test");