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

Online Help

All Products    Maple    MapleSim


PersistentTable

  

RawCommand

  

issue a command to the database managing a PersistentTable connection

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Compatibility

Calling Sequence

RawCommand(connection, command)

Parameters

connection

-

PersistentTable object created with the Open command

command

-

string giving an SQLite command

Description

• 

The RawCommand command issues a command to the database managing a PersistentTable connection. This calls the Database[SQLite][Execute] command and returns what it returns.

• 

The internal layout of PersistentTable tables is not documented, and not guaranteed to remain the same in future Maple releases. We do not recommended that you rely on this layout with your code.

• 

The RawCommand command can be used to manage database transactions, issuing the command RawCommand("BEGIN TRANSACTION") to start a transaction and RawCommand("COMMIT TRANSACTION") to commit it or RawCommand("ROLLBACK TRANSACTION") to roll it back. In a PersistentTable (or any SQLite database), by default, each change to the database is a separate transaction. If you make many changes to a SQLite database, you generally get much better performance if you put them in a single transaction rather than in many individual transactions. Moreover, if you are able to group logically connected changes together in a transaction, then if something goes wrong (such as a power failure, or if your Maple session crashes, for example), the connected changes will either all be written to the database, or none of them will. This can help ensure that the database is in a consistent state upon restart.

• 

For more information about SQLite commands, see the SQLite language documentation.

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,Count,Get,GetAll,GetKeys,Has,MaybeGet,Open,RawCommand,Set

(1)

storeOpen:memory:,style=k::integer,v::anything

store<< 2-column persistent table at :memory: >>

(2)

These values are stored before the start of the transaction.

store5v5

store5v5

(3)

store4v4

store4v4

(4)

GetAllstore

4&comma;v4&comma;5&comma;v5

(5)

RawCommandstore&comma;BEGIN TRANSACTION

store3v3

store3v3

(6)

store7v7

store7v7

(7)

store5v6

store5v6

(8)

GetAllstore

3&comma;v3&comma;4&comma;v4&comma;5&comma;v6&comma;7&comma;v7

(9)

Now we abort the transaction. The changes since the start of the transaction are rolled back.

RawCommandstore&comma;ROLLBACK TRANSACTION

GetAllstore

4&comma;v4&comma;5&comma;v5

(10)

Closestore

Compatibility

• 

The PersistentTable[RawCommand] command was introduced in Maple 2021.

• 

For more information on Maple 2021 changes, see Updates in Maple 2021.

See Also

PersistentTable

PersistentTable[Open]