MySQL Shell  8.0.16
Unified development interface for MySQL Products
Methods | List of all members
Schema Class Reference

Represents a Schema as retrived 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)
 Creates in the current schema a new collection with the specified name and retrieves an object representing the new collection created. More...
 
Undefined dropCollection (String name)
 Drops the specified collection. More...
 
- Methods inherited from DatabaseObject
String getName ()
 
Object getSession ()
 Returns the Session object of this database object.

Returns
The Session object used to get to this object.
More...
 
Object getSchema ()
 Returns the Schema object of this database object.

Returns
The Schema object used to get to this object.
More...
 
Bool existsInDatabase ()
 Verifies if this object exists in the database.

Returns
A boolean indicating if the object still exists on 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.
 

Detailed Description

Represents a Schema as retrived 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.

Member Function Documentation

◆ getTables()

List getTables ( )

Returns a list of Tables for this Schema.

See also
Table
Returns
A List containing the Table objects available for the 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 Table objects.

◆ getCollections()

List getCollections ( )

Returns a list of Collections for this Schema.

See also
Collection
Returns
A List containing the Collection objects available for the 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.

◆ getTable()

Table getTable ( String  name)

Returns the Table of the given name for this schema.

Parameters
namethe name of the Table to look for.
Returns
the Table object matching the name.

Verifies if the requested Table exist on the database, if exists, returns the corresponding Table object.

Updates the Tables cache.

See also
Table

◆ getCollection()

Collection getCollection ( String  name)

Returns the Collection of the given name for this schema.

Parameters
namethe name of the Collection to look for.
Returns
the Collection object matching the name.

Verifies if the requested Collection exist on the database, if exists, returns the corresponding Collection object.

Updates the Collections cache.

See also
Collection

◆ getCollectionAsTable()

Collection getCollectionAsTable ( String  name)

Returns a Table object representing a Collection on the database.

Parameters
namethe name of the collection to be retrieved as a table.
Returns
the Table object representing the collection or undefined.

◆ createCollection()

Collection createCollection ( String  name)

Creates in the current schema a new collection with the specified name and retrieves an object representing the new collection created.

Parameters
namethe name of the collection.
Returns
the new created collection.

To specify a name for a collection, follow the naming conventions in MySQL.

◆ dropCollection()

Undefined dropCollection ( String  name)

Drops the specified collection.

Returns
Nothing.