45 lines
1,020 B
Text
Executable file
45 lines
1,020 B
Text
Executable file
Assuming previously defined Attribute, compiled in a vector known as 'vec' and with subsequent numbers added
|
|
|
|
To create a table:
|
|
|
|
engine.createTable("table1", vec);
|
|
|
|
This creates a Relation object with the appropriate Attribute objects. It displays nothing.
|
|
|
|
To display the table:
|
|
|
|
engine.showTables(engine.getTableFromName("table1"));
|
|
|
|
This results in such output:
|
|
|
|
Display of relation--------------------------------
|
|
Relation name: table1
|
|
|
|
Attribute name: name
|
|
Elements: Fry Bender Leela Zoidberg
|
|
Attribute name: age
|
|
Elements: 22 5 22 50
|
|
|
|
With table3 having an equal domain to table1, this:
|
|
|
|
cout << engine.unionComp(engine.getTableFromName("table1"), engine.getTableFromName("table3"));
|
|
|
|
|
|
This will display:
|
|
|
|
1
|
|
|
|
To project a table's column:
|
|
|
|
engine.project((engine.getTableFromName("table1")), "name");
|
|
|
|
|
|
This will display:
|
|
|
|
-----------Initiated Query Projection---------
|
|
Column Title: name
|
|
Fry
|
|
Bender
|
|
Leela
|
|
Zoidberg
|
|
|