Skip to content

Commit

Permalink
added get_id method for fixedrec ordstore, added a compress database …
Browse files Browse the repository at this point in the history
…for yote.
  • Loading branch information
ewolf committed Mar 9, 2017
1 parent 882cbab commit ee17d56
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FixedRecordStore/lib/Data/RecordStore.pm
Expand Up @@ -451,7 +451,7 @@ sub convert {

print STDERR "Adding version information\n";

Core::open( my $FH, ">", "$dest_dir/VERSION");
CORE::open( my $FH, ">", "$dest_dir/VERSION");
print $FH "$Data::RecordStore::VERSION\n";
close $FH;

Expand Down
9 changes: 9 additions & 0 deletions YoteBase/bin/yote_exporer
Expand Up @@ -7,6 +7,15 @@ no warnings 'numeric';
use Yote;
use Data::Dumper;

#
# In case this database has yote::server objects.
# the Yote::Server package has subpackages. For example,
# loading Yote::ServerObj cannot be done by 'use Yote::ServerObj',
# only 'use Yote::Server'
# If this is not available, that's okey.
#
eval("use Yote::Server");

my $db_dir = shift @ARGV || '/opt/yote/DATA_STORE';
my $store = Yote::open_store( $db_dir );

Expand Down
6 changes: 3 additions & 3 deletions YoteBase/lib/Yote.pm
Expand Up @@ -401,7 +401,7 @@ sub stow {
$cls = $ref;
}
my $id = $self->_get_id( $obj );
my $text_rep = $self->_raw_data( $obj );
my( $text_rep ) = $self->_raw_data( $obj );
$self->{_DATASTORE}->_stow( $id, $cls, $text_rep );
delete $self->{_DIRTY}{$id};
} #stow
Expand Down Expand Up @@ -638,9 +638,9 @@ sub _raw_data {
}

if( $is_array ) {
return join( "`", map { s/[\\]/\\\\/gs; s/`/\\`/gs; $_ } @$r ), $r;
return join( "`", map { if( defined($_) ) { s/[\\]/\\\\/gs; s/`/\\`/gs; } $_ } @$r ), $r;
}
return join( "`", map { s/[\\]/\\\\/gs; s/`/\\`/gs; $_ } %$r ), $r;
return join( "`", map { if( defined($_) ) { s/[\\]/\\\\/gs; s/`/\\`/gs; } $_ } %$r ), $r;

} #_raw_data

Expand Down
10 changes: 10 additions & 0 deletions YoteBase/t/yotedb.t
Expand Up @@ -76,6 +76,13 @@ sub test_suite {

my $list_to_remove = $root_node->get_myList();

$list_to_remove->[9] = "NINE";

$store->stow_all;

undef $list_to_remove;
$list_to_remove = $root_node->get_myList();

my $hash_in_list = $list_to_remove->[0];

my $list_to_remove_id = $store->_get_id( $list_to_remove );
Expand All @@ -100,9 +107,12 @@ sub test_suite {
my $quickly_removed_obj = $store->newobj( { soon => 'gone' } );
my $quickly_removed_id = $quickly_removed_obj->{ID};
push @$list_to_remove, "SDLFKJSDFLKJSDFKJSDHFKJSDHFKJSHDFKJSHDF" x 3, $quickly_removed_obj;
$list_to_remove->[88] = "EIGHTYEIGHT";

$store->stow_all;



undef $list_to_remove;
undef $quickly_removed_obj;

Expand Down

0 comments on commit ee17d56

Please sign in to comment.