-
Notifications
You must be signed in to change notification settings - Fork 0
Method read_all
marufcetin edited this page Sep 1, 2026
·
1 revision
Turkce Dokumantasyon | English Documentation
Category: Core CRUD Methods
Submodule:AmberDB
Entry Type: Table Scanning & Pagination
read_all() scans, sorts, paginates, and retrieves records from a table. It leverages the 8-byte packed primary index (.inx) and pre-sorted indexes (.srt) for high-speed sub-millisecond pagination and supports keys_only scalar extraction pipelines.
# 1. Unpaginated
my @records = $adb->read_all($table_id, [$start], [$limit], [%options]);
# 2. Paginated (when limit > 0)
my ($total_count, @records) = $adb->read_all($table_id, $start, $limit, [%options]);Important
Paginated vs Unpaginated Context:
-
Paginated (
$limit > 0): Returns($total_count, @page_records)where the first scalar is the total matching count integer. -
Unpaginated (
$limitomitted or 0): Returns@recordsarrayrefs directly. Unpacking a paginated call intomy @recordscauses$records[0]to be an integer count scalar, which will crash if dereferenced as an array reference.
| Option | Type | Default | Description |
|---|---|---|---|
start |
Integer | 0 |
0-based pagination offset index. |
limit |
Integer | 0 |
Maximum number of records to return (0 for all). |
sort |
Int/Hash | undef |
Block index to sort by. Positive for descending, negative for ascending (e.g. sort => -2). Or hash: { blk => 2, reverse => 1 }. |
keys_only |
Boolean | 0 |
If 1, skips record loading and returns only matching Record IDs. |
jnktype |
String | 'AB' |
Tier filter mode: 'A' (Active only), 'B' (Junk only), 'AB' (Active first, then Junk). |
no_index |
Boolean | 0 |
Forces sequential .db scan bypassing .inx. |
# 1. Fetch all records (unpaginated)
my @all_products = $adb->read_all("catalog_product");
# 2. Fetch page 1 (20 items) sorted by Price (Block 3) ascending
my ($total, @page) = $adb->read_all("catalog_product", 0, 20, sort => -3);
print "Total Count: $total, Items on Page: " . scalar(@page) . "\n";
# 3. Memory-efficient scalar ID pipeline (keys_only)
my ($count, @product_ids) = $adb->read_all("catalog_product", 0, 50, keys_only => 1);AmberDB — High-Performance Schema-Driven NoSQL Database Engine for Perl.
Copyright 2005-2026 Maruf Cetin. Released under the Artistic License 2.0.
CPAN · GitHub Repository · Issue Tracker
- Berkeley DB (DB_File) Engine
- AmberDB Table Schema
- Global Flags
- Table Schema Flags
- Directory Structure
- File Structure (Extensions)
- Repeat Blocks
- Auto-Increment ID
- ASCII ID
- Relational Records
- Record Anatomy
- JOIN-Free Architecture
- Packed Binary Index
- Strict 2PL Locking
- Undo Journal & Rollback
- Tiered Junk Indexing
- Disjunctive Faceting
- Phonetic Accent Search
- 2-Pillar Disaster Recovery
- RAM-Disk Acceleration
- In-Memory Schema Mutation
- Simple Mode
- new
- config
- set_datadir
- insert_id
- insert_list
- modify_id
- modify_list
- delete_id
- delete_list
- read_id
- read_all
- read_list
- exist_id
- exist_list
- exist_table
- table_count
- table_keys
- table_lastid
- table_attr
- table_create
- field_fetch
- field_filter
- search_table
- facet_menu
- field_fltkeys
- field_allfltkeys
- facet_rules
- slug_read
- slug_fetch
- transact_start
- transact_end
- transact_commit
- transact_rollback
- transact_recover
- flock_open
- flock_close
- cache_setup
- cache_read
- cache_write
- cache_delete
- cache_preload
- cache_ensure
- buffer_write
- buffer_read
- buffer_delete
- recs_scan
- recs_get
- recs_put
- recs_del
- locale_uc
- locale_lc
- locale_sort
- locale_to_ascii
- locale_num2text
- locale_format_currency
- locale_format_date
- array_sort
- array_punch
- array_filter
- array_sublist
- deep_copy
- log_owner
- use_counter
- use_junk
- keep_deleted
- auto_id
- buffer_write
- simple
- no_write
- no_backup
- jnktype
- keys_only
- id_type
- language
- .db · .table · .dbase
- .inx · .fld · .src
- .fac · .srt · .slg
- .unq · .del · .aut
- .cnt · .txn · .amberdb
- .csv · .cache · .tmp