Bearbeiten

Teilen über


Database Data type

Version: Available or changed with runtime version 1.0.

Provides access to common database functionality.

Static methods

The following methods are available on the Database data type.

Method name Description
AlterKey(KeyRef, Boolean) Alter a table's key in SQL, either disabling or enabling it. Any alteration only pertains to the current transaction and will be reverted at the end of the current transaction. Any alteration will fail if it's called on System or non-SQL based tables. Disabling clustered or unique keys is also not supported and will fail at runtime.
ChangeUserPassword(Text, Text) Changes the password for the current user.
CheckLicenseFile(Integer) Checks a key in the license file of the system.
Commit() Ends the current write transaction.
CompanyName() Gets the current company name.
CopyCompany(Text, Text) Creates a new company and copies all data from an existing company in the same database.
CurrentTransactionType([TransactionType]) Gets the current transaction type and sets a new type to be assigned.
DataFileInformation(Boolean, var Text, var Text, var Boolean, var Boolean, var Boolean, var Text, var DateTime, var Record) Specifies data from a file that has been exported from a database.
ExportData(Boolean, var Text [, Text] [, Boolean] [, Boolean] [, Boolean] [, Record]) Exports data from the database to a file. The data is not deleted from the database.
GetDefaultTableConnection(TableConnectionType) Gets the default table connection based on the specified connection type. You must already have registered a table connection of this type.
HasTableConnection(TableConnectionType, Text) Verifies if a connection to an external database exists based on the specified name.
ImportData(Boolean, var Text [, Boolean] [, Boolean] [, Record]) Imports data from a file that has been exported from a database.
IsInWriteTransaction() Checks whether or not you are in a write transaction.
LastUsedRowVersion() Gets the last used RowVersion from the database.
LockTimeout([Boolean]) Determines whether the lock time-out setting is set to On. You can also use this method to override the default setting.
MinimumActiveRowVersion() Returns the lowest active RowVersion in the database. This is the lowest RowVersion for an uncomitted row, meaning rows with a lower timestamp than this value are guaranteed to be comitted. If there are no active transactions, this value is equal to LastUsedRowVersion + 1.
RegisterTableConnection(TableConnectionType, Text, Text) Registers a table connection to an external database.
SelectLatestVersion() Forces the latest version of the database to be used.
SelectLatestVersion(Integer) Ensures that the table's latest version is used, ignoring any cached values older than the method's call time.
SerialNumber() Gets a string that contains the serial number of the license file for your system.
ServiceInstanceId() Gets the ID of the service instance.
SessionId() Gets the ID of the current session.
SetDefaultTableConnection(TableConnectionType, Text [, Boolean]) Establishes a connection to an external database based on a previously registered connection of the specified type.
SetUserPassword(Guid, Text) Sets a password for the user iwith the given user security ID. If the given password is blank, an empty string will be stored instead of a password hash. This will prevent the user from logging in using a password. Only SUPER can call this method. Passwords cannot be set for the empty GUID or for the default Super ID.
SID([Text]) Retrieves the security identifier (SID) of a Windows user account.
TenantId() Gets the ID of the tenant that has started the current session. Use this method when your code must be specific about which tenant database to access in a multitenant deployment. For example, if your code imports data into a cache, you can make a cache tenant-specific by using the tenant ID as a key. Also, if you want to write code that saves documents, you can include the tenant ID in the file name or location, for example. In those cases, you can use the TENANTID method in combination with the COMPANYNAME method to identify the company and the tenant database.
UnregisterTableConnection(TableConnectionType, Text) Unregisters a table connection to an external database.
UserId() Gets the user name of the user account that is logged on to the current session.
UserSecurityId() Gets the unique identifier of the user that is logged on to the current session.

Get Started with AL
Developing Extensions