Performs a database delete and returns the number of deleted records.
Sql delete statement
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
number of deleted records.
Execute a sql to get a single value as a certain type.
Sql statement to perform
Values to use in case the statement contains parameters
Default value to return if the sql statement did not have any results
result from sql statement or aDefault
Execute a sql to get a single value as a certain type. If no value can be found, the method will throw an error.
Sql statement to perform
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
result from sql statement
if no row (and thus field) can be found
Generates a unique code with UFText.generateCode to be used in some table.
Table to use unique code with
Name of column in table that contains the unique code
Number of characters the code should exist of
an unique code
Performs an insert and returns the id of the created record.
Sql insert statement
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
id of created record or 0 if there is no id.
Inserts a data from an object. The method creates an insert into statement using the property names inside the object.
The aData structure can contain a primary key property, when building the sql statement it will be skipped. After the insert statement the generated id (if any) will be assigned to the primary key field.
Name of table
Data to insert (should be some form of object)
Optional
aPrimaryKey: stringName of primary key field
Optional
anIgnoreFields: string[]Fields to ignore in aData
Either aData if there is no primary key or a new object with values copied from aData with the new primary key value.
Execute a sql to get a row as a certain type.
Sql statement to perform
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
result from sql statement; undefined when no row could be found
Execute a sql to get a row as a certain type. If no row can be found, the method will throw an error.
Sql statement to perform
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
result from sql statement
error if no row can be found
Execute a sql to get multiple rows as a certain type.
Sql statement to perform
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
result from sql statement
Execute a function within a transaction.
A function that will be called with await. It will be called with a single parameter, which can be used to communicate with the database. The parameter might be a different instance then the instance the transaction call originated from.
any exception that occurred while calling aCallback
Performs an update and returns the number of changed records.
Sql update statement
Optional
aParameterValues: UFDynamicObjectValues to use in case the statement contains parameters
number of changed records.
Updates a record in a table assuming it has a single primary key column.
Name of table
Primary key vale
Object containing field names and their new values.
Optional
aPrimaryKey: stringName of primary key
Optional
anIgnoreFields: string[]Fields to ignore in aData
IUFDatabase defines the methods a database will implement.