Interface IDatabase
- All Superinterfaces:
IStatement,IStatementContainer
- All Known Implementing Classes:
ChDatabase,MsDatabase,PgDatabase
Interface representing a database containing schemas.
Provides access to database schemas and extends statement container functionality.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnalysisLauncher(IAnalysisLauncher launcher) Add 'analysis launcher' for deferred analyze.default voidAdds a library database to this database, merging its objects and analysis launchers.voidaddOverride(ObjectOverride override) Adds object overridevoidaddReference(String fileName, ObjectLocation loc) Adds an object reference to the specified file.default ObjectStateappendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typevoidClears all analysis launchers and trims the internal list to size.default voidconcat(IStatement st) Adds library object to database with overridedefault booleancontainsSchema(String name) default voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.default IDatabaseGets the database that contains this statement.default voidgetDropSQL(SQLScript script, boolean optionExists) Generates DROP SQL for this statement.Gets the list of object overrides for this database.Gets a schema by name.Collection<? extends ISchema>Gets all schemas in this database.getStatement(ObjectReference objectReference) default DbObjTypeGets the type of this database object.default Map<String,IStatement> Creates a map of all database objects with their qualified names as keys.voidsetDefaultSchema(String name) Methods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, compare, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopy, toObjectReferenceMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatementContainer
addChild, getChild, getChildrenByType
-
Method Details
-
getSchemas
Collection<? extends ISchema> getSchemas()Gets all schemas in this database.- Returns:
- a collection of schemas
-
getSchema
Gets a schema by name.- Parameters:
name- the schema name- Returns:
- the schema with the given name, or null if not found
-
containsSchema
-
getStatement
- Parameters:
objectReference- - object reference- Returns:
- object from database by reference, or null if not found
- Throws:
IllegalStateException- if reference type is not supported by database
-
getDatabase
Description copied from interface:IStatementGets the database that contains this statement.- Specified by:
getDatabasein interfaceIStatement- Returns:
- the containing database
-
getStatementType
Description copied from interface:IStatementGets the type of this database object.- Specified by:
getStatementTypein interfaceIStatement- Returns:
- the database object type
-
getVersion
ISupportedVersion getVersion()- Returns:
- default database version
-
getCreationSQL
Description copied from interface:IStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Specified by:
getCreationSQLin interfaceIStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from interface:IStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin interfaceIStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
getDropSQL
Description copied from interface:IStatementGenerates DROP SQL for this statement.- Specified by:
getDropSQLin interfaceIStatement- Parameters:
script- the SQL script to append the DROP statement tooptionExists- whether to include "IF EXISTS" in the DROP statement
-
getDefaultSchema
ISchema getDefaultSchema() -
setDefaultSchema
-
addLib
Adds a library database to this database, merging its objects and analysis launchers.- Parameters:
lib- the library database to addlibName- the name of the libraryowner- the owner to set for owned objects
-
concat
Adds library object to database with override- Parameters:
st- the library object to add
-
addOverride
Adds object override- Parameters:
override- object override
-
getOverrides
Collection<ObjectOverride> getOverrides()Gets the list of object overrides for this database.- Returns:
- the list of overrides
-
getObjReferences
Map<String,Set<ObjectLocation>> getObjReferences()- Returns:
- all object references for this database
-
getAnalysisLaunchers
List<IAnalysisLauncher> getAnalysisLaunchers()- Returns:
- all analysis launcher for this database
-
addAnalysisLauncher
Add 'analysis launcher' for deferred analyze.- Parameters:
launcher- launcher that contains almost everything needed to analyze a statement contained in it
-
addReference
Adds an object reference to the specified file.- Parameters:
fileName- the file name to associate with the locationloc- the object location to add
-
clearAnalysisLaunchers
void clearAnalysisLaunchers()Clears all analysis launchers and trims the internal list to size. -
listObjects
Creates a map of all database objects with their qualified names as keys.- Returns:
- a map of qualified names to statements
-