Interface ISchemaAdapter

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void alterSequenceRestartWith​(java.lang.String schemaName, java.lang.String sequenceName, long restartWith, int cache, int incrementBy)
      Sets/resets the sequence to start with the given value.
      void alterTableAddColumn​(java.lang.String schemaName, java.lang.String tableName, ColumnBase column)
      Add a new column to an existing table
      void alterTableColumnIdentityCache​(java.lang.String schemaName, java.lang.String objectName, java.lang.String columnName, int cache)
      Change the CACHE value of the named identity generated always column
      void applyDistributionRules​(java.lang.String schemaName, java.lang.String tableName, DistributionType distributionType, java.lang.String distributionColumnName)
      Apply any distribution rules configured for the named table
      boolean checkCompatibility​(java.lang.String adminSchema)
      checks connectivity to the database and that it is compatible
      void createForeignKeyConstraint​(java.lang.String constraintName, java.lang.String schemaName, java.lang.String name, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.util.List<java.lang.String> columns, boolean enforced, DistributionType distributionType, boolean targetIsReference)  
      void createIndex​(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType)
      Create an index on the named schema.table object
      void createOrReplaceFunction​(java.lang.String schemaName, java.lang.String objectName, java.util.function.Supplier<java.lang.String> supplier)
      creates or replaces the SQL function
      void createOrReplaceProcedure​(java.lang.String schemaName, java.lang.String procedureName, java.util.function.Supplier<java.lang.String> supplier)
      Create the stored procedure using the DDL text provided by the supplier
      void createOrReplaceView​(java.lang.String schemaName, java.lang.String objectName, java.lang.String selectClause)
      Create or replace the view
      void createSchema​(java.lang.String schemaName)
      Create a database schema
      void createSequence​(java.lang.String schemaName, java.lang.String sequenceName, long startWith, int cache, int incrementBy)  
      void createTable​(java.lang.String schemaName, java.lang.String name, java.util.List<ColumnBase> columns, PrimaryKeyDef primaryKey, IdentityDef identity, java.lang.String tablespaceName, java.util.List<With> withs, java.util.List<CheckConstraint> checkConstraints, DistributionType distributionType, java.lang.String distributionColumnName)
      Build the create table DDL
      void createTablespace​(java.lang.String tablespaceName)
      Create a new tablespace with the given name
      void createTablespace​(java.lang.String tablespaceName, int extentSizeKB)
      Create a new tablespace using the given extent size
      void createUniqueConstraint​(java.lang.String constraintName, java.util.List<java.lang.String> columns, java.lang.String schemaName, java.lang.String name)
      create a unique constraint on a table.
      void createUniqueIndex​(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, java.util.List<java.lang.String> includeColumns, DistributionType distributionType, java.lang.String distributionColumnName)
      Create a unique index
      void createUniqueIndex​(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType, java.lang.String distributionColumnName)
      Create a unique index
      void createView​(java.lang.String schemaName, java.lang.String objectName, java.lang.String selectClause)
      Create the view as defined by the selectClause
      void disableForeignKey​(java.lang.String schemaName, java.lang.String tableName, java.lang.String constraintName)
      Disable the FK with the given constraint name
      void distributeFunction​(java.lang.String schemaName, java.lang.String functionName, int distributeByParamNumber)
      For Citus, functions can be distributed by one of their parameters (typically the first)
      boolean doesForeignKeyConstraintExist​(java.lang.String schemaName, java.lang.String tableName, java.lang.String constraintName)
      Check to see if the named foreign key constraint already exists
      boolean doesTableExist​(java.lang.String schemaName, java.lang.String objectName)
      Check if the table currently exists
      void dropForeignKey​(java.lang.String schemaName, java.lang.String tableName, java.lang.String constraintName)
      Drop the FK on the table with the given constraint name
      void dropFunction​(java.lang.String schemaName, java.lang.String functionName)
      drops a given function
      void dropIndex​(java.lang.String schemaName, java.lang.String indexName)
      Drop the named index
      void dropProcedure​(java.lang.String schemaName, java.lang.String procedureName)
      Drop the given procedure
      void dropSequence​(java.lang.String schemaName, java.lang.String sequenceName)  
      void dropTable​(java.lang.String schemaName, java.lang.String name)
      Drop table from the schema
      void dropTablespace​(java.lang.String tablespaceName)
      Drop an existing tablespace, including all of its contents
      void dropView​(java.lang.String schemaName, java.lang.String objectName)
      Drop the view from the database
      void enableForeignKey​(java.lang.String schemaName, java.lang.String tableName, java.lang.String constraintName)
      Enable the FK with the given constraint name
      void grantAllSequenceUsage​(java.lang.String schemaName, java.lang.String grantToUser)
      Grant access to all sequences in the named schema
      void grantFunctionPrivileges​(java.lang.String schemaName, java.lang.String functionName, java.util.Collection<Privilege> privileges, java.lang.String toUser)
      grants permissions on a given function
      void grantObjectPrivileges​(java.lang.String schemaName, java.lang.String tableName, java.util.Collection<Privilege> privileges, java.lang.String toUser)
      Grant the list of privileges on the named object to the user.
      void grantProcedurePrivileges​(java.lang.String schemaName, java.lang.String procedureName, java.util.Collection<Privilege> privileges, java.lang.String toUser)
      Grant the collection of privileges on the named procedure to the user
      void grantSchemaUsage​(java.lang.String schemaName, java.lang.String grantToUser)
      Grants USAGE on the given schemaName to the given user
      void grantSequencePrivileges​(java.lang.String schemaName, java.lang.String objectName, java.util.Collection<Privilege> group, java.lang.String toUser)
      Grant the collection of privileges on the named variable to the user
      void grantVariablePrivileges​(java.lang.String schemaName, java.lang.String variableName, java.util.Collection<Privilege> privileges, java.lang.String toUser)
      Grant the collection of privileges on the named variable to the user
      java.util.List<SchemaInfoObject> listSchemaObjects​(java.lang.String schemaName)
      List the objects present in the given schema
      void runStatement​(IDatabaseStatement statement)
      Run the given statement against the database represented by this adapter
      void setIntegrityOff​(java.lang.String schemaName, java.lang.String tableName)  
      void setIntegrityUnchecked​(java.lang.String schemaName, java.lang.String tableName)  
    • Method Detail

      • createTablespace

        void createTablespace​(java.lang.String tablespaceName)
        Create a new tablespace with the given name
        Parameters:
        tablespaceName -
      • createTablespace

        void createTablespace​(java.lang.String tablespaceName,
                              int extentSizeKB)
        Create a new tablespace using the given extent size
        Parameters:
        tablespaceName -
        extentSizeKB -
      • dropTablespace

        void dropTablespace​(java.lang.String tablespaceName)
        Drop an existing tablespace, including all of its contents
        Parameters:
        tablespaceName -
      • createTable

        void createTable​(java.lang.String schemaName,
                         java.lang.String name,
                         java.util.List<ColumnBase> columns,
                         PrimaryKeyDef primaryKey,
                         IdentityDef identity,
                         java.lang.String tablespaceName,
                         java.util.List<With> withs,
                         java.util.List<CheckConstraint> checkConstraints,
                         DistributionType distributionType,
                         java.lang.String distributionColumnName)
        Build the create table DDL
        Parameters:
        schemaName -
        name -
        columns -
        primaryKey -
        identity -
        tablespaceName -
        withs -
        checkConstraints -
        distributionType -
        distributionColumnName -
      • applyDistributionRules

        void applyDistributionRules​(java.lang.String schemaName,
                                    java.lang.String tableName,
                                    DistributionType distributionType,
                                    java.lang.String distributionColumnName)
        Apply any distribution rules configured for the named table
        Parameters:
        schemaName -
        tableName -
        distributionType -
        distributionColumnName -
      • alterTableAddColumn

        void alterTableAddColumn​(java.lang.String schemaName,
                                 java.lang.String tableName,
                                 ColumnBase column)
        Add a new column to an existing table
        Parameters:
        schemaName -
        tableName -
        column -
      • createOrReplaceProcedure

        void createOrReplaceProcedure​(java.lang.String schemaName,
                                      java.lang.String procedureName,
                                      java.util.function.Supplier<java.lang.String> supplier)
        Create the stored procedure using the DDL text provided by the supplier
        Parameters:
        schemaName -
        procedureName -
        supplier -
      • dropProcedure

        void dropProcedure​(java.lang.String schemaName,
                           java.lang.String procedureName)
        Drop the given procedure
        Parameters:
        schemaName -
        procedureName -
      • createUniqueIndex

        void createUniqueIndex​(java.lang.String schemaName,
                               java.lang.String tableName,
                               java.lang.String indexName,
                               java.util.List<OrderedColumnDef> indexColumns,
                               java.util.List<java.lang.String> includeColumns,
                               DistributionType distributionType,
                               java.lang.String distributionColumnName)
        Create a unique index
        Parameters:
        schemaName -
        tableName -
        indexName -
        indexColumns -
        includeColumns -
        distributionType -
        distributionColumnName -
      • createUniqueIndex

        void createUniqueIndex​(java.lang.String schemaName,
                               java.lang.String tableName,
                               java.lang.String indexName,
                               java.util.List<OrderedColumnDef> indexColumns,
                               DistributionType distributionType,
                               java.lang.String distributionColumnName)
        Create a unique index
        Parameters:
        schemaName -
        tableName -
        indexName -
        indexColumns -
        distributionRules -
        distributionColumnName -
      • createIndex

        void createIndex​(java.lang.String schemaName,
                         java.lang.String tableName,
                         java.lang.String indexName,
                         java.util.List<OrderedColumnDef> indexColumns,
                         DistributionType distributionType)
        Create an index on the named schema.table object
        Parameters:
        schemaName -
        tableName -
        indexName -
        indexColumns -
        distributionType -
      • dropTable

        void dropTable​(java.lang.String schemaName,
                       java.lang.String name)
        Drop table from the schema
        Parameters:
        schemaName -
        name -
      • createForeignKeyConstraint

        void createForeignKeyConstraint​(java.lang.String constraintName,
                                        java.lang.String schemaName,
                                        java.lang.String name,
                                        java.lang.String targetSchema,
                                        java.lang.String targetTable,
                                        java.lang.String targetColumnName,
                                        java.util.List<java.lang.String> columns,
                                        boolean enforced,
                                        DistributionType distributionType,
                                        boolean targetIsReference)
        Parameters:
        constraintName -
        schemaName -
        name -
        targetSchema -
        targetTable -
        targetColumnName -
        columns -
        enforced -
        distributionType - distribution type of the source table
        targetIsReference -
      • createSequence

        void createSequence​(java.lang.String schemaName,
                            java.lang.String sequenceName,
                            long startWith,
                            int cache,
                            int incrementBy)
        Parameters:
        schemaName -
        sequenceName -
        startWith - the START WITH value for the sequence
        cache - the sequence CACHE value
      • dropSequence

        void dropSequence​(java.lang.String schemaName,
                          java.lang.String sequenceName)
        Parameters:
        schemaName -
        sequenceName -
      • alterSequenceRestartWith

        void alterSequenceRestartWith​(java.lang.String schemaName,
                                      java.lang.String sequenceName,
                                      long restartWith,
                                      int cache,
                                      int incrementBy)
        Sets/resets the sequence to start with the given value.
        Parameters:
        schemaName -
        sequenceName -
        restartWith -
        cache -
      • grantObjectPrivileges

        void grantObjectPrivileges​(java.lang.String schemaName,
                                   java.lang.String tableName,
                                   java.util.Collection<Privilege> privileges,
                                   java.lang.String toUser)
        Grant the list of privileges on the named object to the user. This is a general purpose method which can be used to specify privileges for any object type which doesn't need the object type to be specified in the grant DDL.
        Parameters:
        schemaName -
        tableName -
        privileges -
        toUser -
      • grantProcedurePrivileges

        void grantProcedurePrivileges​(java.lang.String schemaName,
                                      java.lang.String procedureName,
                                      java.util.Collection<Privilege> privileges,
                                      java.lang.String toUser)
        Grant the collection of privileges on the named procedure to the user
        Parameters:
        schemaName -
        procedureName -
        privileges -
        toUser -
      • grantVariablePrivileges

        void grantVariablePrivileges​(java.lang.String schemaName,
                                     java.lang.String variableName,
                                     java.util.Collection<Privilege> privileges,
                                     java.lang.String toUser)
        Grant the collection of privileges on the named variable to the user
        Parameters:
        schemaName -
        variableName -
        privileges -
        toUser -
      • grantSequencePrivileges

        void grantSequencePrivileges​(java.lang.String schemaName,
                                     java.lang.String objectName,
                                     java.util.Collection<Privilege> group,
                                     java.lang.String toUser)
        Grant the collection of privileges on the named variable to the user
        Parameters:
        schemaName -
        objectName -
        group -
        toUser -
      • grantSchemaUsage

        void grantSchemaUsage​(java.lang.String schemaName,
                              java.lang.String grantToUser)
        Grants USAGE on the given schemaName to the given user
        Parameters:
        schemaName -
      • grantAllSequenceUsage

        void grantAllSequenceUsage​(java.lang.String schemaName,
                                   java.lang.String grantToUser)
        Grant access to all sequences in the named schema
        Parameters:
        schemaName -
        grantToUser -
      • doesTableExist

        boolean doesTableExist​(java.lang.String schemaName,
                               java.lang.String objectName)
        Check if the table currently exists
        Parameters:
        schemaName -
        objectName -
        Returns:
      • createSchema

        void createSchema​(java.lang.String schemaName)
        Create a database schema
        Parameters:
        schemaName -
      • createUniqueConstraint

        void createUniqueConstraint​(java.lang.String constraintName,
                                    java.util.List<java.lang.String> columns,
                                    java.lang.String schemaName,
                                    java.lang.String name)
        create a unique constraint on a table.
        Parameters:
        constraintName -
        columns -
        schemaName -
        name -
      • checkCompatibility

        boolean checkCompatibility​(java.lang.String adminSchema)
        checks connectivity to the database and that it is compatible
        Parameters:
        adminSchema -
        Returns:
      • createOrReplaceFunction

        void createOrReplaceFunction​(java.lang.String schemaName,
                                     java.lang.String objectName,
                                     java.util.function.Supplier<java.lang.String> supplier)
        creates or replaces the SQL function
        Parameters:
        schemaName -
        objectName -
        supplier -
      • distributeFunction

        void distributeFunction​(java.lang.String schemaName,
                                java.lang.String functionName,
                                int distributeByParamNumber)
        For Citus, functions can be distributed by one of their parameters (typically the first)
        Parameters:
        schemaName -
        functionName -
        distributeByParamNumber -
      • dropFunction

        void dropFunction​(java.lang.String schemaName,
                          java.lang.String functionName)
        drops a given function
        Parameters:
        schemaName -
        functionName -
      • grantFunctionPrivileges

        void grantFunctionPrivileges​(java.lang.String schemaName,
                                     java.lang.String functionName,
                                     java.util.Collection<Privilege> privileges,
                                     java.lang.String toUser)
        grants permissions on a given function
        Parameters:
        schemaName -
        functionName -
        privileges -
        toUser -
      • disableForeignKey

        void disableForeignKey​(java.lang.String schemaName,
                               java.lang.String tableName,
                               java.lang.String constraintName)
        Disable the FK with the given constraint name
        Parameters:
        tableName -
        constraintName -
      • dropForeignKey

        void dropForeignKey​(java.lang.String schemaName,
                            java.lang.String tableName,
                            java.lang.String constraintName)
        Drop the FK on the table with the given constraint name
        Parameters:
        schemaName -
        tableName -
        constraintName -
      • enableForeignKey

        void enableForeignKey​(java.lang.String schemaName,
                              java.lang.String tableName,
                              java.lang.String constraintName)
        Enable the FK with the given constraint name
        Parameters:
        schemaName -
        tableName -
        constraintName -
      • doesForeignKeyConstraintExist

        boolean doesForeignKeyConstraintExist​(java.lang.String schemaName,
                                              java.lang.String tableName,
                                              java.lang.String constraintName)
        Check to see if the named foreign key constraint already exists
        Parameters:
        schemaName -
        tableName -
        constraintName -
        Returns:
      • setIntegrityOff

        void setIntegrityOff​(java.lang.String schemaName,
                             java.lang.String tableName)
        Parameters:
        schemaName -
        tableName -
      • setIntegrityUnchecked

        void setIntegrityUnchecked​(java.lang.String schemaName,
                                   java.lang.String tableName)
        Parameters:
        schemaName -
        tableName -
      • alterTableColumnIdentityCache

        void alterTableColumnIdentityCache​(java.lang.String schemaName,
                                           java.lang.String objectName,
                                           java.lang.String columnName,
                                           int cache)
        Change the CACHE value of the named identity generated always column
        Parameters:
        schemaName -
        objectName -
        columnName -
        cache -
      • dropIndex

        void dropIndex​(java.lang.String schemaName,
                       java.lang.String indexName)
        Drop the named index
        Parameters:
        schemaName -
        indexName -
      • createView

        void createView​(java.lang.String schemaName,
                        java.lang.String objectName,
                        java.lang.String selectClause)
        Create the view as defined by the selectClause
        Parameters:
        schemaName -
        objectName -
        selectClause -
      • dropView

        void dropView​(java.lang.String schemaName,
                      java.lang.String objectName)
        Drop the view from the database
        Parameters:
        schemaName -
        objectName -
      • createOrReplaceView

        void createOrReplaceView​(java.lang.String schemaName,
                                 java.lang.String objectName,
                                 java.lang.String selectClause)
        Create or replace the view
        Parameters:
        schemaName -
        objectName -
        selectClause -
      • listSchemaObjects

        java.util.List<SchemaInfoObject> listSchemaObjects​(java.lang.String schemaName)
        List the objects present in the given schema
        Parameters:
        schemaName -
        Returns:
      • runStatement

        void runStatement​(IDatabaseStatement statement)
        Run the given statement against the database represented by this adapter
        Parameters:
        statement -