v2026.6.4
All Bundles
Bundle In-memory object query engine. Table stores typed records and supports filtering, aggregation (sum, average), and CSV/filesystem import. Finder provides filesystem search. Compile with -lib query.

Table

Container for semi-structured data

Example

table := Table->New("users", ["name", "age"]);
row := table->Insert();
row->Set("name", "Alice");
row->Set("age", IntRef->New(30));

results := table->Query("select * from users where age > 25");
each(i : results) {
   results->Get(i)->ToString()->PrintLine();
};

Operations

Average #

Gets the column average

method : public : Average(name:String) ~ Float

Parameters

NameTypeDescription
nameStringcolumn name

Return

TypeDescription
Floatcolumn average

Example

table := Query.Structured.Table->New("scores", ["score"]);
r1 := table->Insert(); r1->Set("score", IntRef->New(80));
r2 := table->Insert(); r2->Set("score", IntRef->New(90));
avg := table->Average("score"); # returns 85.0
"avg={$avg}"->PrintLine();

Count #

Count of rows

method : public : Count() ~ Int

Return

TypeDescription
Intnumber of rows

Delete # native

Delete row by primary key

method : public : native : Delete(pk:Int) ~ Bool

Parameters

NameTypeDescription
pkIntprimary key

Return

TypeDescription
Booltrue if successful, false otherwise

Example

table := Query.Structured.Table->New("items", ["name"]);
row := table->Insert(); row->Set("name", "Temp");
ok := table->Delete(0); # remove row with pk=0
"deleted={$ok}"->PrintLine();

Filter # native

Filters table based upon conditional criteria

method : public : native : Filter(cond:Conditional) ~ Vector<Row>

Parameters

NameTypeDescription
condConditionalconditional filter

Return

TypeDescription
Vector<Row>filtered rows

FromCsv # function

Loads a table from a CSV file

function : FromCsv(table_name:String, path:String) ~ Table

Parameters

NameTypeDescription
table_nameStringtable name
pathStringto CSV

Return

TypeDescription
Tablenew table

Example

table := Query.Structured.Table->FromCsv("orders", "orders.csv");
if(table <> Nil) {
  rs := table->Query("select * from orders where total > 100");
  rs->ToString()->PrintLine();
};

FromFilesystem # function

Loads a table from a directory file system. Columns are: name, path_name, create_date, owner, is_dir and is_readonly.

function : FromFilesystem(table_name:String, path:String) ~ Table

Parameters

NameTypeDescription
table_nameStringtable name
pathStringto directory

Return

TypeDescription
Tablenew table

Example

table := Query.Structured.Table->FromFilesystem("files", "/tmp/");
rs := table->Query("select name from files where is_dir = false");
rs->ToString()->PrintLine(); # list only files, not directories

Get # native

Get row by primary key

method : public : native : Get(pk:Int) ~ Row

Parameters

NameTypeDescription
pkIntprimary key

Return

TypeDescription
Rowrow

Example

table := Query.Structured.Table->New("items", ["name"]);
row := table->Insert(); row->Set("name", "Beta");
found := table->Get(0); # fetch row with pk=0
found->ToString()->PrintLine();

GetAll # native

Get all rows

method : public : native : GetAll() ~ Vector<Row>

Return

TypeDescription
Vector<Row>all rows

Example

table := Query.Structured.Table->New("items", ["name"]);
row := table->Insert(); row->Set("name", "Alpha");
all := table->GetAll(); # retrieve every row
each(i : all) { all->Get(i)->ToString()->PrintLine(); };

GetColumnNames #

Gets all column names

method : public : GetColumnNames() ~ String[]

Return

TypeDescription
Stringcolumn names

GetError #

Gets the last query error

method : public : GetError() ~ String

Return

TypeDescription
Stringlast query error

GetIndex # native

Get column index by name

method : public : native : GetIndex(name:String) ~ Int

Parameters

NameTypeDescription
nameStringcolumn name

Return

TypeDescription
Intcolumn name

Example

table := Query.Structured.Table->New("items", ["name", "qty"]);
idx := table->GetIndex("qty"); # returns 2 (pk=0, name=1, qty=2)
"qty column index={$idx}"->PrintLine();

GetName #

Gets the table name

method : public : GetName() ~ String

Return

TypeDescription
Stringtable name

Example

table := Query.Structured.Table->New("products", ["sku", "price"]);
table->GetName()->PrintLine(); # prints "products"

Insert # native

Inserts a new row into the table. After the row has been added its values will need to be set.

method : public : native : Insert() ~ Row

Return

TypeDescription
Rownewly inserted row

Example

table := Query.Structured.Table->New("tasks", ["title", "done"]);
row := table->Insert(); # add empty row
row->Set("title", "Write tests");
row->Set("done", Row->False());
row->ToString()->PrintLine();

New # constructor

Constructor

New(name:String, column_names:String[])

Parameters

NameTypeDescription
nameStringtable name
column_namesStringcolumn names

Query #

Query table using SQL-like syntax. Support for 'select', 'from', 'where', 'distinct', 'order by' and logical operators.

method : public : Query(statement:String) ~ Table

Parameters

NameTypeDescription
statementStringquery statement

Return

TypeDescription
Tableresult table

Example

table := Query.Structured.Table->New("emp", ["name", "dept"]);
r := table->Insert(); r->Set("name", "Carol"); r->Set("dept", "Eng");
rs := table->Query("select name from emp where dept = 'Eng'");
rs->ToString()->PrintLine();

Size #

Count of rows

method : public : Size() ~ Int

Return

TypeDescription
Intnumber of rows

Sum #

Gets the column sum

method : public : Sum(name:String) ~ Float

Parameters

NameTypeDescription
nameStringcolumn name

Return

TypeDescription
Floatcolumn sum

Example

table := Query.Structured.Table->New("sales", ["amount"]);
r1 := table->Insert(); r1->Set("amount", FloatRef->New(19.99));
r2 := table->Insert(); r2->Set("amount", FloatRef->New(5.01));
total := table->Sum("amount"); # returns 25.0
"total={$total}"->PrintLine();

ToString #

String representation of table

method : public : ToString() ~ String

Return

TypeDescription
Stringall row1 as a string

Unique #

Gets unique rows by column name

method : public : Unique(name:String) ~ Vector<Row>

Parameters

NameTypeDescription
nameStringcolumn name

Return

TypeDescription
Vector<Row>unique rows

Example

table := Query.Structured.Table->New("sales", ["region"]);
r1 := table->Insert(); r1->Set("region", "East");
r2 := table->Insert(); r2->Set("region", "East"); # duplicate
r3 := table->Insert(); r3->Set("region", "West");
unique := table->Unique("region"); # 2 rows: East, West
"unique regions: {$unique->Size()}"->PrintLine();