Beispiel #1
0
  /**
   * Auto-parameterize all of the literals in the parsed SQL statement.
   *
   * @return An opaque token representing the parsed statement with (possibly) parameterization.
   */
  public String parameterize() {
    m_paramzInfo = ParameterizationInfo.parameterize(m_xmlSQL);

    Set<Integer> paramIds = new HashSet<Integer>();
    ParameterizationInfo.findUserParametersRecursively(m_xmlSQL, paramIds);
    m_adhocUserParamsCount = paramIds.size();

    // skip plans with pre-existing parameters and plans that don't parameterize
    // assume a user knows how to cache/optimize these
    if (m_paramzInfo != null) {
      // if requested output the second version of the parsed plan
      m_planSelector.outputParameterizedCompiledStatement(m_paramzInfo.parameterizedXmlSQL);
      return m_paramzInfo.parameterizedXmlSQL.toMinString();
    }

    // fallback when parameterization is
    return m_xmlSQL.toMinString();
  }
Beispiel #2
0
  public boolean extractParamValues(ParameterizationInfo paramzInfo) throws Exception {
    VoltType[] paramTypes = parameterTypes();
    if (paramTypes.length > MAX_PARAM_COUNT) {
      return false;
    }
    if (paramzInfo.paramLiteralValues != null) {
      m_generatedParameterCount = paramzInfo.paramLiteralValues.length;
    }

    m_extractedParamValues = paramzInfo.extractedParamValues(paramTypes);
    return true;
  }
Beispiel #3
0
 public ParameterSet extractedParamValues(VoltType[] parameterTypes) throws Exception {
   if (m_paramzInfo == null) {
     return null;
   }
   return m_paramzInfo.extractedParamValues(parameterTypes);
 }