接口 Schema
-
- 所有超级接口:
DatabaseObject
- 所有已知实现类:
SchemaImpl
public interface Schema extends DatabaseObject
A client-side representation of a database schema. Provides access to the schema contents.
-
-
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static classSchema.CreateCollectionOptionsDefines options to be passed tocreateCollection(String, CreateCollectionOptions).static classSchema.ModifyCollectionOptionsDefines options to be passed tomodifyCollection(String, ModifyCollectionOptions).static classSchema.ValidationValidation options to be passed tocreateCollection(String, CreateCollectionOptions)ormodifyCollection(String, ModifyCollectionOptions).-
从接口继承的嵌套类/接口 com.mysql.cj.xdevapi.DatabaseObject
DatabaseObject.DbObjectStatus, DatabaseObject.DbObjectType
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 CollectioncreateCollection(String name)Create a new collection.CollectioncreateCollection(String name, boolean reuseExisting)Create a new collection if it does not already exist on the server.CollectioncreateCollection(String collectionName, Schema.CreateCollectionOptions options)Create a new collection.voiddropCollection(String collectionName)Drop the collection from this schema.CollectiongetCollection(String name)Retrieve a reference to the named collection.CollectiongetCollection(String name, boolean requireExists)Retrieve a reference to the named collection hinting that an exception should be thrown if the collection is not known to the server.TablegetCollectionAsTable(String name)Retrieve a reference to the named collection using the table API.List<Collection>getCollections()Retrieve the set of collections existing in this schema.List<Collection>getCollections(String pattern)Retrieve the set of collections existing in this schema and matching the given pattern.TablegetTable(String name)Retrieve a reference to the named table.TablegetTable(String tableName, boolean requireExists)Retrieve a reference to the named table hinting that an exception should be thrown if the collection is not known to the server.List<Table>getTables()Retrieve the set of tables existing in this schema.List<Table>getTables(String pattern)Retrieve the set of tables existing in this schema and matching the given pattern.voidmodifyCollection(String collectionName, Schema.ModifyCollectionOptions options)Modify the schema validation of a collection.-
从接口继承的方法 com.mysql.cj.xdevapi.DatabaseObject
existsInDatabase, getName, getSchema, getSession
-
-
-
-
方法详细资料
-
getCollections
List<Collection> getCollections()
Retrieve the set of collections existing in this schema.- 返回:
- list of
Collectionobjects
-
getCollections
List<Collection> getCollections(String pattern)
Retrieve the set of collections existing in this schema and matching the given pattern.- 参数:
pattern- match pattern- 返回:
- list of
Collectionobjects
-
getTables
List<Table> getTables()
Retrieve the set of tables existing in this schema.- 返回:
- list of
Tableobjects
-
getTables
List<Table> getTables(String pattern)
Retrieve the set of tables existing in this schema and matching the given pattern.- 参数:
pattern- match pattern- 返回:
- list of
Tableobjects
-
getCollection
Collection getCollection(String name)
Retrieve a reference to the named collection.- 参数:
name- collection name- 返回:
Collection
-
getCollection
Collection getCollection(String name, boolean requireExists)
Retrieve a reference to the named collection hinting that an exception should be thrown if the collection is not known to the server.- 参数:
name- collection namerequireExists- true if required to exist- 返回:
Collection
-
getCollectionAsTable
Table getCollectionAsTable(String name)
Retrieve a reference to the named collection using the table API.- 参数:
name- collection name- 返回:
Table
-
getTable
Table getTable(String name)
Retrieve a reference to the named table.- 参数:
name- table name- 返回:
Table
-
getTable
Table getTable(String tableName, boolean requireExists)
Retrieve a reference to the named table hinting that an exception should be thrown if the collection is not known to the server.- 参数:
tableName- table namerequireExists- true if required to exist- 返回:
Table
-
createCollection
Collection createCollection(String name)
Create a new collection.- 参数:
name- collection name- 返回:
Collection
-
createCollection
Collection createCollection(String name, boolean reuseExisting)
Create a new collection if it does not already exist on the server.- 参数:
name- collection namereuseExisting- true if allowed to reuse- 返回:
Collection
-
createCollection
Collection createCollection(String collectionName, Schema.CreateCollectionOptions options)
Create a new collection.- 参数:
collectionName- collection nameoptions- reuseExisting, validation level and JSON schema options- 返回:
Collection
-
modifyCollection
void modifyCollection(String collectionName, Schema.ModifyCollectionOptions options)
Modify the schema validation of a collection.- 参数:
collectionName- collection nameoptions- validation level and JSON schema options
-
dropCollection
void dropCollection(String collectionName)
Drop the collection from this schema.- 参数:
collectionName- name of collection to drop
-
-