Search in sources :

Example 1 with IfNode

use of org.dbflute.twowaysql.node.IfNode in project dbflute-core by dbflute.

the class DfMailFluteTableLoader method processAutoDetect.

// -----------------------------------------------------
// AutoDetect
// ----------
protected void processAutoDetect(String fileText, Map<String, String> propertyNameTypeMap, Map<String, String> propertyNameOptionMap, Set<String> propertyNameSet) {
    final DfParameterAutoDetectProcess process = new DfParameterAutoDetectProcess() {

        @Override
        protected DfParameterAutoDetectBindNode newParameterAutoDetectBindNode(DfParameterAutoDetectAssist assist) {
            return super.newParameterAutoDetectBindNode(assist).unuseTestValue("String");
        }

        @Override
        protected void processAlternateBooleanMethodIfNode(String sql, IfNode ifNode) {
        // unsupported
        }
    };
    process.processAutoDetect(fileText, propertyNameTypeMap, propertyNameOptionMap, propertyNameSet);
}
Also used : DfParameterAutoDetectAssist(org.dbflute.logic.sql2entity.analyzer.DfParameterAutoDetectAssist) IfNode(org.dbflute.twowaysql.node.IfNode) DfParameterAutoDetectProcess(org.dbflute.logic.sql2entity.analyzer.DfParameterAutoDetectProcess)

Example 2 with IfNode

use of org.dbflute.twowaysql.node.IfNode in project dbflute-core by dbflute.

the class SqlAnalyzer method parseIf.

protected void parseIf() {
    final String comment = _tokenizer.getToken();
    final String condition = comment.substring(IfNode.PREFIX.length()).trim();
    if (Srl.is_Null_or_TrimmedEmpty(condition)) {
        throwIfCommentConditionEmptyException();
    }
    final IfNode ifNode = createIfNode(condition);
    peek().addChild(ifNode);
    push(ifNode);
    parseEnd();
}
Also used : IfNode(org.dbflute.twowaysql.node.IfNode)

Example 3 with IfNode

use of org.dbflute.twowaysql.node.IfNode in project dbflute-core by dbflute.

the class DfParameterAutoDetectProcess method doProcessAutoDetect.

protected void doProcessAutoDetect(String sql, Map<String, String> propertyNameTypeMap, Map<String, String> propertyNameOptionMap, Set<String> autoDetectedPropertyNameSet, Node node) {
    // because simple specification is very important here
    if (node instanceof BindVariableNode) {
        final BindVariableNode bindNode = (BindVariableNode) node;
        processAutoDetectBindNode(sql, propertyNameTypeMap, propertyNameOptionMap, autoDetectedPropertyNameSet, bindNode);
    } else if (node instanceof IfNode) {
        final IfNode ifNode = (IfNode) node;
        processAutoDetectIfNode(sql, propertyNameTypeMap, propertyNameOptionMap, ifNode);
        // process alternate boolean methods, supported with auto-detect
        processAlternateBooleanMethodIfNode(sql, ifNode);
    } else if (node instanceof ForNode) {
        processAutoDetectForNode(sql, propertyNameTypeMap, propertyNameOptionMap, (ForNode) node);
    }
    for (int i = 0; i < node.getChildSize(); i++) {
        final Node childNode = node.getChild(i);
        // recursive call
        doProcessAutoDetect(sql, propertyNameTypeMap, propertyNameOptionMap, autoDetectedPropertyNameSet, childNode);
    }
}
Also used : ForNode(org.dbflute.twowaysql.node.ForNode) IfNode(org.dbflute.twowaysql.node.IfNode) BindVariableNode(org.dbflute.twowaysql.node.BindVariableNode) Node(org.dbflute.twowaysql.node.Node) ForNode(org.dbflute.twowaysql.node.ForNode) IfNode(org.dbflute.twowaysql.node.IfNode) BindVariableNode(org.dbflute.twowaysql.node.BindVariableNode)

Example 4 with IfNode

use of org.dbflute.twowaysql.node.IfNode in project dbflute-core by dbflute.

the class DfPmFileTableLoader method processAutoDetect.

protected void processAutoDetect(String fileText, Map<String, String> propertyNameTypeMap, Map<String, String> propertyNameOptionMap, Set<String> propertyNameSet) {
    final DfParameterAutoDetectProcess process = new DfParameterAutoDetectProcess() {

        @Override
        protected DfParameterAutoDetectBindNode newParameterAutoDetectBindNode(DfParameterAutoDetectAssist assist) {
            return super.newParameterAutoDetectBindNode(assist).unuseTestValue("String");
        }

        @Override
        protected void processAlternateBooleanMethodIfNode(String sql, IfNode ifNode) {
        // unsupported
        }
    };
    process.processAutoDetect(fileText, propertyNameTypeMap, propertyNameOptionMap, propertyNameSet);
}
Also used : DfParameterAutoDetectAssist(org.dbflute.logic.sql2entity.analyzer.DfParameterAutoDetectAssist) IfNode(org.dbflute.twowaysql.node.IfNode) DfParameterAutoDetectProcess(org.dbflute.logic.sql2entity.analyzer.DfParameterAutoDetectProcess)

Example 5 with IfNode

use of org.dbflute.twowaysql.node.IfNode in project dbflute-core by dbflute.

the class SqlAnalyzer method parseElse.

// ===================================================================================
// ELSE Comment
// ============
protected void parseElse() {
    final Node parent = peek();
    if (!(parent instanceof IfNode)) {
        return;
    }
    final IfNode ifNode = (IfNode) pop();
    final ElseNode elseNode = createElseNode();
    ifNode.setElseNode(elseNode);
    push(elseNode);
    _tokenizer.skipWhitespace();
}
Also used : BindVariableNode(org.dbflute.twowaysql.node.BindVariableNode) LoopFirstNode(org.dbflute.twowaysql.node.LoopFirstNode) ForNode(org.dbflute.twowaysql.node.ForNode) BeginNode(org.dbflute.twowaysql.node.BeginNode) SqlPartsNode(org.dbflute.twowaysql.node.SqlPartsNode) EmbeddedVariableNode(org.dbflute.twowaysql.node.EmbeddedVariableNode) SqlConnectorNode(org.dbflute.twowaysql.node.SqlConnectorNode) LoopNextNode(org.dbflute.twowaysql.node.LoopNextNode) ElseNode(org.dbflute.twowaysql.node.ElseNode) LoopLastNode(org.dbflute.twowaysql.node.LoopLastNode) LoopAbstractNode(org.dbflute.twowaysql.node.LoopAbstractNode) RootNode(org.dbflute.twowaysql.node.RootNode) IfNode(org.dbflute.twowaysql.node.IfNode) Node(org.dbflute.twowaysql.node.Node) ElseNode(org.dbflute.twowaysql.node.ElseNode) IfNode(org.dbflute.twowaysql.node.IfNode)

Aggregations

IfNode (org.dbflute.twowaysql.node.IfNode)5 DfParameterAutoDetectAssist (org.dbflute.logic.sql2entity.analyzer.DfParameterAutoDetectAssist)2 DfParameterAutoDetectProcess (org.dbflute.logic.sql2entity.analyzer.DfParameterAutoDetectProcess)2 BindVariableNode (org.dbflute.twowaysql.node.BindVariableNode)2 ForNode (org.dbflute.twowaysql.node.ForNode)2 Node (org.dbflute.twowaysql.node.Node)2 BeginNode (org.dbflute.twowaysql.node.BeginNode)1 ElseNode (org.dbflute.twowaysql.node.ElseNode)1 EmbeddedVariableNode (org.dbflute.twowaysql.node.EmbeddedVariableNode)1 LoopAbstractNode (org.dbflute.twowaysql.node.LoopAbstractNode)1 LoopFirstNode (org.dbflute.twowaysql.node.LoopFirstNode)1 LoopLastNode (org.dbflute.twowaysql.node.LoopLastNode)1 LoopNextNode (org.dbflute.twowaysql.node.LoopNextNode)1 RootNode (org.dbflute.twowaysql.node.RootNode)1 SqlConnectorNode (org.dbflute.twowaysql.node.SqlConnectorNode)1 SqlPartsNode (org.dbflute.twowaysql.node.SqlPartsNode)1