System:Model
From Aspen Documentation
The Model class is a wrapper for the ADOdb library. It provides methods for generating and automating handling of queries, calculations using results, etc.
| Function | Description |
|---|---|
| openTable | Sets the current table and loads the table schema. |
| getSchema | Returns raw schema for the current table. |
| getPrimaryKey | Returns the field marked as primary key for current table. |
| enablePagination | Enables pagination related functions. |
| showStatus | Returns the table status info. |
| getLastQuery | Returns the last run query. |
| setSecurityRule | Sets a security rule for data coming into a specific field through any other auto-generated model queries. |
| select | Adds a new select statement to our query. |
| addSelectField | Adds an additional select field to a query. |
| leftJoin | Generates a left join. |
| where | Adds a standard where condition. |
| whereNot | Adds a standard where not condition. |
| whereLike | Adds a standard where like %% condition |
| whereBetween | Searches for values between $start and $end |
| whereGreaterThan | Adds a standard where greater than condition |
| whereLessThan | Adds a standard where less than condition. |
| whereBeforeToday | Finds timestamps prior to today. |
| whereAfterToday | Finds timestamps after today. |
| inPastXDays | Finds timestamps in the last $day_count days. |
| addFilters | Handles incoming filter params in url to add automated conditions to query. |
| orderBy | Adds a sort order, optionally pulls from saved prefs. |
| limit | Limits the results returned. |
| match | Adds a fulltext index match function |
| paginate | Sets the limit for pagination page numbers |
| groupBy | Sets a group by. |
| query | A wrapper for running a query directly to the db, and provided the results directly to the caller. |
| results | Runs the generated query and appends any additional info we've selected. |
| quickValue | Returns a single field, single-record value from a query. |
| clearQuery | Clears the generated query. |
| quickSelectSingle | Generates a quick select statement for a single record. |
| quickSelectSingleToXml | Generates a quick select statement for a single record and returns the result as xml |
| delete | Generates and executes a select query |
| duplicate | Duplicates records using INSERT... SELECT... |
| addCalc | Adds a field calculation to db results. |
| createHtmlTable | Creates a basic html table with the results |
| insert | Generates an INSERT query and auto-executes it. |
| generateInsert | Generates an INSERT query, but does not auto-execute it. |
| update | Generates an UPDATE query and auto-executes it. |
| generateUpdate | Generates an UPDATE query, but does not auto-execute it. |