Meta Data
Many of the features of the DataFaucet ORM rely on the ability to retrieve meta data from your database. The use of foreign key constraints to automate join statements between tables is just one of many examples. Other examples include the ability to export schemas from one database to install into another database and related upgrade scripts, as well as active record validation and the ability of the gateway CFC to automatically detect searchable text columns in a table.
All of these features rely on access to the database meta data. That access is supplied via the datasource object. Here is a brief synopsis of the meta data functions.
| query = getTables ([tableNames, types]) | Returns a query containing a list of available tables - types include table and view and both can be returned simultaneously - tablenames argument allows you to filter with % as a wildcard |
|---|---|
| query = getColumns (table) | Returns a query containing column information for a specified table |
| query = getPrimaryKeys (table) | Returns a query containing information about primary key columns declared in the specified table - in most cases this returns one record |
| query = getImportedKeys (table) | Returns a query containing information about columns in the specified table that reference columns in other tables |
| query = getExportedKeys (table) | Returns a query containing information about all the tables that reference the primary key of the specified table |
| query = getStoredProcedures ([procNames]) | Returns a query containing a list of available stored procedures - the procNames argument allows procedures to be filtered using % as a wildcard |
| query = getParameters (procedure) | Returns a query containing parameters for a specified stored procedure |
| query = getCatalogs () | Returns a query containing a list of catalogs in the current database installation |
| query = getSchemas () | Returns a query containing a list of schemas in the current database installationn |
| boolean = hasTable (entity) | Indicates if a specified table exists in the database |
| boolean = hasView (entity) | Indicates if a specified view exists in the database |
| boolean = hasTableOrView (entity) | Indicates if a specified table or view exists in the database |
| boolean = hasProcedure (entity) | Indicates if a specified stored procedure exists in the database |
| boolean = hasColumn (entity, column) | Indicates if a specified column exists in a specified table or view |