Search in sources :

Example 1 with DefaultQuotingAppendable

use of org.apache.cayenne.access.translator.select.DefaultQuotingAppendable in project cayenne by apache.

the class BaseBatchTranslator method doTranslate.

/**
 * This method applies {@link org.apache.cayenne.access.translator.select.BaseSQLTreeProcessor} to the
 * provided SQL tree node and generates SQL string from it.
 *
 * @param nodeBuilder SQL tree node builder
 * @return SQL string
 */
protected String doTranslate(NodeBuilder nodeBuilder) {
    Node node = nodeBuilder.build();
    // convert to database flavour
    node = context.getAdapter().getSqlTreeProcessor().process(node);
    // generate SQL
    SQLGenerationVisitor visitor = new SQLGenerationVisitor(new DefaultQuotingAppendable(context));
    node.visit(visitor);
    bindings = context.getBindings().toArray(new DbAttributeBinding[0]);
    return visitor.getSQLString();
}
Also used : Node(org.apache.cayenne.access.sqlbuilder.sqltree.Node) DbAttributeBinding(org.apache.cayenne.access.translator.DbAttributeBinding) SQLGenerationVisitor(org.apache.cayenne.access.sqlbuilder.SQLGenerationVisitor) DefaultQuotingAppendable(org.apache.cayenne.access.translator.select.DefaultQuotingAppendable)

Aggregations

SQLGenerationVisitor (org.apache.cayenne.access.sqlbuilder.SQLGenerationVisitor)1 Node (org.apache.cayenne.access.sqlbuilder.sqltree.Node)1 DbAttributeBinding (org.apache.cayenne.access.translator.DbAttributeBinding)1 DefaultQuotingAppendable (org.apache.cayenne.access.translator.select.DefaultQuotingAppendable)1