Package org.apache.ddlutils.model

Examples of org.apache.ddlutils.model.Table


        catch (CloneNotSupportedException ex)
        {
            throw new DdlUtilsException(ex);
        }

        Table table = database.findTable(getChangedTable().getName(), caseSensitive);

        if ((_previousColumn != null) && (_nextColumn != null))
        {
            int idx = table.getColumnIndex(_previousColumn) + 1;

            table.addColumn(idx, newColumn);
        }
        else
        {
            table.addColumn(newColumn);
        }
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void apply(Database database, boolean caseSensitive)
    {
        Table table = database.findTable(getChangedTable().getName(), caseSensitive);

        table.removeForeignKey(_foreignKey);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void apply(Database database, boolean caseSensitive)
    {
        Table table = database.findTable(getChangedTable().getName(), caseSensitive);

        database.removeTable(table);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void apply(Database database, boolean caseSensitive)
    {
        Table table = database.findTable(getChangedTable().getName(), caseSensitive);

        for (int idx = 0; idx < _primaryKeyColumns.length; idx++)
        {
            Column column = table.findColumn(_primaryKeyColumns[idx].getName(), caseSensitive);

            column.setPrimaryKey(true);
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void apply(Database database, boolean caseSensitive)
    {
        Table  table  = database.findTable(getChangedTable().getName(), caseSensitive);
        Column column = table.findColumn(_column.getName(), caseSensitive);

        column.setDefaultValue(_newDefaultValue);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void apply(Database database, boolean caseSensitive)
    {
        Table table = database.findTable(getChangedTable().getName(), caseSensitive);

        for (int idx = 0; idx < _oldPrimaryKeyColumns.length; idx++)
        {
            Column column = table.findColumn(_oldPrimaryKeyColumns[idx].getName(), caseSensitive);

            column.setPrimaryKey(false);
        }
        for (int idx = 0; idx < _newPrimaryKeyColumns.length; idx++)
        {
            Column column = table.findColumn(_newPrimaryKeyColumns[idx].getName(), caseSensitive);

            column.setPrimaryKey(true);
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void apply(Database database, boolean caseSensitive)
    {
        Table  table  = database.findTable(getChangedTable().getName(), caseSensitive);
        Column column = table.findColumn(_column.getName(), caseSensitive);

        column.setSizeAndScale(_newSize, _newScale);
    }
View Full Code Here

        printlnIdentifier(getTableName(change.getChangedTable()));
        printIndent();
        print("COLUMN ");
        printIdentifier(getColumnName(change.getChangedColumn()));

        Table   curTable   = currentModel.findTable(change.getChangedTable().getName(), getPlatform().isDelimitedIdentifierModeOn());
        Column  curColumn  = curTable.findColumn(change.getChangedColumn().getName(), getPlatform().isDelimitedIdentifierModeOn());
        boolean hasDefault = curColumn.getParsedDefaultValue() != null;

        if (isValidDefaultValue(change.getNewDefaultValue(), curColumn.getTypeCode()))
        {
            if (hasDefault)
View Full Code Here

     * @param bean The bean to write
     */
    public void write(SqlDynaBean bean) throws DataWriterException
    {
        SqlDynaClass dynaClass   = (SqlDynaClass)bean.getDynaClass();
        Table        table       = dynaClass.getTable();
        HashMap      subElements = new HashMap();

        try
        {
            indentIfPrettyPrinting(1);
            _writer.writeStartElement(table.getName());
            for (int idx = 0; idx < table.getColumnCount(); idx++)
            {
                Column           column      = table.getColumn(idx);
                Object           value       = bean.get(column.getName());
                SqlTypeConverter converter   = _converterConf.getRegisteredConverter(table, column);
                String           valueAsText = null;

                if (converter == null)
View Full Code Here

    {
        _platform = platform;
        _model    = model;
        for (int tableIdx = 0; tableIdx < model.getTableCount(); tableIdx++)
        {
            Table      table     = model.getTable(tableIdx);
            ForeignKey selfRefFk = table.getSelfReferencingForeignKey();

            if (selfRefFk != null)
            {
                Column[] pkColumns = table.getPrimaryKeyColumns();

                for (int idx = 0; idx < pkColumns.length; idx++)
                {
                    if (pkColumns[idx].isAutoIncrement())
                    {
View Full Code Here

TOP

Related Classes of org.apache.ddlutils.model.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.