
DBCatalog
This houses the database catalog information, and is accessible via the DB#catalog property as follows:
var catalog = db.catalog;
Constructor Attributes | Constructor Name and Description |
---|---|
DBCatalog
()
This object houses the database catalog information.
|
Field Attributes | Field Name and Description |
---|---|
The
DBFunctionStore
catalog of functions available.
|
Method Attributes | Method Name and Description |
---|---|
createTable
(tableProperties)
Creates a table with the specified attributes and data.
|
|
createTables
(tableArray)
A convenience method for creating multiple tables with a single call.
|
|
dropTable
(tabName)
Drops the specified table from the database catalog.
|
|
getAllTables
()
Returns an array of
DBTable
objects corresponding to
all of the tables in the database's catalog.
|
|
Gets the current "persistence scope" of the catalog.
|
|
getTable
(tableName)
Returns a
DBTable
object for the specified table.
|
|
isPersistenceScopeAvailable
(persistenceScope)
Returns whether the "persistence scope" is available in the
current browser.
|
|
setPersistenceScope
(newPersistenceScope)
Sets the "persistence scope" of the catalog.
|
db.catalog.createTable({ tableName: "EMPL", columns: [ "EMPL_ID", "NAME", "AGE", "DEPT_ID" ], primaryKey: [ "EMPL_ID" ], data: [ [0,"Bob",32,0], [1,"John",37,2], [2,"Fred",28,1], [3,"Sue",26,3], [4,"Beth",22,99], [5,"Mary",27,3], [6,"Adrian",24,1] ] });
This action takes part in a transaction, so a DB#commit is required to finalize it, and a DB#rollback will revert the change.
- Parameters:
- {object} tableProperties
-
An object containing the properties
of the table as follows:
tableName : (required) The name of the table being added.
columns : (required) An array of column names to add to the table.
primaryKey : (optional) An array of the column names that make up the primaryKey.
persistenceScope : (optional) The peristence scope (see DBTable#setPersistenceScope ).
data : (optional) A data array of arrays (rows and columns) to initialize the table's data.
- Throws:
- { Exception }
- If a table with the same name already exists.
- { Exception }
-
If
data
is provided and a row has the incorrect number of columns. - { Exception }
-
If
primaryKey
anddata
are provided and multiple rows contain the same primary key.
- Parameters:
- {object[]} tableArray
- An array of tableProperty objects containing the properties of the tables. See DBTable.createTable for the list of valid properties.
- Throws:
- { Exception }
- If a table with the same name already exists.
- { Exception }
-
If
data
is provided and a row has the incorrect number of columns. - { Exception }
-
If
primaryKey
anddata
are provided and multiple rows contain the same primary key.
- See:
- DBTable#createTable
This action takes part in a transaction, so a DB#commit is required to finalize it, and a DB#rollback will revert the change.
- Parameters:
- {string} tabName
- The name of the table to drop.
- Returns:
-
{
DBTable
[]}
A
DBTable
object for the provided
tableName
, ornull
if no such table exists.
- Returns:
- {const} The persistence scope of the catalog.
- See:
- DBCatalog#setPersistenceScope
- DBCatalog#isPersistenceScopeAvailable
- DBTable#getPersistenceScope
- Parameters:
- {string} tableName
- The name of the table being retrieved.
- Parameters:
- {const} persistenceScope
- The Persistence Scope to test.
- Returns:
- {boolean} Whether the persistence scope is available in the current browser.
This method takes part in a transaction, so a DB#commit is required to finalize it, and a DB#rollback will revert the change.
- Parameters:
- {const} newPersistenceScope
- The new Persistence Scope
- See:
- DBCatalog#getPersistenceScope
- DBCatalog#isPersistenceScopeAvailable
- DBTable#setPersistenceScope
- DB#commit