[ 
https://issues.apache.org/jira/browse/HAWQ-822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15332948#comment-15332948
 ] 

ASF GitHub Bot commented on HAWQ-822:
-------------------------------------

Github user huor commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/721#discussion_r67280192
  
    --- Diff: src/test/feature/lib/file_replace.cpp ---
    @@ -0,0 +1,56 @@
    +#include <iostream>
    +#include <fstream>
    +
    +#include "file_replace.h"
    +
    +using std::string;
    +using std::map;
    +using std::endl;
    +using std::ifstream;
    +using std::ofstream;
    +
    +namespace hawq {
    +namespace test {
    +
    +string FileReplace::replaceAllOccurrences(
    +   string str,
    +   const string& src,
    +   const string& dst)
    +{
    +   size_t start_pos = 0;
    +   while ((start_pos = str.find(src, start_pos)) != string::npos)
    +   {
    +           str.replace(start_pos, src.length(), dst);
    +           start_pos += dst.length();
    +   }
    +
    +   return str;
    +}
    +
    +void FileReplace::replace(
    +   const string& file_src,
    +   const string& file_dst,
    +   const map<string, string>& strs_src_dst)
    +{
    +   ifstream fin(file_src);
    +   ofstream fout(file_dst);
    +   string line;
    +
    +   while ( getline(fin, line) )
    +   {
    +           typename map<string, string>::const_iterator mit;
    --- End diff --
    
    Cool.


> Add string replacement utility in feature test framework to support convert 
> from source to sql and ans files
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: HAWQ-822
>                 URL: https://issues.apache.org/jira/browse/HAWQ-822
>             Project: Apache HAWQ
>          Issue Type: Test
>          Components: Tests
>            Reporter: Ruilong Huo
>            Assignee: Ruilong Huo
>
> Need to add string replacement utility in feature test framework to support 
> convert from source to sql and ans files.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to