Adds support to replaceNulls transformation

This commit is contained in:
Felipe Zimmerle 2015-10-23 14:05:42 -03:00
parent 9932478705
commit 1716add77b
3 changed files with 13 additions and 9 deletions

View File

@ -37,14 +37,18 @@ ReplaceNulls::ReplaceNulls(std::string action)
std::string ReplaceNulls::evaluate(std::string value,
Assay *assay) {
/**
* @todo Implement the transformation ReplaceNulls
*/
if (assay) {
#ifndef NO_LOGS
assay->debug(4, "Transformation ReplaceNulls is not implemented yet.");
#endif
int64_t i;
i = 0;
while (i < value.size()) {
if (value.at(i) == '\0') {
value.erase(i, 1);
value.insert(i, " ", 1);
} else {
i++;
}
}
return value;
}

View File

@ -99,7 +99,7 @@ Transformation* Transformation::instantiate(std::string a) {
IF_MATCH(remove_whitespace) { return new RemoveWhitespace(a); }
IF_MATCH(compressWhitespace) { return new CompressWhitespace(a); }
IF_MATCH(replaceComments) { return new ReplaceComments(a); }
IF_MATCH(replace_nulls) { return new ReplaceNulls(a); }
IF_MATCH(replaceNulls) { return new ReplaceNulls(a); }
IF_MATCH(sha1) { return new Sha1(a); }
IF_MATCH(sql_hex_decode) { return new SqlHexDecode(a); }
IF_MATCH(transformation) { return new Transformation(a); }

@ -1 +1 @@
Subproject commit 635d86d6f87d56de656da73e3026a6ef2cc9a5f1
Subproject commit e363aa647abebe1be523f9bdd5ba4466ba20256e