Package org.apache.cayenne.dba

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


            @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(" NOT NULL");

                return Collections.singletonList(sqlBuffer.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(" NULL");

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

        String id = path.getAbsolutePath();

        String correlatedEntityId = path.getId();
        ClassDescriptor correlatedEntityDescriptor = context.getEntityDescriptor(correlatedEntityId);
        String correlatedTableName = quoter.quotedFullyQualifiedName(correlatedEntityDescriptor.getEntity()
                .getDbEntity());
        String correlatedTableAlias = context.getTableAlias(correlatedEntityId, correlatedTableName);

        String subqueryId = context.createIdAlias(id);
        ClassDescriptor targetDescriptor = context.getEntityDescriptor(subqueryId);
View Full Code Here

            context.append(" NOT");
        }

        context.append(" EXISTS (SELECT 1 FROM ");

        String subqueryTableName = quoter.quotedFullyQualifiedName(targetDescriptor.getEntity().getDbEntity());
        String subqueryRootAlias = context.getTableAlias(subqueryId, subqueryTableName);

        ObjRelationship relationship = (ObjRelationship) correlatedEntityDescriptor.getEntity().getRelationship(
                path.getRelativePath());
View Full Code Here

        // joins...
        String id = path.getAbsolutePath();

        String correlatedEntityId = path.getId();
        ClassDescriptor correlatedEntityDescriptor = context.getEntityDescriptor(correlatedEntityId);
        String correlatedTableName = quoter.quotedFullyQualifiedName(correlatedEntityDescriptor.getEntity()
                .getDbEntity());
        String correlatedTableAlias = context.getTableAlias(correlatedEntityId, correlatedTableName);

        String subqueryId = context.createIdAlias(id);
        ClassDescriptor targetDescriptor = context.getEntityDescriptor(subqueryId);
View Full Code Here

            context.append(" NOT");
        }

        context.append(" EXISTS (SELECT 1 FROM ");

        String subqueryTableName = quoter.quotedFullyQualifiedName(targetDescriptor.getEntity().getDbEntity());
        String subqueryRootAlias = context.getTableAlias(subqueryId, subqueryTableName);

        ObjRelationship relationship = (ObjRelationship) correlatedEntityDescriptor.getEntity().getRelationship(
                path.getRelativePath());
View Full Code Here

        List<DbRelationship> dbRelationships = relationship.getDbRelationships();
        // reverse order to get the nearest to the correlated of the direct
        // relation
        for (int i = dbRelationships.size() - 1; i > 0; i--) {
            DbRelationship dbRelationship = dbRelationships.get(i);
            String subqueryTargetTableName = quoter.quotedFullyQualifiedName((DbEntity) dbRelationship
                    .getTargetEntity());
            String subqueryTargetAlias;
            if (i == dbRelationships.size() - 1) {
                subqueryTargetAlias = subqueryRootAlias;
                context.append(subqueryTargetTableName).append(' ').append(subqueryTargetAlias);
View Full Code Here

                subqueryTargetAlias = context.getTableAlias(subqueryTargetTableName, subqueryTargetTableName);
            }

            context.append(" JOIN ");

            String subquerySourceTableName = quoter.quotedFullyQualifiedName((DbEntity) dbRelationship
                    .getSourceEntity());
            String subquerySourceAlias = context.getTableAlias(subquerySourceTableName, subquerySourceTableName);

            context.append(subquerySourceTableName).append(' ').append(subquerySourceAlias);
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

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

    /**
 
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.