issue a command to the database managing a PersistentTable connection
PersistentTable object created with the Open command
string giving an SQLite command
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.
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.
store ≔ Open⁡:memory:,style=k::integer,v::anything
store≔<< 2-column persistent table at :memory: >>
These values are stored before the start of the transaction.
store5 ≔ v⁡5
store4 ≔ v⁡4
store3 ≔ v⁡3
store7 ≔ v⁡7
store5 ≔ v⁡6
Now we abort the transaction. The changes since the start of the transaction are rolled back.
The PersistentTable[RawCommand] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
Download Help Document