Commit | Line | Data |
a4d36ff6 |
1 | package DBM::Deep::Sector::DBI::Scalar; |
2 | |
3 | use strict; |
4 | use warnings FATAL => 'all'; |
5 | |
6 | use base qw( DBM::Deep::Sector::DBI ); |
7 | |
8 | sub table { 'datas' } |
9 | |
10 | sub _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 | |
25 | sub data { |
26 | my $self = shift; |
27 | $self->{value}; |
28 | } |
29 | |
30 | =pod |
31 | sub 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 | |
48 | 1; |
49 | __END__ |