Fixed problem with large keys over 65535 bytes.
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Sector / DBI / Scalar.pm
CommitLineData
a4d36ff6 1package DBM::Deep::Sector::DBI::Scalar;
2
3use strict;
4use warnings FATAL => 'all';
5
6use base qw( DBM::Deep::Sector::DBI );
7
8sub table { 'datas' }
9
10sub _init {
11 my $self = shift;
12
cf4a1344 13 if ( $self->offset ) {
a4d36ff6 14 my ($rows) = $self->engine->storage->read_from(
15 datas => $self->offset,
cf4a1344 16 qw( id data_type key value class ),
a4d36ff6 17 );
18
19 $self->{$_} = $rows->[0]{$_} for qw( data_type key value class );
20 }
21
22 return;
23}
24
25sub data {
26 my $self = shift;
27 $self->{value};
28}
29
30=pod
31sub write_data {
32 my $self = shift;
33 my ($args) = @_;
34
35 $self->engine->storage->write_to(
36 datas => $args->{value}{offset},
37 ref_id => $self->offset,
38 data_type => 'S',
39 key => $args->{key},
40 value => $args->{value}{value},
41 class => $args->{value}{class},
42 );
43
44 $args->{value}->reload;
45}
46=cut
47
481;
49__END__