GetAll - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


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

Calling Sequence

GetAll(connection, cond1, cond2, ...)

GetKeys(connection, cond1, cond2, ...)

Count(connection, cond1, cond2, ...)

Parameters

connection

-

PersistentTable object created with the Open command

cond1, cond2, ...

-

expression sequence of conditions involving the column names of connection

Description

• 

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.

Thread Safety

• 

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.

Examples

withPersistentTable

Close&comma;Count&comma;Get&comma;GetAll&comma;GetKeys&comma;Has&comma;MaybeGet&comma;Open&comma;RawCommand&comma;Set

(1)

connectionOpen:memory:&comma;style=k1::anything&comma;k2::integer&comma;v1::anything&comma;v2::integer&comma;primarykey=2

connection<< 4-column persistent table at :memory: >>

(2)

connectionx,3y2,4

connectionx,3y2,4

(3)

connectionz,5y3,5

connectionz,5y3,5

(4)

connectiona,41,6

connectiona,41,6

(5)

connectionb,5y6,7

connectionb,5y6,7

(6)

If we omit all conditions, then all rows of the table are part of the result.

GetAllconnection

a&comma;4&comma;1&comma;6&comma;b&comma;5&comma;y6&comma;7&comma;x&comma;3&comma;y2&comma;4&comma;z&comma;5&comma;y3&comma;5

(7)

GetKeysconnection

a&comma;4&comma;b&comma;5&comma;x&comma;3&comma;z&comma;5

(8)

Countconnection

4

(9)

Here we demonstrate a simple equality condition.

GetAllconnection&comma;v1=y3

z&comma;5&comma;y3&comma;5

(10)

GetKeysconnection&comma;v1=y3

z&comma;5

(11)

Countconnection&comma;v1=y3

1

(12)

More complicated conditions.

GetAllconnection&comma;100<k2v22&comma;k1a

b&comma;5&comma;y6&comma;7&comma;z&comma;5&comma;y3&comma;5

(13)

GetKeysconnection&comma;100<k2v22&comma;k1a

b&comma;5&comma;z&comma;5

(14)

Countconnection&comma;100<k2v22&comma;k1a

2

(15)

Closeconnection

Compatibility

• 

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

PersistentTable[Open]