TransactionBase (open)
A lowlevel transaction can be used for full low-level access to a database. Primarily used for transparent access to other databases.
Syntax
LOADLIB "wh::dbase/transaction.whlib";
OBJECTTYPE TransactionBase
Variables
- BOOLEAN throwoncommiterror (inherited from BuiltinTransactionBase)
Throw if errors are returned on a commit / commitwork
Properties
- PROPERTY id (inherited from BuiltinTransactionBase)
Transaction id for this transaction (may be 0)
- PROPERTY type (inherited from BuiltinTransactionBase)
Type of this transaction (STRING, for example 'postgresql', 'ldap', 'wrd')
Functions
- MACRO AlterTable(STRING schemaname, STRING tablename, RECORD tablestructure) (inherited from BuiltinTransactionBase)
- BOOLEAN FUNCTION AnyCommitHandlers() (inherited from BuiltinTransactionBase)
Does this transction have any commit handlers/actions ?
- MACRO BeginLockedWork(STRING mutexname) (inherited from BuiltinTransactionBase)
Starts work with a locked mytex
- MACRO BeginWork(RECORD options) (inherited from BuiltinTransactionBase)
Begins work
- MACRO BroadcastOnCommit(STRING eventname, RECORD eventdata) (inherited from BuiltinTransactionBase)
Register a commit event, which is broadcasted if the transaction succesfully commits
- MACRO Close() (inherited from BuiltinTransactionBase)
Closes the entire transaction
- BOOLEAN FUNCTION ColumnExists(STRING schemaname, STRING tablename, STRING columnname) (inherited from BuiltinTransactionBase)
Returns whether a specific column in a table exists
- RECORD ARRAY FUNCTION Commit() (inherited from BuiltinTransactionBase)
Commits and closes the entire transaction
- RECORD ARRAY FUNCTION CommitWork() (inherited from BuiltinTransactionBase)
Commits work
- MACRO CreateSchema(STRING schemaname, STRING ownerschema, STRING ownerrole) (inherited from BuiltinTransactionBase)
- MACRO CreateTable(STRING schemaname, STRING tablename, RECORD tablestructure) (inherited from BuiltinTransactionBase)
- MACRO DisableWorkTimeout() (inherited from BuiltinTransactionBase)
Disables timeouts for the current work
- MACRO DropColumn(STRING schemaname, STRING tablename, STRING columnname) (inherited from BuiltinTransactionBase)
Drop a column from the database schema
- MACRO DropSchema(STRING schemaname, RECORD options) (inherited from BuiltinTransactionBase)
- MACRO DropTable(STRING schemaname, STRING tablename) (inherited from BuiltinTransactionBase)
Drop a table from the database schema
- VARIANT FUNCTION ExecuteInLockedWork(STRING mutexname, MACRO PTR todo) (inherited from BuiltinTransactionBase)
Execute code inside work, with a locked mutex. Note: does not support asynchronous functions.
- VARIANT FUNCTION ExecuteInWork(MACRO PTR todo) (inherited from BuiltinTransactionBase)
Execute code inside work. Note: does not support asynchronous functions.
- RECORD ARRAY FUNCTION GetColumnListing(STRING schemaname, STRING tablename) (inherited from BuiltinTransactionBase)
Returns the list of columns in a table
- OBJECT FUNCTION GetFinishHandler(STRING tag) (inherited from BuiltinTransactionBase)
Returns a commit handler object
- RECORD ARRAY FUNCTION GetSchemaListing() (inherited from BuiltinTransactionBase)
Returns a list of all schemas
- RECORD ARRAY FUNCTION GetTableListing(STRING schemaname) (inherited from BuiltinTransactionBase)
Returns a list of all tables in a schema
- BOOLEAN FUNCTION HasMutex(STRING mutexname) (inherited from BuiltinTransactionBase)
Returns whether a specific mutex has been locked via this transaction
- BOOLEAN FUNCTION HasWorkSupport() (inherited from BuiltinTransactionBase)
Returns whether this transaction has support for opening work
- BOOLEAN FUNCTION IndexExists(STRING schemaname, STRING tablename, STRING indexname) (inherited from BuiltinTransactionBase)
Returns whether a specific index exists for table
- MACRO InsertRecord(RECORD query, RECORD newfields)
Inserts a new record in the database
- BOOLEAN FUNCTION IsNestedWorkOpen() (inherited from BuiltinTransactionBase)
Returns TRUE when there is nested work open
- BOOLEAN FUNCTION IsWorkOpen() (inherited from BuiltinTransactionBase)
Return whether work is open
- INTEGER FUNCTION MakeAutonumber(STRING schemaname, STRING tablename, STRING columnname) (inherited from BuiltinTransactionBase)
Returns an autonumber for a column in the specified table
- INTEGER64 FUNCTION MakeAutoNumber64(STRING schemaname, STRING tablename, STRING columnname) (inherited from BuiltinTransactionBase)
Returns a 64-bit autonumber for a column in the specified table
- INTEGER ARRAY FUNCTION MakeAutoNumbers(STRING schemaname, STRING tablename, STRING columnname, INTEGER amount) (inherited from BuiltinTransactionBase)
Returns a list of autonumbers for a column in the specified table
- INTEGER64 ARRAY FUNCTION MakeAutoNumbers64(STRING schemaname, STRING tablename, STRING columnname, INTEGER amount) (inherited from BuiltinTransactionBase)
Returns an list of 64-bit autonumbers for a column in the specified table
- OBJECT FUNCTION OpenCursor(RECORD query, STRING type)
Opens a new cursor
- RECORD ARRAY FUNCTION PopWork() (inherited from BuiltinTransactionBase)
Pops work; if no pushed work is left, the work is committed and returned
- OBJECT FUNCTION PrepareAlterTable(STRING schemaname, STRING tablename) (inherited from BuiltinTransactionBase)
Get a helper object to alter table structures
- OBJECT FUNCTION PrepareCreateTable(STRING schemaname, STRING tablename) (inherited from BuiltinTransactionBase)
Get a helper object to create a table
- MACRO PushWork() (inherited from BuiltinTransactionBase)
Pushes a new work; if no work has been opened, it will be opened.
- MACRO RegisterCommitHandler(STRING coalesce_tag, FUNCTION PTR handler) (inherited from BuiltinTransactionBase)
Registers a commit handler, which is called when the transaction commits or rolls back
- RECORD FUNCTION RenumberForeignKey(STRING schemaname, STRING tablename, INTEGER renumberfrom, INTEGER renumberto, RECORD options) (inherited from BuiltinTransactionBase)
Renumbers all references (foreign keys) pointing to a specific id
- MACRO Rollback() (inherited from BuiltinTransactionBase)
Rollbacks and closes the entire transaction
- MACRO RollbackWork() (inherited from BuiltinTransactionBase)
Rollbacks work
- BOOLEAN FUNCTION SchemaExists(STRING schemaname) (inherited from BuiltinTransactionBase)
Returns whether a specific schema exists
- MACRO SetFinishHandler(STRING tag, OBJECT obj) (inherited from BuiltinTransactionBase)
Sets a commit handler object, throws if it already exists
- BOOLEAN FUNCTION TryLockMutex(STRING mutexname, DATETIME wait_until) (inherited from BuiltinTransactionBase)
Try to lock an additional mutex when we already have work open. If succesful, this lock will be released at commit/rollback