PersistentTable
GetAll
retrieve rows from a PersistentTable connection
GetKeys
retrieve partial rows from a PersistentTable connection
Count
count rows in a PersistentTable connection
Calling Sequence
Parameters
Description
Thread Safety
Examples
Compatibility
GetAll(connection, cond1, cond2, ...)
GetKeys(connection, cond1, cond2, ...)
Count(connection, cond1, cond2, ...)
connection
-
PersistentTable object created with the Open command
cond1, cond2, ...
expression sequence of conditions involving the column names of connection
The GetAll command retrieves all rows from a PersistentTable object that satisfy all of the specified conditions. The result is a set of lists, one for each row. Each such list contains all values for one row.
The GetKeys command retrieves all rows from a PersistentTable object that satisfy all of the specified conditions. The result is a set of lists, one for each row. Each such list contains the primary key values for one row. This can be considerably faster than the GetAll command if there are many columns outside the primary key and many rows in the result.
The Count command counts all rows from a PersistentTable object that satisfy all of the specified conditions. The returned value is the number of such rows.
Each condition must have one of the following forms:
expr1 = expr2, expr1 <> expr2, expr1 < expr2, expr1 > expr2, expr1 <= expr2, expr1 >= expr2
where expr1 and expr2 are polynomial expressions in the column names of connection of types integer or float. These conditions are evaluated in the SQLite database engine, so Maple's standard rules for precision in floating-point arithmetic are not followed.
c = expr, c <> expr
where c is a column name of connection of type anything or boolean. Boolean columns can only be compared to the constants true and false.
If you expect a particular query to occur frequently, it can be very beneficial to add a suitable index. See the Open command for how to do that.
Persistent tables are in general thread safe as of Maple 2021; see the Thread Safety section of the PersistentTable overview page for more details and caveats.
For more information on thread safety, see index/threadsafe.
with⁡PersistentTable
Close,Count,Get,GetAll,GetKeys,Has,MaybeGet,Open,RawCommand,Set
connection≔Open⁡:memory:,style=k1::anything,k2::integer,v1::anything,v2::integer,primarykey=2
connection≔<< 4-column persistent table at :memory: >>
connectionx,3≔y2,4
connectionz,5≔y3,5
connectiona,4≔1,6
connectionb,5≔y6,7
If we omit all conditions, then all rows of the table are part of the result.
GetAll⁡connection
a,4,1,6,b,5,y6,7,x,3,y2,4,z,5,y3,5
GetKeys⁡connection
a,4,b,5,x,3,z,5
Count⁡connection
4
Here we demonstrate a simple equality condition.
GetAll⁡connection,v1=y3
z,5,y3,5
GetKeys⁡connection,v1=y3
z,5
Count⁡connection,v1=y3
1
More complicated conditions.
GetAll⁡connection,100<k2⁢v22,k1≠a
b,5,y6,7,z,5,y3,5
GetKeys⁡connection,100<k2⁢v22,k1≠a
b,5,z,5
Count⁡connection,100<k2⁢v22,k1≠a
2
Close⁡connection
The PersistentTable[GetAll], PersistentTable[GetKeys] and PersistentTable[Count] commands were introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
PersistentTable[Open]
Download Help Document