ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10719] - Files processed under SQL task are hacked
Date Sat, 27 Jul 2002 13:21:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10719>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10719

Files processed under SQL task are hacked





------- Additional Comments From sbailliez@apache.org  2002-07-27 13:21 -------
can be make somewhat cleaner like this (not sure it works, this is just the 
idea from the top of my head) if we don't care about comments:

        StringBuffer sqlBuffer = new StringBuffer(128);
        String line = null;
        BufferedReader in = new BufferedReader(reader);        
        while ((line = in.readLine()) != null) {
            line = project.replaceProperties(line);            
            // add the untrimmed line to the sql statement
            sqlBuffer.append(" ").append(line).append("\n");
            
            // create a trimmed line for comparisons
            line = line.trim();            
            
            // skip comments
            if (isComment(line)) {
              continue;
            }
            
            if (isDelimited(line)) {
                // trim the final sql to remove any whitespace after the 
delimiter              
                String sql = sqlBuffer.toString().trim();              
                log("SQL: '" + sql + "'", Project.MSG_VERBOSE);
                sql = sql.substring(0, sql.length() - delimiter.length());
                execSQL(sql, out);
                // reset for the next statement...
                sqlBuffer = new StringBuffer(128);
            }
        }
        
        // Catch any statements not followed by a delimiter
        String sql = sqlBuffer.toString().trim();
        log("SQL: '" + sql + "'", Project.MSG_VERBOSE);
        execSQL(sql, out);
     }

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message