137 |
|
|
138 |
By default, C<input_encoding> is assumed to be C<cp852>. |
By default, C<input_encoding> is assumed to be C<cp852>. |
139 |
|
|
140 |
C<offset> is optional parametar to position at some offset before reading from database. |
C<offset> is optional parametar to skip records at beginning. |
141 |
|
|
142 |
C<limit> is optional parametar to read just C<limit> records from database |
C<limit> is optional parametar to read just C<limit> records from database |
143 |
|
|
183 |
|
|
184 |
# store data in object |
# store data in object |
185 |
foreach my $v (qw/path offset limit/) { |
foreach my $v (qw/path offset limit/) { |
186 |
$self->{$v} = $arg->{$v} if ($arg->{$v}); |
$self->{$v} = $arg->{$v} if defined $arg->{$v}; |
187 |
} |
} |
188 |
|
|
189 |
if ($arg->{load_row} || $arg->{save_row}) { |
if ($arg->{load_row} || $arg->{save_row}) { |
230 |
|
|
231 |
my $class = $self->{module} || $log->logconfess("can't get low-level module name!"); |
my $class = $self->{module} || $log->logconfess("can't get low-level module name!"); |
232 |
|
|
233 |
|
$arg->{$_} = $self->{$_} foreach qw(offset limit); |
234 |
|
|
235 |
my $ll_db = $class->new( |
my $ll_db = $class->new( |
236 |
path => $arg->{path}, |
path => $arg->{path}, |
237 |
input_config => $arg->{input_config} || $self->{input_config}, |
input_config => $arg->{input_config} || $self->{input_config}, |
264 |
my $to_rec = $size; |
my $to_rec = $size; |
265 |
|
|
266 |
if (my $s = $self->{offset}) { |
if (my $s = $self->{offset}) { |
267 |
$log->debug("skipping to MFN $s"); |
$log->debug("offset $s records"); |
268 |
$from_rec = $s; |
$from_rec = $s + 1; |
269 |
} else { |
} else { |
270 |
$self->{offset} = $from_rec; |
$self->{offset} = $from_rec - 1; |
271 |
} |
} |
272 |
|
|
273 |
if ($self->{limit}) { |
if ($self->{limit}) { |
277 |
} |
} |
278 |
|
|
279 |
# store size for later |
# store size for later |
280 |
$self->{size} = ($to_rec - $from_rec) ? ($to_rec - $from_rec + 1) : 0; |
$self->{size} = $to_rec - $from_rec + 1; |
281 |
|
|
282 |
my $strict_encoding = $arg->{strict_encoding} || $self->{strict_encoding}; ## FIXME should be 1 really |
my $strict_encoding = $arg->{strict_encoding} || $self->{strict_encoding}; ## FIXME should be 1 really |
283 |
|
|
415 |
$log->logconfess("it seems that you didn't load database!") unless ($self->{pos}); |
$log->logconfess("it seems that you didn't load database!") unless ($self->{pos}); |
416 |
|
|
417 |
if ($self->{pos} == -1) { |
if ($self->{pos} == -1) { |
418 |
$self->{pos} = $self->{offset}; |
$self->{pos} = $self->{offset} + 1; |
419 |
} else { |
} else { |
420 |
$self->{pos}++; |
$self->{pos}++; |
421 |
} |
} |