Permalink
Browse files

Fixed long MediumString, long HashRef problem.

  • Loading branch information...
1 parent 433c5e3 commit 10afdbc5e07d79f42052fe1ab06bc64cb6009a5f @rizen rizen committed Apr 3, 2010
Showing with 15 additions and 4 deletions.
  1. +2 −1 Changes
  2. +10 −2 author.t/05.Domain_and_Item.t
  3. +3 −1 lib/SimpleDB/Class/Types.pm
View
@@ -1,5 +1,6 @@
-1.0301 2010-03-15
+1.0301 2010-04-04
- Fixed undefined value exception calling find() on non-existant item.
+ - Fixed long MediumString, long HashRef problem.
1.0300 2010-03-15
- Added options to the has_many and belongs_to methods for consistency and other things.
@@ -1,4 +1,4 @@
-use Test::More tests => 47;
+use Test::More tests => 48;
use Test::Deep;
use lib ('../lib', 'lib');
$|=1;
@@ -102,7 +102,8 @@ This is a really long note that I am adding to prove that we can have really lon
';
my $j = $domain->insert({start_date=>DateTime->new(year=>2000, month=>5, day=>5, hour=>5, minute=>5, second=>5), color=>'orange',size=>'large',parentId=>'one',properties=>{this=>'that'},quantity=>4, notes=>$note, components=>['cotton','dye','thread']});
-my $j1 = $domain->find($j->id);
+$foo->cache->flush;
+my $j1 = $domain->find($j->id, consistent=>1);
cmp_ok($j->start_date, '==', $j1->start_date, 'dates in are dates out');
is($j->start_date->year, 2000, 'year');
is($j->start_date->month, 5, 'month');
@@ -121,6 +122,13 @@ my $page2 = $domain->search(
)->paginate(2,2);
is($page2->next->color, 'orange', "pagination works");
+my $bighashref = {this=>'that',really_long_line_to_see_a_multiattribute_hash_ref_work=>'this is me testing to see what happens if i have a string that is too long to fit in one attribute value. perhaps its broken. 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000'};
+my $bigprops = $domain->insert({start_date=>DateTime->new(year=>2000, month=>5, day=>5, hour=>5, minute=>5, second=>5), color=>'orange',size=>'large',parentId=>'one',properties=>$bighashref,quantity=>4, notes=>$note, components=>['cotton','dye','thread']});
+
+$foo->cache->flush;
+my $bigprops2 = $domain->find($bigprops->id, consistent=>1);
+is($bigprops2->properties->{really_long_line_to_see_a_multiattribute_hash_ref_work}, $bighashref->{really_long_line_to_see_a_multiattribute_hash_ref_work}, 'long hashref works');
+
ok($domain->delete,'deleting domain');
$parent->delete;
$children->delete;
@@ -125,7 +125,9 @@ sub slice_string {
my $string = shift;
my @array;
my $i = 1;
- foreach my $part (split /.{1020}/, $string) {
+ my @parts;
+ push @parts, substr $string, 0, 1020, '' while length $string;
+ foreach my $part (@parts) {
push @array, sprintf "%03d|%s", $i, $part;
$i++;
}

0 comments on commit 10afdbc

Please sign in to comment.