Package com.exasol.dbbuilder.dialects
Class AbstractSchema
- java.lang.Object
-
- com.exasol.dbbuilder.dialects.AbstractDatabaseObject
-
- com.exasol.dbbuilder.dialects.AbstractSchema
-
- All Implemented Interfaces:
DatabaseObject,Schema
- Direct Known Subclasses:
ExasolSchema,MySqlSchema,OracleSchema,PostgreSqlSchema
public abstract class AbstractSchema extends AbstractDatabaseObject implements Schema
This class contains common logic for a database schema.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSchema(com.exasol.db.Identifier name)Create a new database schema.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TablecreateTable(String name, String column1Name, String column1Type)Create a table with one column.TablecreateTable(String name, String column1Name, String column1Type, String column2Name, String column2Type)Create a table with two columns.TablecreateTable(String name, String column1Name, String column1Type, String column2Name, String column2Type, String column3Name, String column3Type)Create a table with three columns.TablecreateTable(String name, List<String> columnNames, List<String> columnTypes)Create a table with an arbitrary number of columns.Table.BuildercreateTableBuilder(String name)Create a builder for a table.protected voiddropInternally()This is called byAbstractDatabaseObject.drop()to actually execute the DROP statement.protected abstract com.exasol.db.IdentifiergetIdentifier(String name)Get an instance ofIdentifier.List<Table>getTables()Get the tables inside this schema.protected abstract DatabaseObjectWritergetWriter()Get aDatabaseObjectWriter.protected voidpassColumnsToTableBuilder(List<String> columnNames, List<String> columnTypes, Table.Builder builder)Method that passes in a list of column names, and a list of their types, into a table builder.-
Methods inherited from class com.exasol.dbbuilder.dialects.AbstractDatabaseObject
drop, getFullyQualifiedName, getName, isOwned, markDeleted, verifyNotDeleted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.exasol.dbbuilder.dialects.DatabaseObject
drop, getFullyQualifiedName, getName, isOwned
-
-
-
-
Method Detail
-
getWriter
protected abstract DatabaseObjectWriter getWriter()
Get aDatabaseObjectWriter.- Returns:
DatabaseObjectWriter
-
getTables
public List<Table> getTables()
Description copied from interface:SchemaGet the tables inside this schema.
-
createTable
public Table createTable(String name, String column1Name, String column1Type)
Description copied from interface:SchemaCreate a table with one column.- Specified by:
createTablein interfaceSchema- Parameters:
name- name of the tablecolumn1Name- name of the first columncolumn1Type- type of the first column- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type)
Description copied from interface:SchemaCreate a table with two columns.- Specified by:
createTablein interfaceSchema- Parameters:
name- name of the tablecolumn1Name- name of the first columncolumn1Type- type of the first columncolumn2Name- name of the second columncolumn2Type- type of the second column- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type, String column3Name, String column3Type)
Description copied from interface:SchemaCreate a table with three columns.- Specified by:
createTablein interfaceSchema- Parameters:
name- name of the tablecolumn1Name- name of the first columncolumn1Type- type of the first columncolumn2Name- name of the second columncolumn2Type- type of the second columncolumn3Name- name of the third columncolumn3Type- type of the third column- Returns:
- table
-
createTableBuilder
public Table.Builder createTableBuilder(String name)
Description copied from interface:SchemaCreate a builder for a table.In cases where you need a more complex table that can be created by the convenience methods
createTable, this method provides a builder.- Specified by:
createTableBuilderin interfaceSchema- Parameters:
name- table name- Returns:
- builder for the table
-
createTable
public Table createTable(String name, List<String> columnNames, List<String> columnTypes)
Description copied from interface:SchemaCreate a table with an arbitrary number of columns.- Specified by:
createTablein interfaceSchema- Parameters:
name- name of the tablecolumnNames- list of column namescolumnTypes- list of column types- Returns:
- table
-
passColumnsToTableBuilder
protected void passColumnsToTableBuilder(List<String> columnNames, List<String> columnTypes, Table.Builder builder)
Method that passes in a list of column names, and a list of their types, into a table builder.- Parameters:
columnNames- the column namescolumnTypes- the column typesbuilder- the builder that gets the information passed in
-
getIdentifier
protected abstract com.exasol.db.Identifier getIdentifier(String name)
Get an instance ofIdentifier.- Parameters:
name- identifier id- Returns:
- instance of
Identifier
-
dropInternally
protected void dropInternally()
Description copied from class:AbstractDatabaseObjectThis is called byAbstractDatabaseObject.drop()to actually execute the DROP statement.- Specified by:
dropInternallyin classAbstractDatabaseObject
-
-