Class DdlAdaptor


  • public final class DdlAdaptor
    extends Object
    • Method Detail

      • createSchema

        public void createSchema​(Connection conn,
                                 String name)
        Creates DB schema.
        Parameters:
        conn - DB connection
        name - schema name
      • dropView

        public void dropView​(Connection conn,
                             String schemaName,
                             String viewName)
        Drops view from a DB schema.
        Parameters:
        conn - DB connection
        schemaName - schema name
        viewName - view name
      • dropParameterizedView

        public void dropParameterizedView​(Connection conn,
                                          String schemaName,
                                          String viewName)
      • dropIndex

        public void dropIndex​(Connection conn,
                              Grain g,
                              DbIndexInfo dBIndexInfo)
        Drops index of a grain.
        Parameters:
        conn - DB connection
        g - grain
        dBIndexInfo - index information
      • dropFK

        public void dropFK​(Connection conn,
                           String schemaName,
                           String tableName,
                           String fkName)
        Drops foreign key of table in a scheme.
        Parameters:
        conn - DB connection
        schemaName - grain name
        tableName - table name for column(s) of which FK is declared
        fkName - name of foreign key
      • dropTrigger

        public void dropTrigger​(Connection conn,
                                TriggerQuery query)
        Drops a trigger from DB.
        Parameters:
        conn - Connection
        query - Trigger query
      • createSequence

        public void createSequence​(Connection conn,
                                   SequenceElement s)
        Creates a sequence in the database.
        Parameters:
        conn - DB connection
        s - sequence element
      • alterSequence

        public void alterSequence​(Connection conn,
                                  SequenceElement s)
        Alters sequence in the database.
        Parameters:
        conn - DB connection
        s - sequence element
      • createTable

        public void createTable​(Connection conn,
                                TableElement te)
        Creates a table "from scratch" in the database.
        Parameters:
        conn - Connection
        te - Table for creation (accepts also table in case if such table exists)
      • dropPk

        public void dropPk​(Connection conn,
                           TableElement t,
                           String pkName)
        Drops primary key from the table by using known name of the primary key.
        Parameters:
        conn - DB connection
        t - table
        pkName - primary key name
      • updateColumn

        public void updateColumn​(Connection conn,
                                 Column<?> c,
                                 DbColumnInfo actual)
        Updates a table column.
        Parameters:
        conn - DB connection
        c - Column to update
        actual - Actual column info
      • createColumn

        public void createColumn​(Connection conn,
                                 Column<?> c)
        Adds a new column to the table.
        Parameters:
        conn - DB connection
        c - column
      • createPk

        public void createPk​(Connection conn,
                             TableElement t)
        Creates primary key in the table according to meta description.
        Parameters:
        conn - database connection
        t - table
      • createIndex

        public void createIndex​(Connection conn,
                                Index index)
        Creates a table index in the grain.
        Parameters:
        conn - DB connection
        index - index description
      • createFk

        public void createFk​(Connection conn,
                             ForeignKey fk)
        Creates foreign key in the DB.
        Parameters:
        conn - DB connection
        fk - foreign key from score
      • createView

        public void createView​(Connection conn,
                               View v)
        Creates a view in the database from metadata.
        Parameters:
        conn - DB connection
        v - View from score
      • getViewSQLGenerator

        public SQLGenerator getViewSQLGenerator()
      • dropTable

        public void dropTable​(Connection conn,
                              TableElement t)
        Deletes table from RDBMS.
        Parameters:
        conn - Connection to use.
        t - TableElement metadata of deletable table provided by Celesta.
      • dropTableTriggersForMaterializedViews

        public void dropTableTriggersForMaterializedViews​(Connection conn,
                                                          BasicTable t)
      • createTableTriggersForMaterializedViews

        public void createTableTriggersForMaterializedViews​(Connection conn,
                                                            BasicTable t)
      • executeNative

        public void executeNative​(Connection conn,
                                  String sql)
        Executes native SQL query.
        Parameters:
        conn - DB connection
        sql - SQL to execute