Database Manager
(databaseManager)
Overview
The database manager object. Available as "databaseManager.
" in scripting.
It helps working with the database, foundsets and datasets.
Returned Types
SQL_ACTION_TYPES,JSColumn,JSDataSet,JSFoundSetUpdater,JSRecordMarker,JSRecordMarkers,JSRecord,JSFoundSet,JSTable,QBSelect,QBColumn,QBCase,QBCaseWhen,QBColumn,QBColumns,QBCondition,QBColumn,QBGroupBy,QBJoin,QBJoins,QBLogicalCondition,QBLogicalCondition,QBResult,QBColumn,QBSort,QBSorts,QBTableClause,QBPart,QBParameter,QBParameters,QBFunctions,QBAggregates,QUERY_COLUMN_TYPES,JSFoundSet,JSRecord,JSTableFilter,
Properties Summarized
Type | Name | Summary |
---|---|---|
Enable/disable the foundset behaviour to keep selection to the first row always, even if updates from other clients are received that add new records before the current first record. | ||
Enable/disable the automatic prefetching of related foundsets for sibling records. | ||
Enable/disable the default null validator for non null columns, makes it possible to do the checks later on when saving, when for example autosave is disabled. |
Methods Summarized
Type | Name | Summary |
---|---|---|
Request lock(s) for a foundset, can be a normal or related foundset. | ||
Request lock(s) for a foundset, can be a normal or related foundset. | ||
Adds a filter based on a query to all the foundsets based on a table. | ||
Adds a filter based on a query to all the foundsets based on a table. | ||
Adds a filter to all the foundsets based on a table. | ||
Adds a filter to all the foundsets based on a table. | ||
Adds a filter to all the foundsets based on a table. | ||
Adds a filter to all the foundsets based on a table. | ||
void | Add tracking info used in the log table. | |
Returns true if a transaction is committed; rollback if commit fails. | ||
Returns true if a transaction is committed; rollback if commit fails. | ||
Returns true if a transaction is committed; rollback if commit fails. | ||
Creates a foundset that combines all the records of the specified one-to-many relation seen from the given parent/primary foundset. | ||
Creates a foundset that combines all the records of the specified one-to-many relation seen from the given parent/primary foundset. | ||
Converts the argument to a JSDataSet, possible use in controller. | ||
Converts the argument to a JSDataSet, possible use in controller. | ||
Converts the argument to a JSDataSet, possible use in controller. | ||
Converts the argument to a JSDataSet, possible use in controller. | ||
Converts the argument to a JSDataSet, possible use in controller. | ||
Copies all matching non empty columns (if overwrite boolean is given all columns except pk/ident, if array then all columns except pk and array names). | ||
Copies all matching non empty columns (if overwrite boolean is given all columns except pk/ident, if array then all columns except pk and array names). | ||
Copies all matching non empty columns (if overwrite boolean is given all columns except pk/ident, if array then all columns except pk and array names). | ||
Performs a query and saves the result in a datasource. | ||
Performs a query and saves the result in a datasource. | ||
Performs a query and saves the result in a datasource. | ||
Performs a query and saves the result in a datasource. | ||
Performs a sql query on the specified server, saves the the result in a datasource. | ||
Performs a sql query on the specified server, saves the the result in a datasource. | ||
Performs a sql query on the specified server, saves the the result in a datasource. | ||
Returns an empty dataset object. | ||
Returns an empty dataset object. | ||
Returns an empty dataset object. | ||
Create a QueryBuilder object for a datasource. | ||
Create a QueryBuilder object for a datasource with given table alias. | ||
Create a table filter that can be applied to all the foundsets based on a table. | ||
Create a table filter that can be applied to all the foundsets based on a table. | ||
Create a table filter that can be applied to all the foundsets based on a table. | ||
Check wether a data source exists. | ||
void | This method differences for recalculate() that it only works on a datasource rows/records that are loaded in memory. | |
void | This method differences for recalculate() that it only works on a datasource rows/records that are loaded in memory. | |
Returns true or false if autosave is enabled or disabled. | ||
Retrieves a list with names of all database servers that have property DataModelCloneFrom equal to the server name parameter. | ||
Performs a sql query with a query builder object. | ||
Performs a sql query with a query builder object. | ||
Performs a sql query on the specified server, returns the result in a dataset. | ||
Returns the datasource corresponding to the given server/table. | ||
Returns the server name from the datasource, or null if not a database datasource. | ||
Returns the table name from the datasource, or null if not a database datasource. | ||
Returns the database product name as supplied by the driver for a server. | ||
Returns an array of edited records with outstanding (unsaved) data. | ||
Returns an array of edited records with outstanding (unsaved) data. | ||
Returns an array of edited records with outstanding (unsaved) data. | ||
Returns an array of edited records with outstanding (unsaved) data for a datasource with a filter. | ||
Returns an array of records that fail after a save. | ||
Returns an array of records that fail after a save. | ||
Returns a foundset object for a specified pk base query. | ||
Returns a foundset object for a specified datasource or server and tablename. | ||
Returns a foundset object for a specified datasource or server and tablename. | ||
Returns the total number of records in a foundset. | ||
Returns a JSFoundsetUpdater object that can be used to update all or a specific number of rows in the specified foundset. | ||
Gets the next sequence for a column which has a sequence defined in its column dataprovider properties. | ||
Returns an array with all the server names used in the solution. | ||
Returns the JSTable object from which more info can be obtained (like columns). | ||
Returns the JSTable object from which more info can be obtained (like columns). | ||
Returns the JSTable object from which more info can be obtained (like columns). | ||
Returns the JSTable object from which more info can be obtained (like columns). | ||
Returns the total number of records(rows) in a table. | ||
Returns a two dimensional array object containing the table filter information currently applied to the servers tables. | ||
Returns a two dimensional array object containing the table filter information currently applied to the servers tables. | ||
Returns an array of all table names for a specified server. | ||
Returns a ViewFoundSet that was created by getViewFoundSet(name,query,register) with the registerd boolean "true". | ||
Returns a foundset object for a specified query. | ||
Returns a foundset object for a specified query. | ||
Returns an array of all view names for a specified server. | ||
Returns true if the current client has any or the specified lock(s) acquired. | ||
Returns true if the current client has any or the specified lock(s) acquired. | ||
Returns true if the argument (foundSet / record) has at least one row that was not yet saved in the database. | ||
Returns true if the argument (foundSet / record) has at least one row that was not yet saved in the database. | ||
Returns true if the specified foundset, on a specific index or in any of its records, or the specified record has changes or is new unsaved record. | ||
Returns true if the specified foundset, on a specific index or in any of its records, or the specified record has changes or is new unsaved record. | ||
Returns true if the (related)foundset exists and has records. | ||
Returns true if the (related)foundset exists and has records. | ||
Returns true if there is an transaction active for this client. | ||
Merge records from the same foundset, updates entire datamodel (via foreign type on columns) with destination record pk, deletes source record. | ||
Merge records from the same foundset, updates entire datamodel (via foreign type on columns) with destination record pk, deletes source record. | ||
void | Can be used to recalculate a specified record or all rows in the specified foundset. | |
Flushes the client data cache and requeries the data for a record (based on the record index) in a foundset or all records in the foundset. | ||
Release all current locks the client has (optionally limited to named locks). | ||
Release all current locks the client has (optionally limited to named locks). | ||
Free resources allocated for a previously created data source. | ||
Removes a previously defined table filter. | ||
void | Reverts outstanding (not saved) in memory changes from edited records. | |
void | Reverts outstanding (not saved) in memory changes from edited records. | |
void | Rollback a transaction started by databaseManager. | |
void | Rollback a transaction started by databaseManager. | |
void | Rollback a transaction started by databaseManager. | |
Saves all outstanding (unsaved) data and exits the current record. | ||
Saves all outstanding (unsaved) data and exits the current record. | ||
Saves all outstanding (unsaved) data and exits the current record. | ||
Saves all outstanding (unsaved) data and exits the current record. | ||
Set autosave, if false then no saves will happen by the ui (not including deletes!). | ||
void | Turnoff the initial form foundset record loading, set this in the solution open method. | |
Apply multiple table filters to all the foundsets that are affected by the filters. | ||
void | Start a database transaction. | |
Switches a named server to another named server with the same datamodel (recommended to be used in an onOpen method for a solution). | ||
Validates the given record, it runs first the method that is attached to the entity event "onValidate". | ||
Validates the given record, it runs first the method that is attached to the entity event "onValidate". |
Properties Detailed
alwaysFollowPkSelection
Enable/disable the foundset behaviour to keep selection to the first row always, even if updates from other clients are received that add new records before the current first record.
If set to false [default], a foundset with selection on first record will keep the selected index to 1, but may change the selected record when a new record is received from another client. If set to true, the selected index may change but the selected record will be kept if possible.
Type Boolean
Sample
disableRelatedSiblingsPrefetch
Enable/disable the automatic prefetching of related foundsets for sibling records.
For example, when orders from a record in a customer foundset are retrieved, already the orders of a few sibling records are also prefetched. By default this prefetch is enabled for SmartClient but is disabled for all serverbased clients like NGClient and HeadlessClient. Because server based client are close enough to the database that they can fetch the siblings themselfs
Type Boolean
Sample
nullColumnValidatorEnabled
Enable/disable the default null validator for non null columns, makes it possible to do the checks later on when saving, when for example autosave is disabled.
Type Boolean
Sample
Methods Detailed
acquireLock(foundset, recordIndex)
Parameters
JSFoundSet foundset The JSFoundset to get the lock for
Number recordIndex The record index which should be locked.
Returns: Boolean true if the lock could be acquired.
Sample
acquireLock(foundset, recordIndex, lockName)
Parameters
JSFoundSet foundset The JSFoundset to get the lock for
Number recordIndex The record index which should be locked.
String lockName The name of the lock.
Returns: Boolean true if the lock could be acquired.
Sample
addTableFilterParam(query)
Adds a filter based on a query to all the foundsets based on a table.
Filters on tables touched in the query will not be applied to the query filter. For example, when a table filter exists on the order_details table, a query filter with a join from orders to order_details will be applied to queries on the orders table, but the filter condition on the orders_details table will not be included.
returns true if the table filter could be applied.
Parameters
QBSelect query condition to filter on.
Returns: Boolean true if the table filter could be applied.
Sample
addTableFilterParam(query, filterName)
Adds a filter based on a query to all the foundsets based on a table.
Filters on tables touched in the query will not be applied to the query filter. For example, when a table filter exists on the order_details table, a query filter with a join from orders to order_details will be applied to queries on the orders table, but the filter condition on the orders_details table will not be included.
returns true if the table filter could be applied.
Parameters
QBSelect query condition to filter on.
String filterName The specified name of the database table filter.
Returns: Boolean true if the table filter could be applied.
Sample
addTableFilterParam(datasource, dataprovider, operator, value)
Adds a filter to all the foundsets based on a table. Note: if null is provided as the tablename the filter will be applied on all tables with the dataprovider name. A dataprovider can have multiple filters defined, they will all be applied. returns true if the table filter could be applied.
Parameters
String datasource The datasource
String dataprovider A specified dataprovider column name.
String operator One of "=, <, >, >=, <=, !=, LIKE, or IN" optionally augmented with modifiers "#" (ignore case) or "^||" (or-is-null), prefix with "sql:" to allow the value to be interpreted as a custom query.
Object value The specified filter value.
Returns: Boolean true if the table filter could be applied.
Sample