mini\Table\InMemoryTable
class
Documentation
SQLite-backed in-memory table implementation
Intended as a ground-truth oracle for testing - all operations are translated to SQL and executed by SQLite, which provides well-defined semantics for filtering, sorting, and set operations.
$table = new InMemoryTable(
new ColumnDef('id', ColumnType::Int, IndexType::Primary),
new ColumnDef('name', ColumnType::Text, IndexType::Index),
new ColumnDef('age', ColumnType::Int),
);
$table->insert(['id' => 1, 'name' => 'Alice', 'age' => 30]);
$table->insert(['id' => 2, 'name' => 'Bob', 'age' => 25]);
foreach ($table->gt('age', 20)->order('name ASC') as $id => $row) {
echo "$row->name is $row->age\n";
}
Inheritance
Extends: mini\Table\AbstractTable
Implements:
mini\Table\Contracts\TableInterface
Traversable
Countable
IteratorAggregate
mini\Table\Contracts\SetInterface
mini\Table\Contracts\MutableTableInterface
Properties (9)
SQLite3 $db
string $tableName
array $where
array $orGroups
OR groups - when non-empty, WHERE becomes: (group1) OR (group2) OR ...
array $orderBy
int $paramCounter
Closure $compareFn
int $limit
int $offset
Methods (53)
Create a new in-memory table with the given schema
Share database connection on clone (filters are query-level state)
Quote a SQLite identifier (column/table name).
Create the SQLite table with proper schema
Documentation missing
Coerce a value based on column type
Coerce a filter value based on column type
Documentation missing
Documentation missing
Validate that a query is derived from this table
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Create SQL UNION of two InMemoryTable queries on same DB
Renumber parameter names in condition groups to avoid collision
Create SQL EXCEPT (NOT IN) of two InMemoryTable queries on same DB
Extract filter conditions from a Predicate
Build IN condition from SetInterface
Build WHERE clause and parameter bindings
Build a group of AND conditions
Build ORDER BY clause
Build LIMIT/OFFSET clause
Documentation missing
Format Decimal column values from scaled integer to decimal string
Documentation missing
Documentation missing
public
getRowKeyColumns()
inherited from Table\AbstractTable
Get column name(s) that the row key represents
protected
getCompareFn()
inherited from Table\AbstractTable
Get the string comparison function for sorting
public
limit()
inherited from Table\AbstractTable
Documentation missing
public
offset()
inherited from Table\AbstractTable
Documentation missing
public
getLimit()
inherited from Table\AbstractTable
Documentation missing
public
getOffset()
inherited from Table\AbstractTable
Documentation missing
public
withAlias()
inherited from Table\AbstractTable
Documentation missing
public
getTableAlias()
inherited from Table\AbstractTable
Get the current table alias (null if not set)
public
distinct()
inherited from Table\AbstractTable
Documentation missing
public
exists()
inherited from Table\AbstractTable
Documentation missing
public
has()
inherited from Table\AbstractTable
Check if value(s) exist in the table's projected columns
protected
getPrimaryKeyColumn()
inherited from Table\AbstractTable
Get the primary key column definition (cached)
public
final
getIterator()
inherited from Table\AbstractTable
Iterate over rows with visible columns only
public
getColumns()
inherited from Table\AbstractTable
Get columns available for output
public
getAllColumns()
inherited from Table\AbstractTable
Get all column definitions regardless of projection
public
columns()
inherited from Table\AbstractTable
Narrow to specific columns
public
getProperty()
inherited from Table\AbstractTable
Get a property value
public
hasProperty()
inherited from Table\AbstractTable
Check if a property exists (including null values)
public
withProperty()
inherited from Table\AbstractTable
Return table with property set