Package org.apache.cayenne.dba

Examples of org.apache.cayenne.dba.QuotingStrategy.quotedFullyQualifiedName()


     */
    @Override
    public Collection<String> dropTableStatements(DbEntity table) {
        QuotingStrategy context = getQuotingStrategy();
        StringBuffer buf = new StringBuffer("DROP TABLE ");
        buf.append(context.quotedFullyQualifiedName(table));

        buf.append(" CASCADE CONSTRAINTS");
        return Collections.singleton(buf.toString());
    }

View Full Code Here


            @Override
            public List<String> createSql(DbAdapter adapter) {
                StringBuilder sqlBuffer = new StringBuilder();
                QuotingStrategy context = adapter.getQuotingStrategy();
                sqlBuffer.append("ALTER TABLE ");
                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                sqlBuffer.append(" ALTER COLUMN ");
                sqlBuffer.append(context.quotedName(getColumn()));
                sqlBuffer.append(" ");
                sqlBuffer.append(adapter.externalTypesForJdbcType(getColumn().getType())[0]);
View Full Code Here

        List<DbAttribute> dbAttributes = batch.getDbAttributes();

        QuotingStrategy strategy = getAdapter().getQuotingStrategy();

        StringBuffer query = new StringBuffer("INSERT INTO ");
        query.append(strategy.quotedFullyQualifiedName(batch.getDbEntity()));
        query.append(" (");

        for (Iterator<DbAttribute> i = dbAttributes.iterator(); i.hasNext();) {
            DbAttribute attribute = i.next();
            query.append(strategy.quotedName(attribute));
View Full Code Here

            QuotingStrategy strategy = adapter.getQuotingStrategy();

            for (String constraint : constraints) {
                StringBuilder drop = new StringBuilder();

                drop.append("ALTER TABLE ").append(strategy.quotedFullyQualifiedName(entity))
                        .append(" DROP CONSTRAINT ").append(constraint);
                executeDDL(conn, drop.toString());
            }
        }
    }
View Full Code Here

    public String createSqlString(BatchQuery batch) throws IOException {

        QuotingStrategy strategy = getAdapter().getQuotingStrategy();

        StringBuffer query = new StringBuffer("DELETE FROM ");
        query.append(strategy.quotedFullyQualifiedName(batch.getDbEntity()));

        applyQualifier(query, batch);

        return query.toString();
    }
View Full Code Here

    
        QuotingStrategy context = getQuotingStrategy();

        StringBuilder buf = new StringBuilder();
        buf.append("CREATE TABLE ");
        buf.append(context.quotedFullyQualifiedName(ent));

        buf.append(" (");

        // columns
        Iterator<DbAttribute> it = ent.getAttributes().iterator();
View Full Code Here

        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();

        QuotingStrategy strategy = getAdapter().getQuotingStrategy();

        StringBuffer query = new StringBuffer("UPDATE ");
        query.append(strategy.quotedFullyQualifiedName(batch.getDbEntity()));
        query.append(" SET ");

        int len = updatedDbAttributes.size();
        for (int i = 0; i < len; i++) {
            if (i > 0) {
View Full Code Here

            public List<String> createSql(DbAdapter adapter) {

                StringBuffer sqlBuffer = new StringBuffer();
                QuotingStrategy context = adapter.getQuotingStrategy();
                sqlBuffer.append("ALTER TABLE ");
                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                sqlBuffer.append(" ADD ");
                boolean magnatory = column.isMandatory();
                column.setMandatory(false);
                adapter.createTableAppendColumn(sqlBuffer, column);
                if(magnatory){
View Full Code Here

            @Override
            public List<String> createSql(DbAdapter adapter) {
                StringBuilder sqlBuffer = new StringBuilder();
                QuotingStrategy context = adapter.getQuotingStrategy();
                sqlBuffer.append("ALTER TABLE ");
                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                sqlBuffer.append(" DROP ");
                sqlBuffer.append(context.quotedName(getColumn()));

                return Collections.singletonList(sqlBuffer.toString());
            }
View Full Code Here

            DbEntity entity,
            DbAttribute column) {
        StringBuffer sqlBuffer = new StringBuffer();
        QuotingStrategy context = adapter.getQuotingStrategy();
        sqlBuffer.append("ALTER TABLE ");
        sqlBuffer.append(context.quotedFullyQualifiedName(entity));
        sqlBuffer.append(" MODIFY ");
        adapter.createTableAppendColumn(sqlBuffer, column);

        return sqlBuffer;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.