SetOptions - Maple Help

Connection

 SetOptions
 set options of a Connection module

 Calling Sequence connection:-SetOptions( opts )

Parameters

 connection - Connection module opts - equation(s) of the form option=value where option is one of readonly, autocommit, or isolation

Description

 • SetOptions sets various options that affect the behavior of connection.
 • All the options that can be set with SetOptions can also be set when connection is created by a call to OpenConnection.
 • An option's current value can be obtained by calling GetOptions.
 • SetOptions does not return anything.
 • The following options can be set by using the SetOptions command.
 The readonly optional argument informs the database that it can enable optimizations associated with a read-only connection.  The effect depends on the database.  Setting readonly=true may or may not prevent the execution of updates.  By default, connections are not opened read-only.
 autocommit = true or false
 The autocommit optional argument controls if updates are automatically committed on execution.  If autocommit is true then updates are automatically committed to the database, otherwise transactions will be used and updates will need to be committed before they are reflected in the database (see Commit and Rollback for more information). By default, autocommit is false.
 The isolation optional argument determines how isolated transactions using this connection are from transactions occurring at the same time.
 - At serializable isolation, dirty reads (reading uncommitted data from parallel transactions), non-repeatable reads (reading the same row multiple times producing different results due to parallel updates), and phantom reads (WHERE conditions matching different numbers of rows due to parallel updates) are all prevented.
 The default isolation is database specific.  The isolation option can only be set at the beginning of a transaction, before any SQL statements have been executed.
 • Calling SetOptions with no arguments raises an error.

Examples

 > $\mathrm{driver}≔\mathrm{Database}\left[\mathrm{LoadDriver}\right]\left(\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left(\mathrm{url},\mathrm{name},\mathrm{pass}\right):$$\mathrm{conn}:-\mathrm{GetOptions}\left('\mathrm{readonly}','\mathrm{isolation}'\right)$
 $\left[{\mathrm{readonly}}{=}{\mathrm{false}}{,}{\mathrm{isolation}}{=}{\mathrm{committedread}}\right]$ (1)
 > $\mathrm{conn}:-\mathrm{SetOptions}\left('\mathrm{readonly}'=\mathrm{true}\right);$$\mathrm{conn}:-\mathrm{GetOptions}\left('\mathrm{readonly}','\mathrm{isolation}'\right)$
 $\left[{\mathrm{readonly}}{=}{\mathrm{true}}{,}{\mathrm{isolation}}{=}{\mathrm{committedread}}\right]$ (2)
 > $\mathrm{conn}:-\mathrm{SetOptions}\left('\mathrm{isolation}'='\mathrm{serializable}'\right);$$\mathrm{conn}:-\mathrm{GetOptions}\left('\mathrm{readonly}','\mathrm{isolation}'\right)$
 $\left[{\mathrm{readonly}}{=}{\mathrm{true}}{,}{\mathrm{isolation}}{=}{\mathrm{serializable}}\right]$ (3)
 > $\mathrm{conn}:-\mathrm{SetOptions}\left('\mathrm{isolation}'='\mathrm{committedread}','\mathrm{readonly}'=\mathrm{false}\right);$$\mathrm{conn}:-\mathrm{GetOptions}\left('\mathrm{readonly}','\mathrm{isolation}'\right)$
 $\left[{\mathrm{readonly}}{=}{\mathrm{false}}{,}{\mathrm{isolation}}{=}{\mathrm{committedread}}\right]$ (4)