Search in sources :

Example 1 with FunctionInputToken

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

the class StatementProcessor method createPlainText.

/*
   * (non-Javadoc)
   * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
   * IStatementProcessor#createPlainText()
   */
@Override
public String createPlainText() {
    for (IToken t : m_ioTokens) {
        if (t instanceof ValueInputToken) {
            ValueInputToken vt = (ValueInputToken) t;
            if (vt.isPlainSql()) {
            // ok
            } else if (vt.isPlainValue()) {
            // ok
            } else {
                vt.setPlainValue(true);
            }
        } else if (t instanceof FunctionInputToken) {
            FunctionInputToken ft = (FunctionInputToken) t;
            ft.setPlainValue(true);
        }
    }
    if (hasNextInputBatch()) {
        nextInputBatch();
        prepareInputStatementAndBinds();
        resetInputBatch();
    }
    return m_currentInputStm;
}
Also used : IToken(org.eclipse.scout.rt.server.jdbc.parsers.token.IToken) FunctionInputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.FunctionInputToken) ValueInputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueInputToken)

Example 2 with FunctionInputToken

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

the class StatementProcessor method createInput.

private IBindInput createInput(IToken bindToken, Object[] bindBases) {
    if (bindToken instanceof ValueInputToken) {
        final ValueInputToken valueInputToken = (ValueInputToken) bindToken;
        final String[] path = REGEX_DOT.split(valueInputToken.getName());
        IBindInput result = null;
        for (final Object bindBase : bindBases) {
            Class nullType = null;
            if (bindBase instanceof NVPair) {
                nullType = ((NVPair) bindBase).getNullType();
            }
            final IBindInput in = createInputRec(valueInputToken, path, bindBase, nullType);
            if (in != null) {
                // bind found
                if (isBindDuplicateCheckEnabled()) {
                    if (result == null) {
                        // first match found for the bind -> remember
                        result = in;
                    } else {
                        // second match found
                        onDuplicateBind(valueInputToken);
                        return result;
                    }
                } else {
                    // no duplicate check necessary: directly return the first match
                    return in;
                }
            }
        }
        if (result == null) {
            throw new ProcessingException("Cannot find input for '{}' in bind bases.", valueInputToken);
        }
        return result;
    } else if (bindToken instanceof FunctionInputToken) {
        return new FunctionInput(m_callerService, m_bindBases, (FunctionInputToken) bindToken);
    }
    throw new ProcessingException("Cannot find input for {}", bindToken.getClass());
}
Also used : FunctionInputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.FunctionInputToken) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) ValueInputToken(org.eclipse.scout.rt.server.jdbc.parsers.token.ValueInputToken) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Aggregations

FunctionInputToken (org.eclipse.scout.rt.server.jdbc.parsers.token.FunctionInputToken)2 ValueInputToken (org.eclipse.scout.rt.server.jdbc.parsers.token.ValueInputToken)2 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 NVPair (org.eclipse.scout.rt.platform.holders.NVPair)1 IToken (org.eclipse.scout.rt.server.jdbc.parsers.token.IToken)1