Class: Constructor

Constructor

new Constructor(params, object)

Parameters:
Name Type Description
params object Object serving as an associative array; optional, in form { table: SeLiteData.Table instance alias: string, alias for this table, used in SQL, optional.
object prototype Instance of SeLiteData.RecordSetFormula which serves as the prototype for the new object. Optional. Any fields not set in params will be inherited from prototype (if present), as they are at the time of calling this constructor. Any fields set in params will override respective fields in prototype (if any), except for field(s) present in params and set to null - then values will be copied from prototype, (if present).
Source:
To Do:
  • Check this old documentation - not applicable anymore: object, optional, in form { table-name: columns-alias-info } where each columns-alias-info is of mixed-type: - string column alias prefix (it will be prepended in front of all column names); or - SeLiteData.RecordSetFormula.ALL_FIELDS (all fields listed in the table object will be selected, unaliased); or - an alias map object listing all columns that are to be selected, mapped to string alias, or mapped to true/1 if not aliased; or - an array, listing one or more of the following --- all unaliased columns ---- optional object(s) which is an alias map {string colum name: string alias}; such a map must map to string alias (it must not map to true/1) --- optional SeLiteData.RecordSetFormula.ALL_FIELDS indicating usage of all columns under their names (unaliased), unless any map object(s) map them Each alias must be unique; that will be checked by SeLiteData.RecordSetFormula constructor (--@TODO). The column list must list the primary key of the main table, and it must not be aliased. Their values must exist - i.e. you can't have a join that selects records from join table(s) for which there is no record in the main table. That's because RecordSetHolder.originals{} are indexed by it. columns: Object serving as an associative array { string tableName: mixed, either - SeLiteData.RecordSetFormula.ALL_FIELDS, or - an array of either - string columnName, or - object serving as a map, with exactly one entry { string columnName: string alias} or - an anonymous object { string columnName: string alias; or string columnName: true - to mark that the column should be retrieved - used when you need an alias for other column(s) } } joins: Similar to but not exact as the same field passed to SeLiteData.Storage.getRecords(). Array [ of objects { table: table object; alias: string table alias, optional; type: string type 'INNER LEFT' etc.; optional on: string join condition } ] fetchCondition: String SQL condition, fetchMatching parameterNames sort sortDirection indexBy - either a field name (string), or an array of them. If it's a single field name, it will be converted into an array (containing that single field name). Optional; if not set and the table has a single-column primary key then it's set to that key; otherwise there's no indexing. indexUnique process debugQuery debugResult generateInsertKey: boolean, like parameter generateInsertKey of SeLiteData.Db(). Optional; if present, then it overrides table.generateInsertKey (whether it's set here to true or false, regardless of whether table.generateInsertKey is true or false).If not set, then it's copied from prototype.generateInsertKey (if defined), or from this.table.generateInsertKey. onInsert: value to fill in on insert, or function to call to get such a value onUpdate: value to fill in on update, or function to call to get such a value }
  • putCondition, putMatching
  • Consider making some of parameterNames optional. fetchMatching already can contain callback functions, so extend the mechanism to pass values of all actual parameters from user's select() call. Similar for putMatching, if we implement it. Possibly the similar for fetchCondition (and for putCondition, if we implement it).
  • consider applying fetchMatching in other ways than just SQL = comparison. E.g. LIKE, <>, IS NULL, IS NOT NULL. The same for passing optional column filters to SeLiteData.Storage.prototype.getRecords() via its params.parameters field.