Example usage for org.apache.commons.lang StringUtils indexOfIgnoreCase

List of usage examples for org.apache.commons.lang StringUtils indexOfIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils indexOfIgnoreCase.

Prototype

public static int indexOfIgnoreCase(String str, String searchStr) 

Source Link

Document

Case in-sensitive find of the first index within a String.

Usage

From source file:ips1ap101.lib.core.db.util.VistaFuncionWrapper.java

private String from(String select) {
    int i = StringUtils.indexOfIgnoreCase(select, " FROM ");
    if (i < 0) {
        return null;
    }/*from   w w  w .j  ava  2s .  c o  m*/
    int j = StringUtils.indexOfIgnoreCase(select, " WHERE ");
    if (j < 0) {
        j = StringUtils.indexOfIgnoreCase(select, " GROUP BY ");
    }
    if (j < 0) {
        j = StringUtils.indexOfIgnoreCase(select, " ORDER BY ");
    }
    if (j < 0) {
        j = select.length();
    }
    if (j < i) {
        return null;
    }
    String substring = select.substring(i, j);
    return substring;
}

From source file:ips1ap101.lib.core.db.util.VistaFuncionWrapper.java

private String where(String select) {
    int i = StringUtils.indexOfIgnoreCase(select, " WHERE ");
    if (i < 0) {
        return null;
    }/*  ww  w  .j av  a  2s. co m*/
    int j = StringUtils.indexOfIgnoreCase(select, " GROUP BY ");
    if (j < 0) {
        j = StringUtils.indexOfIgnoreCase(select, " ORDER BY ");
    }
    if (j < 0) {
        j = select.length();
    }
    if (j < i) {
        return null;
    }
    String substring = select.substring(i, j);
    return substring;
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

private void parseSQLUpdate() {
    // update?SQL auto review,???tablename,?where???
    // update??select
    logger.debug("SQL at parsing:" + this.sql);
    int addr_where = 0;
    int loop = 0;
    tablename = "";
    int i = 0;//  w  w  w  . j  ava2s  .  co  m

    // 
    if (i + 6 < sql.length() && sql.substring(0, 6).equalsIgnoreCase("update"))
        i = i + 6;
    else {
        this.errmsg = "not update SQL statement.";
        return;
    }

    // ,?
    while (i + 1 < sql.length() && sql.substring(i, i + 1).equalsIgnoreCase(" "))
        i++;

    // ,tablename
    while (i + 1 < sql.length() && !sql.substring(i, i + 1).equalsIgnoreCase(" ")) {
        tablename = tablename + sql.substring(i, i + 1);
        i++;
    }

    logger.debug("table name:" + this.tablename);
    int addrSet = StringUtils.indexOfIgnoreCase(sql, " set ");
    if (addrSet < 0) {
        this.errmsg = "not find set key word.";
        logger.warn(this.errmsg);
        return;
    }
    // check where key word
    addr_where = StringUtils.indexOfIgnoreCase(sql, " where");
    if (addr_where < 0) {
        this.errmsg = "not find where key word.";
        logger.warn(this.errmsg);
        return;
    }

    analyzeUpdateSetColumns(sql.substring(addrSet + 5, addr_where));

    // values?sysdate(),??
    if (StringUtils.indexOfIgnoreCase(sql, "sysdate()", i) > 0
            && StringUtils.indexOfIgnoreCase(sql, "sysdate()", i) < addr_where) {
        errmsg = "use sysdate() function,this not allowed,you should use now() replace it.";
        logger.warn(errmsg);
        return;
    }

    if (addr_where + 6 >= sql.length()) {
        this.errmsg = "not find where condition.";
        logger.warn(this.errmsg);
        return;
    }

    int addrOderBy = StringUtils.indexOfIgnoreCase(sql, "order by");
    int addrLimit = StringUtils.indexOfIgnoreCase(sql, " limit ");
    String whereStr;
    if (addrOderBy > 0) {
        whereStr = sql.substring(addr_where + 6, addrOderBy);
    } else if (addrLimit > 0) {
        whereStr = sql.substring(addr_where + 6, addrLimit);
    } else {
        whereStr = sql.substring(addr_where + 6);
    }

    whereNode = parseWhere(null, whereStr.trim(), loop);

    // check whereNode tree
    checkWhereTreeRootNode(whereNode);

    analyzeOrderByStr();
    logger.debug("where condition:" + whereStr);
}

From source file:com.google.gdt.eclipse.designer.wizards.model.mvp.ViewComposite.java

/**
 * Generate possible variants package name templates.
 */// w  w w .j a v  a 2 s . com
private static List<String> generatePackageNameTemplates(String packageName, String rootSourcePackageName) {
    // initial names as sub-packages 
    List<String> templatePackageNames = Lists.newArrayList(packageName + ".%keyName%");
    // generate names as 'view'-template
    {
        final String[] searchingViewsTemplates = new String[] { ".view", ".views", ".ui", ".uis" };
        String subPath = StringUtils.replace(packageName, rootSourcePackageName, "");
        for (String searchingViewTemplate : searchingViewsTemplates) {
            if (StringUtils.indexOfIgnoreCase(subPath, searchingViewTemplate) != -1) {
                templatePackageNames.add(rootSourcePackageName
                        + StringUtils.replaceOnce(subPath, searchingViewTemplate, ".%keyName%"));
            }
        }
    }
    // generate names in parent 
    {
        String parentPackageName = CodeUtils.getPackage(packageName);
        while (parentPackageName.length() >= rootSourcePackageName.length()) {
            templatePackageNames.add(parentPackageName + ".%keyName%");
            parentPackageName = CodeUtils.getPackage(parentPackageName);
        }
    }
    return templatePackageNames;
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

private void parseSQLSelect() {
    // where word check
    if (StringUtils.indexOfIgnoreCase(sql, " where ") < 0) {
        this.errmsg = "don't have where!";
        return;/*from   ww  w  .  j a  v a2  s  .  c  o  m*/
    }
    // and word check
    if (getNextToken(sql, StringUtils.indexOfIgnoreCase(sql, " where ") + 7).equalsIgnoreCase("and")) {
        this.errmsg = "and after where,syntax error";
        return;
    }
    // &gt; &lt;SQLMAP??
    if (StringUtils.indexOfIgnoreCase(sql, "&gt;") > 0 || StringUtils.indexOfIgnoreCase(sql, "&lt;") > 0) {
        this.errmsg = "error in < and > , syntax error";
        return;
    }

    // join????
    if (StringUtils.indexOfIgnoreCase(sql, " join ") > 0 && StringUtils.indexOfIgnoreCase(sql, " on ") > 0) {
        this.errmsg = "join or left join or right join is not supported now.";
        return;
    }

    // ?SQL?
    if (StringUtils.indexOfIgnoreCase(sql, ".") < 0) {
        parseSQLSelectBase();
        return;
    }

    // select,??
    if (StringUtils.indexOfIgnoreCase(sql, "select ", 7) > 0) {
        this.errmsg = "don't support multi-select.";
        return;
    }

    // ????
    int is_mutiple_table = checkMutipleTable(sql);
    // ??db.tablename
    if (is_mutiple_table == 0) {
        parseSQLSelectBase();
        return;
    }
    // ???
    if (is_mutiple_table == 1) {
        parseSQLSelectBase();
        return;
    }
    // ?
    if (is_mutiple_table == 2) {
        this.tag = 1;
        return;
    }

    this.errmsg = "don't support this select";
    return;
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

private int checkMutipleTable(String sql) {
    int addr;//from  ww w .  jav  a 2  s.c  om
    int length = sql.length();
    int i;
    int start;
    boolean is_find_as = false;
    String alias_name = "";
    addr = StringUtils.indexOfIgnoreCase(sql, " from ");
    if (addr < 0)
        return -1;
    i = addr + 6;
    // space
    while (i + 1 < length && sql.substring(i, i + 1).equalsIgnoreCase(" "))
        i++;
    // table name
    while (i + 1 < length && !sql.substring(i, i + 1).equalsIgnoreCase(" "))
        i++;
    // space
    while (i + 1 < length && sql.substring(i, i + 1).equalsIgnoreCase(" "))
        i++;
    // tablename as t1?
    if (i + 3 < sql.length() && sql.substring(i, i + 3).equalsIgnoreCase("as ")) {
        i = i + 3;
        is_find_as = true;
    }
    // token=where?
    start = i;
    while (i + 1 < length && !sql.substring(i, i + 1).equalsIgnoreCase(" ")
            && !sql.substring(i, i + 1).equalsIgnoreCase(","))
        i++;
    alias_name = sql.substring(start, i).trim();
    if (alias_name.equalsIgnoreCase("where")) {
        return 0;
    } else {
        // ??,?
        while (i + 1 < length && sql.substring(i, i + 1).equalsIgnoreCase(" "))
            i++;
        if (sql.substring(i, i + 1).equalsIgnoreCase(",")) {
            logger.debug("mutiple tables,this is not support now.");
            return 2;
        }
        // ???,??
        logger.debug("alias name:" + alias_name);
        this.sql = this.sql.replace(" " + alias_name + " ", " ");
        alias_name = alias_name + ".";
        this.sql = this.sql.replace(alias_name, "");
        if (is_find_as == true) {
            this.sql = this.sql.replace(" as ", " ");
        }

        return 1;
    }

}

From source file:io.vitess.jdbc.VitessMySQLDatabaseMetadata.java

@SuppressWarnings("StringBufferReplaceableByString")
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern,
        String columnNamePattern) throws SQLException {
    ResultSet resultSet = null;//from www.j  a v a2 s  .  c  o m
    VitessStatement vitessStatement = new VitessStatement(this.connection);
    ArrayList<ArrayList<String>> data = new ArrayList<>();
    //Null Matches All
    if (null == columnNamePattern) {
        columnNamePattern = "%";
    }
    if (null == catalog || catalog.length() == 0) {
        catalog = this.connection.getCatalog();
    }
    try {
        ArrayList<String> tableList = new ArrayList<>();
        ResultSet tables = null;
        if (null == tableNamePattern) {
            try {
                tables = getTables(catalog, schemaPattern, "%", new String[0]);
                while (tables.next()) {
                    String tableName = tables.getString("TABLE_NAME");
                    tableList.add(tableName);
                }
            } finally {
                if (null != tables) {
                    tables.close();
                }
            }
        } else {
            try {
                tables = getTables(catalog, schemaPattern, tableNamePattern, new String[0]);
                while (tables.next()) {
                    String tableName = tables.getString("TABLE_NAME");
                    tableList.add(tableName);
                }
            } finally {
                if (null != tables) {
                    tables.close();
                }
            }
        }
        for (String tableName : tableList) {
            resultSet = null;
            try {

                // Return correct ordinals if column name pattern is not '%'
                // Currently, MySQL doesn't show enough data to do this, so we do it the 'hard' way...Once
                // _SYSTEM tables are in, this should be
                // much easier
                boolean fixUpOrdinalsRequired = false;
                Map<String, Integer> ordinalFixUpMap = null;
                if (!columnNamePattern.equals("%")) {
                    fixUpOrdinalsRequired = true;
                    vitessStatement = new VitessStatement(this.connection);
                    resultSet = vitessStatement.executeQuery("SHOW FULL COLUMNS FROM " + this.quotedId
                            + tableName + this.quotedId + " FROM " + this.quotedId + catalog + this.quotedId);
                    ordinalFixUpMap = new HashMap<>();

                    int fullOrdinalPos = 1;
                    while (resultSet.next()) {
                        String fullOrdColName = resultSet.getString("Field");
                        ordinalFixUpMap.put(fullOrdColName, fullOrdinalPos++);
                    }
                }
                resultSet = vitessStatement.executeQuery("SHOW FULL COLUMNS FROM " + this.quotedId + tableName
                        + this.quotedId + " FROM " + this.quotedId + catalog + this.quotedId + " LIKE "
                        + Constants.LITERAL_SINGLE_QUOTE + columnNamePattern + Constants.LITERAL_SINGLE_QUOTE);
                int ordPos = 1;

                while (resultSet.next()) {
                    ArrayList<String> row = new ArrayList<>();
                    row.add(0, catalog);
                    row.add(1, null);
                    row.add(2, tableName);
                    row.add(3, resultSet.getString("Field"));
                    TypeDescriptor typeDesc = new TypeDescriptor(resultSet.getString("Type"),
                            resultSet.getString("Null"));

                    row.add(4, Short.toString(typeDesc.dataType));

                    // DATA_TYPE (jdbc)
                    row.add(5, typeDesc.typeName); // TYPE_NAME
                    // (native)
                    if (null == typeDesc.columnSize) {
                        row.add(6, null);
                    } else {
                        String collation = resultSet.getString("Collation");
                        int mbminlen = 1;
                        if (collation != null
                                && ("TEXT".equals(typeDesc.typeName) || "TINYTEXT".equals(typeDesc.typeName)
                                        || "MEDIUMTEXT".equals(typeDesc.typeName))) {
                            if (collation.indexOf("ucs2") > -1 || collation.indexOf("utf16") > -1) {
                                mbminlen = 2;
                            } else if (collation.indexOf("utf32") > -1) {
                                mbminlen = 4;
                            }
                        }
                        row.add(6, mbminlen == 1 ? typeDesc.columnSize.toString()
                                : Integer.toString(typeDesc.columnSize / mbminlen));
                    }
                    row.add(7, Integer.toString(typeDesc.bufferLength));
                    row.add(8, typeDesc.decimalDigits == null ? null : typeDesc.decimalDigits.toString());
                    row.add(9, Integer.toString(typeDesc.numPrecRadix));
                    row.add(10, Integer.toString(typeDesc.nullability));

                    //
                    // Doesn't always have this field, depending on version
                    //
                    //
                    // REMARK column
                    //
                    row.add(11, "Comment");

                    // COLUMN_DEF
                    row.add(12, resultSet.getString("Default") == null ? null : resultSet.getString("Default"));

                    row.add(13, Integer.toString(0));// SQL_DATA_TYPE
                    row.add(14, Integer.toString(0));// SQL_DATE_TIME_SUB

                    if (StringUtils.indexOfIgnoreCase(typeDesc.typeName, "CHAR") != -1
                            || StringUtils.indexOfIgnoreCase(typeDesc.typeName, "BLOB") != -1
                            || StringUtils.indexOfIgnoreCase(typeDesc.typeName, "TEXT") != -1
                            || StringUtils.indexOfIgnoreCase(typeDesc.typeName, "BINARY") != -1) {
                        row.add(15, row.get(6)); // CHAR_OCTET_LENGTH
                    } else {
                        row.add(15, Integer.toString(0));
                    }

                    // ORDINAL_POSITION
                    if (!fixUpOrdinalsRequired) {
                        row.add(16, Integer.toString(ordPos++));
                    } else {
                        String origColName = resultSet.getString("Field");
                        Integer realOrdinal = ordinalFixUpMap.get(origColName);

                        if (realOrdinal != null) {
                            row.add(16, realOrdinal.toString());
                        } else {
                            throw new SQLException(
                                    "Can not find column in full column list to determine true ordinal position.");
                        }
                    }

                    row.add(17, typeDesc.isNullable);

                    // We don't support REF or DISTINCT types
                    row.add(18, null);
                    row.add(19, null);
                    row.add(20, null);
                    row.add(21, null);
                    String extra = resultSet.getString("Extra");
                    if (null != extra) {
                        row.add(22,
                                StringUtils.indexOfIgnoreCase(extra, "auto_increment") != -1 ? "YES" : "NO");
                        row.add(23, StringUtils.indexOfIgnoreCase(extra, "generated") != -1 ? "YES" : "NO");
                    }
                    data.add(row);
                }
            } finally {
                if (null != resultSet) {
                    resultSet.close();
                }
            }
        }
    } finally {
        if (null != resultSet) {
            resultSet.close();
        }
        vitessStatement.close();
    }

    String[] columnNames = new String[] { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE",
            "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE",
            "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
            "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE",
            "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "IS_GENERATEDCOLUMN" };

    Query.Type[] columnType = new Query.Type[] { Query.Type.CHAR, Query.Type.CHAR, Query.Type.CHAR,
            Query.Type.CHAR, Query.Type.INT32, Query.Type.CHAR, Query.Type.INT32, Query.Type.INT32,
            Query.Type.INT32, Query.Type.INT32, Query.Type.INT32, Query.Type.CHAR, Query.Type.CHAR,
            Query.Type.INT32, Query.Type.INT32, Query.Type.INT32, Query.Type.INT32, Query.Type.CHAR,
            Query.Type.CHAR, Query.Type.CHAR, Query.Type.CHAR, Query.Type.INT16, Query.Type.CHAR,
            Query.Type.CHAR };

    return new VitessResultSet(columnNames, columnType, data, this.connection);
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

private void parseSQLSelectBase() {
    int i = 0, tmp = 0;
    int addr_from;
    int addr_where;
    int addr_group_by;
    int addr_order_by;
    int addr_limit;
    String wherestr = "";
    int loop = 0;

    logger.debug("SQL at parsing:" + sql);

    // select//from  w  ww  . j  a  v  a  2s .com
    if (i + 6 < sql.length() && sql.substring(0, 6).equalsIgnoreCase("select")) {
        i = i + 6;
    } else {
        this.errmsg = "not select SQL statement.";
        return;
    }

    // ??
    addr_from = StringUtils.indexOfIgnoreCase(sql, " from ");
    if (addr_from == -1) {
        this.errmsg = "not find from key word.";
        return;
    }
    this.select_column = sql.substring(i, addr_from).trim();
    selectColumnCheckValid(this.select_column);
    // ?????
    addToColumnHashMap(this.select_column, this.columns);

    logger.debug("select columns:" + this.select_column);

    // ?table name
    i = addr_from + 6;
    addr_where = StringUtils.indexOfIgnoreCase(sql, " where ", i);
    if (addr_where == -1) {
        this.errmsg = "don't have where!";
        return;
    }

    this.tablename = sql.substring(i, addr_where);

    logger.debug("table name:" + this.tablename);

    // ?where?
    i = addr_where + 7;
    addr_group_by = StringUtils.indexOfIgnoreCase(sql, "group by");
    addr_order_by = StringUtils.indexOfIgnoreCase(sql, "order by");
    addr_limit = StringUtils.indexOfIgnoreCase(sql, "limit ");

    if (addr_group_by < 0 && addr_order_by < 0 && addr_limit < 0) {
        wherestr = sql.substring(i);
    } else {
        for (tmp = i; tmp < sql.length() - 8; tmp++) {
            if (!sql.substring(tmp, tmp + 8).equalsIgnoreCase("group by")
                    && !sql.substring(tmp, tmp + 8).equalsIgnoreCase("order by")
                    && !sql.substring(tmp, tmp + 6).equalsIgnoreCase("limit "))
                wherestr = wherestr + sql.substring(tmp, tmp + 1);
            else {
                break;
            }
        }
    }
    // ?where string
    int wherestr_len = wherestr.length();
    wherestr = handleBetweenAnd(wherestr);
    this.whereNode = this.parseWhere(null, wherestr, loop);

    // check whereNode tree
    checkWhereTreeRootNode(whereNode);

    logger.debug("where condition:" + wherestr);

    // ??,?handleBetweenAnd??wherestr
    i = i + wherestr_len;
    if (i < sql.length()) {
        if (sql.substring(i, i + 8).equalsIgnoreCase("group by")) {
            // ????,order by,??
            // group by,??having
            if (StringUtils.indexOfIgnoreCase(sql, "having", i + 8) > 0) {
                this.groupbycolumn = sql.substring(i + 8, StringUtils.indexOfIgnoreCase(sql, "having", i + 7))
                        .trim();
            } else if (StringUtils.indexOfIgnoreCase(sql, "order by", i + 8) > 0) {
                this.groupbycolumn = sql.substring(i + 8, StringUtils.indexOfIgnoreCase(sql, "order by", i + 8))
                        .trim();

            } else if (StringUtils.indexOfIgnoreCase(sql, "limit", i + 8) > 0) {
                this.groupbycolumn = sql.substring(i + 8, StringUtils.indexOfIgnoreCase(sql, "limit", i + 8))
                        .trim();
            }
        }

        logger.debug("group by columns:" + this.groupbycolumn);

        if (StringUtils.indexOfIgnoreCase(sql, "order by", i) >= i) {
            if (StringUtils.indexOfIgnoreCase(sql, "limit ", i) > StringUtils.indexOfIgnoreCase(sql, "order by",
                    i)) {
                // ?limit,????,?limit
                if (this.orderbycolumn.length() > 0)
                    this.orderbycolumn = this.orderbycolumn + ","
                            + sql.substring(StringUtils.indexOfIgnoreCase(sql, "order by") + 8,
                                    StringUtils.indexOfIgnoreCase(sql, "limit"));
                else {
                    this.orderbycolumn = sql.substring(StringUtils.indexOfIgnoreCase(sql, "order by", i) + 8,
                            StringUtils.indexOfIgnoreCase(sql, "limit "));
                }
            } else {
                // ??limit,
                if (this.orderbycolumn.length() > 0)
                    this.orderbycolumn = this.orderbycolumn + ","
                            + sql.substring(StringUtils.indexOfIgnoreCase(sql, "order by", i) + 8);
                else {
                    this.orderbycolumn = sql.substring(StringUtils.indexOfIgnoreCase(sql, "order by", i) + 8);
                }
            }

            this.orderbycolumn = this.orderbycolumn.replace(" asc", " ");
            this.orderbycolumn = this.orderbycolumn.replace(" desc", " ");
        }

        this.orderbycolumn = this.orderbycolumn.replace(" ", "");
        logger.debug("order by columns:" + this.orderbycolumn);
    }
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

public static void addToColumnHashMap(String select_exprs, List<Entry<String, String>> entries) {
    // ?//from w  w  w  .  j  av a 2 s.c  o m
    if (select_exprs == null) {
        return;
    }
    select_exprs = select_exprs.toLowerCase();
    logger.debug("addToColumnHashMap select_exprs:" + select_exprs);
    // ??
    if (StringUtils.indexOfIgnoreCase(select_exprs, "(") < 0) {
        String[] array_columns = select_exprs.split(",");
        for (String array_column : array_columns) {
            dealSingleSelectExpr(array_column, entries);
        }
        return;
    }

    // ,??,?
    int i = 0;
    int start = 0;
    int addr_douhao = 0;
    int douhao_before_left_kuohao;
    int douhao_before_right_kuohao;
    String select_expr;
    while (i < select_exprs.length()) {
        addr_douhao = StringUtils.indexOfIgnoreCase(select_exprs, ",", i);
        if (addr_douhao < 0) {
            // ?select_expr
            select_expr = select_exprs.substring(start);
            dealSingleSelectExpr(select_expr, entries);
            break;
        }
        // ???,??
        douhao_before_left_kuohao = getWordCountInStr(select_exprs, "(", addr_douhao);
        douhao_before_right_kuohao = getWordCountInStr(select_exprs, ")", addr_douhao);
        if (douhao_before_left_kuohao == douhao_before_right_kuohao) {
            // select_expr
            select_expr = select_exprs.substring(start, addr_douhao);
            dealSingleSelectExpr(select_expr, entries);
            start = addr_douhao + 1;
            i = start;
        } else {
            // ?,?
            i = addr_douhao + 1;
        }
    }
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

public String handleBetweenAnd(String wherestr) {
    String tmp_wherestr = wherestr;
    String resultString = "";
    String column_name;/*ww  w  . j a  v a  2s . c  o m*/
    int start = 0;
    String matchString;
    int addr, len;

    if (StringUtils.indexOfIgnoreCase(tmp_wherestr, " between ") < 0) {
        resultString = tmp_wherestr;
    } else {
        // between #value# and#value#?
        tmp_wherestr = removeSpace(tmp_wherestr);
        Pattern pattern = Pattern
                .compile("\\s+[a-zA-Z][0-9_a-zA-Z\\.]+\\s+between\\s+[',:#+\\-0-9_a-zA-Z\\(\\)]+\\sand\\s+");
        Matcher matcher = pattern.matcher(tmp_wherestr);
        while (matcher.find()) {
            matchString = matcher.group();
            len = matchString.length();
            addr = StringUtils.indexOfIgnoreCase(tmp_wherestr, matchString);
            column_name = matchString.trim().substring(0, matchString.trim().indexOf(" "));
            // between??>=?
            matchString = matchString.replace(" between ", " >= ");
            // and???<=?
            matchString = matchString + column_name + " <= ";
            // ?resultString
            resultString = resultString + tmp_wherestr.substring(start, addr) + matchString;
            // start?
            start = addr + len;
        } // end while

        // ??SQL
        if (start < tmp_wherestr.length()) {
            resultString = resultString + tmp_wherestr.substring(start);
        }

    }

    return resultString;
}