[matviews] Materialized views can be included in the model
High level description of the changes: src/org/apache/ddlutils/model/MaterializedView.java - In memory representation of a materialized view - Materialized views have: name, statement, indices and columns (columns are a by product required to support indexes) src/mapping.xml - adds the org.apache.ddlutils.model.MaterializedView class to the mapping, so that it is properly export to / read from xml source files src/org/apache/ddlutils/model/Database.java - adds the _materializedViews attribute - adds all required methods to interact with the in-memory materialized views * getMaterializedViewCount() * getMaterializedView(idx) * addMaterializedView(materializedView) * findMaterializedView(name) * ... - Applies naming convention to materialized views, to export only those belonging to module being exported src/org/apache/ddlutils/platform/ModelLoaderBase.java - adds the _stmt_listmaterializedviews that will be given value by specific db implementations - in method readDatabase, calls to db.addMaterializedViews to add materialized views to in-memory database - adds readMaterializedViews to, given the results of executing _stmt_listmaterializedviews, create in-memory materialized views src/org/apache/ddlutils/platform/oracle/OracleModelLoader.java - updates _stmt_listtables so that it does not pick materialized views when reading tables - gives value to _stmt_listmaterializedviews to load materialized views from oracle catalog src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java - rewrites _stmt_listcolumns so that it can be used to read columns both from tables and from materialized views - gives value to _stmt_listmaterializedviews to load materialized views from postgresql catalog src/org/apache/ddlutils/platform/SqlBuilder.java - createTables also creates materialized views - writeCreateMaterializedViewStatement will be overwritten by specific database implementations to define statement to create materialized views - implements dropMaterializedView, as is the same both in Oracle and PostgreSQL - removeExternalConstraintsIndexesAndViews also drops materialized views src/org/apache/ddlutils/platform/oracle/OracleBuilder.java - overwrites writeCreateMaterializedViewStatement with materialized view creation statement in Oracle src/org/apache/ddlutils/platform/postgresql/PostgreSqlBuilder.java - overwrites writeCreateMaterializedViewStatement with materialized view creation statement in postgresql Oracle does not support defining partial indexes, or indexes with operator classes. In these cases, we store this metadata as comments in the database objects, to ensure it is not lost if the database object is re-exported to the Openbravo sources. To share as much possible code with the logic that manages this metadata in indexes that belong to tables, a new IndexableModelObject has been created. Both Table and MaterializedView implement this interface.
Loading
Please register or sign in to comment