Search in sources :

Example 1 with ValueOutputToken

use of org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken in project scout.rt by eclipse.

the class IntoParser method parseStdBind.

private boolean parseStdBind() {
    if (LOG.isTraceEnabled()) {
        trace("parseStdBind");
    }
    int index = m_pos.getIndex();
    if (matches(":") && parseName()) {
        addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex()), true));
        return true;
    }
    m_pos.setIndex(index);
    return false;
}
Also used : ValueOutputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken)

Example 2 with ValueOutputToken

use of org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken in project scout.rt by eclipse.

the class StatementProcessor method createOutput.

@SuppressWarnings("bsiRulesDefinition:htmlInString")
private IBindOutput createOutput(IToken bindToken, Object[] bindBases) {
    if (bindToken instanceof ValueOutputToken) {
        IBindOutput result = null;
        ValueOutputToken valueOutputToken = (ValueOutputToken) bindToken;
        String[] path = REGEX_DOT.split(valueOutputToken.getName());
        for (int i = 0; i < bindBases.length; i++) {
            IBindOutput out = createOutputRec(valueOutputToken, path, bindBases[i]);
            if (out != null) {
                if (isBindDuplicateCheckEnabled()) {
                    if (result == null) {
                        // first match found for the bind -> remember
                        result = out;
                    } else {
                        // second match found
                        onDuplicateBind(valueOutputToken);
                        return result;
                    }
                } else {
                    // no duplicate check necessary: directly return the first match
                    return out;
                }
            }
        }
        if (result == null) {
            throw new ProcessingException("Cannot find output for '{}' in bind base. When selecting into shared context variables make sure these variables are initialized using CONTEXT.set<i>PropertyName</i>(null)", valueOutputToken);
        }
        return result;
    }
    throw new ProcessingException("Cannot find output for {}", bindToken.getClass());
}
Also used : ValueOutputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Example 3 with ValueOutputToken

use of org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken in project scout.rt by eclipse.

the class IntoParser method parse.

public IntoModel parse() {
    m_pos = new ParsePosition(0);
    parseStatement();
    addTextUntil(m_str.length());
    if (m_pos.getIndex() < m_str.length()) {
        LOG.warn("statement not fully parsed (index {}): {}", m_pos.getIndex(), m_str);
    }
    return new IntoModel(m_filteredText.toString(), m_intoList.toArray(new ValueOutputToken[0]));
}
Also used : ValueOutputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken) ParsePosition(java.text.ParsePosition)

Example 4 with ValueOutputToken

use of org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken in project scout.rt by eclipse.

the class IntoParser method parsePlainBind.

private boolean parsePlainBind() {
    if (LOG.isTraceEnabled()) {
        trace("parsePlainBind");
    }
    int index = m_pos.getIndex();
    if (matches("&") && parseName() && matches("&")) {
        addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex() - 1), true));
        return true;
    }
    m_pos.setIndex(index);
    return false;
}
Also used : ValueOutputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken)

Example 5 with ValueOutputToken

use of org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken in project scout.rt by eclipse.

the class IntoParser method parseHashBind.

private boolean parseHashBind() {
    if (LOG.isTraceEnabled()) {
        trace("parseHashBind");
    }
    int index = m_pos.getIndex();
    if (matches("#") && parseName() && matches("#")) {
        addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex() - 1), true));
        return true;
    }
    m_pos.setIndex(index);
    return false;
}
Also used : ValueOutputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken)

Aggregations

ValueOutputToken (org.eclipse.scout.rt.server.jdbc.parsers.token.ValueOutputToken)6 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 ParsePosition (java.text.ParsePosition)1 ArrayList (java.util.ArrayList)1 AbstractSqlService (org.eclipse.scout.rt.server.jdbc.AbstractSqlService)1 IToken (org.eclipse.scout.rt.server.jdbc.parsers.token.IToken)1 ValueInputToken (org.eclipse.scout.rt.server.jdbc.parsers.token.ValueInputToken)1