tiny.sql.RowIdTable
Defined in table.
API (18)
Actions
Public operations.
countdeletedeleteIngetgetIntolastRowIdopenputputEncodedputEncodedInputInreaderscan: Starts a scan of the rows fromstartup toendintarget.scanProjectedsummarizesummarizeInvalueLength
Fields and members
Public fields and members.
Source
Source: lib/sql/src/table.zig:267
zig
pub const Table = struct { rows: tree.Tree, pub fn open(database: *file.Database, options: Options) Error!Table { return .{ .rows = try tree.Tree.open(database, options.tree) }; } pub fn reader(self: *const Table, snapshot: file.Snapshot) Error!Reader { return .{ .rows = try self.rows.reader(snapshot) }; } pub fn lastRowId(self: *const Table) Error!?i64 { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); return try opened.lastRowId(); } pub fn put(self: *Table, rowid: i64, values: []const row.Value, options: file.CommitOptions) Error!file.Commit { const phase = trace.scope("table.put"); defer phase.end(); var write = try tree.Write.beginTree(&self.rows); defer write.deinit(); try self.putIn(&write, rowid, values); return try write.commit(options); } pub fn putIn(self: *Table, write: *tree.Write, rowid: i64, values: []const row.Value) Error!void { var key_bytes: [key.rowid_size]u8 = undefined; var row_bytes: [page.size]u8 = undefined; const encoded_key = try key.encodeRowId(&key_bytes, rowid); const encoded_row = try row.encode(&row_bytes, values); try write.put(&self.rows, encoded_key, encoded_row); } pub fn putEncoded(self: *Table, rowid: i64, bytes: []const u8, options: file.CommitOptions) Error!file.Commit { const phase = trace.scope("table.put_encoded"); defer phase.end(); var write = try tree.Write.beginTree(&self.rows); defer write.deinit(); try self.putEncodedIn(&write, rowid, bytes); return try write.commit(options); } pub fn putEncodedIn(self: *Table, write: *tree.Write, rowid: i64, bytes: []const u8) Error!void { _ = try row.View.init(bytes); var key_bytes: [key.rowid_size]u8 = undefined; try write.put(&self.rows, try key.encodeRowId(&key_bytes, rowid), bytes); } pub fn get(self: *const Table, allocator: Allocator, rowid: i64) Error!?[]u8 { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); return try opened.get(allocator, rowid); } pub fn valueLength(self: *const Table, rowid: i64) Error!?usize { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); return try opened.valueLength(rowid); } pub fn getInto(self: *const Table, rowid: i64, target: []u8) Error!?[]u8 { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); return try opened.getInto(rowid, target); } pub fn delete(self: *Table, rowid: i64, options: file.CommitOptions) Error!file.Commit { const phase = trace.scope("table.delete"); defer phase.end(); var write = try tree.Write.beginTree(&self.rows); defer write.deinit(); try self.deleteIn(&write, rowid); return try write.commit(options); } pub fn deleteIn(self: *Table, write: *tree.Write, rowid: i64) Error!void { var key_bytes: [key.rowid_size]u8 = undefined; try write.delete(&self.rows, try key.encodeRowId(&key_bytes, rowid)); } /// Starts a scan of the rows from `start` up to `end` in `target`. pub fn scan( self: *const Table, target: *Scan, allocator: Allocator, start: ?i64, end: ?i64, ) Error!void { try self.scanProjected(target, allocator, start, end, .value); } pub fn scanProjected( self: *const Table, target: *Scan, allocator: Allocator, start: ?i64, end: ?i64, projection: Projection, ) Error!void { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); try opened.scanProjected(target, allocator, start, end, projection); } pub fn summarize(self: *const Table) Error!tree.Summary { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); return try opened.summarize(); } pub fn count(self: *const Table) Error!usize { var read = try self.rows.database.beginRead(); defer read.deinit(); const opened = try self.reader(read.snapshot()); return try opened.count(); } pub fn summarizeIn(self: *const Table, write: *const tree.Write) Error!tree.Summary { const phase = trace.scope("table.summarize_in"); defer phase.end(); return try self.rows.summarizeIn(write); }};Source: lib/sql/src/root.zig:224
zig
pub const RowIdTable = table.Table;Complete caller list for RowIdTable.open
8 direct callers.
tiny.sql.Catalog.open[function] atlib/sql/src/catalog.zig:707tiny.sql.Space.rowidTable[method] atlib/sql/src/space.zig:181lib.sql.src.table.test_rowid_table_deletes_and_recovers_after_reopen[function] — test source atlib/sql/src/table.zig:737in nearest public ownertiny.sql.tablelib.sql.src.table.test_rowid_table_key_projection_avoids_overflow_materialization[function] — test source atlib/sql/src/table.zig:660in nearest public ownertiny.sql.tablelib.sql.src.table.test_rowid_table_reports_the_last_assigned_rowid[function] — test source atlib/sql/src/table.zig:713in nearest public ownertiny.sql.tablelib.sql.src.table.test_rowid_table_stores_typed_rows_and_scans_in_rowid_order[function] — test source atlib/sql/src/table.zig:626in nearest public ownertiny.sql.tablelib.sql.src.table.test_table_value_storage_is_sealed_before_inline_overflow_and_rejection_reads[function] — test source atlib/sql/src/table.zig:519in nearest public ownertiny.sql.tablelib.sql.src.table.test_table_value_storage_preserves_typed_row_semantics[function] — test source atlib/sql/src/table.zig:587in nearest public ownertiny.sql.table
Complete caller list for RowIdTable.reader
7 direct callers.
tiny.sql.RowIdTable.count[method] atlib/sql/src/table.zig:387tiny.sql.RowIdTable.get[method] atlib/sql/src/table.zig:319tiny.sql.RowIdTable.getInto[method] atlib/sql/src/table.zig:333tiny.sql.RowIdTable.lastRowId[method] atlib/sql/src/table.zig:278tiny.sql.RowIdTable.scanProjected[method] atlib/sql/src/table.zig:366tiny.sql.RowIdTable.summarize[method] atlib/sql/src/table.zig:380tiny.sql.RowIdTable.valueLength[method] atlib/sql/src/table.zig:326
Audit
| Definitions | 18 |
|---|---|
| Public names | 36 |
| Members | 1 |
| Version | 26.7.0 |
| Revision | daab053ee433 |