MySQL Shell API 9.0.1
Unified development interface for MySQL Products
|
Represents a Schema as retrieved from a session created using the X Protocol. More...
Methods | |
List | getTables () |
Returns a list of Tables for this Schema. More... | |
List | getCollections () |
Returns a list of Collections for this Schema. More... | |
Table | getTable (String name) |
Returns the Table of the given name for this schema. More... | |
Collection | getCollection (String name) |
Returns the Collection of the given name for this schema. More... | |
Table | getCollectionAsTable (String name) |
Returns a Table object representing a Collection on the database. More... | |
Collection | createCollection (String name, Dictionary options) |
Creates in the current schema a new collection with the specified name and retrieves an object representing the new collection created. More... | |
Undefined | modifyCollection (String name, Dictionary options) |
Modifies the schema validation of a collection. More... | |
Undefined | dropCollection (String name) |
Drops the specified collection. More... | |
Methods inherited from DatabaseObject | |
String | getName () |
Returns the name of this database object.
| |
Object | getSession () |
Returns the Session object of this database object.
| |
Object | getSchema () |
Returns the Schema object of this database object.
| |
Bool | existsInDatabase () |
Verifies if this object exists in the database.
| |
Additional Inherited Members | |
Properties inherited from DatabaseObject | |
String | name |
The name of this database object. | |
Object | session |
The Session object of this database object. | |
Object | schema |
The Schema object of this database object. | |
Represents a Schema as retrieved from a session created using the X Protocol.
View Support
MySQL Views are stored queries that when executed produce a result set.
MySQL supports the concept of Updatable Views: in specific conditions are met, Views can be used not only to retrieve data from them but also to update, add and delete records.
For the purpose of this API, Views behave similar to a Table, and so they are treated as Tables.
Tables and Collections as Properties
A Schema object may expose tables and collections as properties, this way they can be accessed as:
This handy way of accessing tables and collections is available if they met the following conditions:
If any of the conditions is not met, the way to access the table or collection is by using the standard DevAPI functions:
List getTables | ( | ) |
List getCollections | ( | ) |
Returns a list of Collections for this Schema.
Pulls from the database the available Tables, Views and Collections.
Does a full refresh of the Tables, Views and Collections cache.
Returns a List of available Collection objects.
Table getTable | ( | String | name | ) |
Collection getCollection | ( | String | name | ) |
Returns the Collection of the given name for this schema.
name | the name of the Collection to look for. |
Verifies if the requested Collection exist on the database, if exists, returns the corresponding Collection object.
Updates the Collections cache.
Collection getCollectionAsTable | ( | String | name | ) |
Returns a Table object representing a Collection on the database.
name | the name of the collection to be retrieved as a table. |
Collection createCollection | ( | String | name, |
Dictionary | options | ||
) |
Creates in the current schema a new collection with the specified name and retrieves an object representing the new collection created.
name | the name of the collection. |
options | optional dictionary with options. |
To specify a name for a collection, follow the naming conventions in MySQL.
The options dictionary may contain the following attributes:
The validation object allows the following attributes:
Undefined modifyCollection | ( | String | name, |
Dictionary | options | ||
) |
Modifies the schema validation of a collection.
name | the name of the collection. |
options | dictionary with options. |
The options dictionary may contain the following attributes:
The validation object allows the following attributes:
Undefined dropCollection | ( | String | name | ) |
Drops the specified collection.