f2s_isolation_level¶

Applies to: MS SQL, MySql/MariaDB

Syntax

**There is no get_attribute.  This attribute is write only.**
set_attribute f2s_isolation_level of {DriverID} to {variable}

Parameter

Description

DriverId

The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverID.

variable

Integer Constant. The value can be one of the following: f2s_read_committed, f2s_read_uncommitted, f2s_repeatable_read, f2s_serializable, f2s_snapshot, and f2s_default_isolation. See Description for a definition of each of these values.

Description

Setting this attribute sets the locking and row versioning behavior for SQL statements. See the options below for information on the various effects they can have on transactions.

f2s_default_isolation - The default isolation level for the server (f2s_read_committed for MSSQL).

f2s_read_committed - This option is used to prevent dirty reads. A dirty read is when one transaction reads data from another transaction that has yet to be committed. If one transaction fails, the other now is dealing with invalid data. By setting the isolation level to f2s_read_committed, dirty reads will be avoided by not allowing transactions to deal with any other data that has not been committed yet. However, in between statements within the current transaction, data can be changed by other transactions. This can result in phantom data or non-repeatable reads. Note that this can slow down performance speeds but is usually good practice.

f2s_read_uncommitted - This option is the least restrictive isolation level. With this option, dirty reads are allowed, thus no exclusive locks are honored and modified data from one uncommitted transaction can be read by other transactions.

f2s_snapshot - With this option, all queries within a transaction see the version of the database based on when the transaction begins. No locks are placed on the data and

f2s_repeatable_read - This option is similar to the f2s_read_committed option in that locks all placed on all transactions and uncommitted data from other transactions cannot be read, preventing dirty reads. However, unlike f2s_read_committed, new rows that are added by other transactions can be read by the current transaction if it is retried, possibly resulting in phantom reads. This option should not be used unless there is a specific reason to do so.

f2s_serializable - This option is the most restrictive isolation level. With this option, no interaction is allowed between transactions until they have been committed. Similar to f2s_read_committed, no transaction can deal with any uncommitted data. On top of that though, range locks are placed on all rows being modified until the current transaction is complete. Because concurrency is so low with this option, performance speeds can be much lower and so this should only be used when there is a specific reason to do so.

Examples

set_attribute

f2s_activate_driver "f2s_ms"
Login "localhost\SQLEXPRESS" "" "" _f2s_ActiveDriver
Set_Attribute f2s_isolation_level of _f2s_ActiveDriverId to f2s_read_uncommitted

Replaces: Command SET_ISOLATION_LEVEL