public SqlText parseInlineParameterMap(
      TypeHandlerFactory typeHandlerFactory, String sqlStatement, Class parameterClass) {

    String newSql = sqlStatement;

    List mappingList = new ArrayList();

    StringTokenizer parser = new StringTokenizer(sqlStatement, PARAMETER_TOKEN, true);
    StringBuffer newSqlBuffer = new StringBuffer();

    String token = null;
    String lastToken = null;
    while (parser.hasMoreTokens()) {
      token = parser.nextToken();
      if (PARAMETER_TOKEN.equals(lastToken)) {
        if (PARAMETER_TOKEN.equals(token)) {
          newSqlBuffer.append(PARAMETER_TOKEN);
          token = null;
        } else {
          ParameterMapping mapping = null;
          if (token.indexOf(PARAM_DELIM) > -1) {
            mapping = oldParseMapping(token, parameterClass, typeHandlerFactory);
          } else {
            mapping = newParseMapping(token, parameterClass, typeHandlerFactory);
          }

          mappingList.add(mapping);
          newSqlBuffer.append("?");
          boolean hasMoreTokens = parser.hasMoreTokens();
          if (hasMoreTokens) token = parser.nextToken();
          if (!hasMoreTokens || !PARAMETER_TOKEN.equals(token)) {
            throw new SqlMapException(
                "Unterminated inline parameter in mapped statement near '"
                    + newSqlBuffer.toString()
                    + "'");
          }
          token = null;
        }
      } else {
        if (!PARAMETER_TOKEN.equals(token)) {
          newSqlBuffer.append(token);
        }
      }

      lastToken = token;
    }

    newSql = newSqlBuffer.toString();

    ParameterMapping[] mappingArray =
        (ParameterMapping[]) mappingList.toArray(new ParameterMapping[mappingList.size()]);

    SqlText sqlText = new SqlText();
    sqlText.setText(newSql);
    sqlText.setParameterMappings(mappingArray);
    return sqlText;
  }
  public SqlText parseInlineParameterMap(String sqlStatement, Class parameterClass) {

    String newSql;

    List mappingList = new ArrayList();

    StringTokenizer parser = new StringTokenizer(sqlStatement, PARAMETER_TOKEN, true);
    StringBuffer newSqlBuffer = new StringBuffer();

    String token;
    String lastToken = null;
    while (parser.hasMoreTokens()) {
      token = parser.nextToken();
      if (PARAMETER_TOKEN.equals(lastToken)) {
        if (PARAMETER_TOKEN.equals(token)) {
          newSqlBuffer.append(PARAMETER_TOKEN);
          token = null;
        } else {
          ParameterMapping mapping;
          if (token.indexOf(PARAM_DELIM) > -1) {
            mapping = oldParseMapping(token, parameterClass, typeHandlerRegistry);
          } else {
            mapping = newParseMapping(token, parameterClass);
          }

          mappingList.add(mapping);
          newSqlBuffer.append("?");
          token = parser.nextToken();
          if (!PARAMETER_TOKEN.equals(token)) {
            throw new SqlMapException(
                "Unterminated inline parameter in mapped statement (" + "statement.getId()" + ").");
          }
          token = null;
        }
      } else {
        if (!PARAMETER_TOKEN.equals(token)) {
          newSqlBuffer.append(token);
        }
      }

      lastToken = token;
    }
    newSql = newSqlBuffer.toString();

    SqlText sqlText = new SqlText();
    sqlText.setText(newSql);
    sqlText.setParameterMappings(mappingList);
    return sqlText;
  }
  public SqlText parseInlineParameterMap(
      TypeHandlerFactory typeHandlerFactory, String sqlStatement, Class parameterClass) {
    try { // 我加上的
      DEBUG.P(this, "parseInlineParameterMap(3)");
      DEBUG.P("sqlStatement=" + sqlStatement);
      DEBUG.P("parameterClass=" + parameterClass);

      String newSql = sqlStatement;

      List mappingList = new ArrayList();

      // 第三个参数为true,表示把分隔符PARAMETER_TOKEN("#")也返回
      StringTokenizer parser = new StringTokenizer(sqlStatement, PARAMETER_TOKEN, true);
      StringBuffer newSqlBuffer = new StringBuffer();

      String token = null;
      String lastToken = null;
      while (parser.hasMoreTokens()) {
        token = parser.nextToken();

        DEBUG.P("lastToken=" + lastToken);
        DEBUG.P("token=" + token);

        if (PARAMETER_TOKEN.equals(lastToken)) {
          if (PARAMETER_TOKEN.equals(token)) {
            // 连续的两个#代表一个"#"字符
            // 如:select * from ACCOUNT where ACC_FIRST_NAME = "##"
            // 实际是: select * from ACCOUNT where ACC_FIRST_NAME = "#"
            newSqlBuffer.append(PARAMETER_TOKEN);
            token = null;
          } else {
            ParameterMapping mapping = null;
            if (token.indexOf(PARAM_DELIM) > -1) {
              mapping = oldParseMapping(token, parameterClass, typeHandlerFactory);
            } else {
              mapping = newParseMapping(token, parameterClass, typeHandlerFactory);
            }

            mappingList.add(mapping);
            newSqlBuffer.append("?");
            token = parser.nextToken();

            DEBUG.P("token2=" + token);
            if (!PARAMETER_TOKEN.equals(token)) {
              throw new SqlMapException(
                  "Unterminated inline parameter in mapped statement ("
                      + "statement.getId()"
                      + ").");
            }
            token = null;
          }
        } else {
          if (!PARAMETER_TOKEN.equals(token)) {
            newSqlBuffer.append(token);
          }
        }

        lastToken = token;
      }

      newSql = newSqlBuffer.toString();

      DEBUG.P(1);

      DEBUG.P("newSql=" + newSql);

      ParameterMapping[] mappingArray =
          (ParameterMapping[]) mappingList.toArray(new ParameterMapping[mappingList.size()]);

      DEBUG.PA("mappingArray", mappingArray);

      SqlText sqlText = new SqlText();
      sqlText.setText(newSql);
      sqlText.setParameterMappings(mappingArray);
      return sqlText;

    } finally { // 我加上的
      DEBUG.P(0, this, "parseInlineParameterMap(3)");
    }
  }