NIFI-4729: This closes #2366. ConvertJSONToSQL converted boolean values in reverse

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Koji Kawamura 2018-01-03 09:03:14 +09:00 committed by joewitt
parent 9f919b9b65
commit 1959586389
2 changed files with 2 additions and 3 deletions

View File

@ -547,7 +547,7 @@ public class ConvertJSONToSQL extends AbstractProcessor {
case Types.NUMERIC:
if (fieldNode.isBoolean()) {
// Convert boolean to number representation for databases those don't support boolean type.
fieldValue = fieldNode.asBoolean() ? "0" : "1";
fieldValue = fieldNode.asBoolean() ? "1" : "0";
}
break;

View File

@ -205,9 +205,8 @@ public class TestConvertJSONToSQL {
out.assertAttributeEquals("sql.args.1.value", "1");
out.assertAttributeEquals("sql.args.2.type", String.valueOf(java.sql.Types.VARCHAR));
out.assertAttributeEquals("sql.args.2.value", "Bool");
// Boolean value 'true' is converted to '0'
out.assertAttributeEquals("sql.args.3.type", String.valueOf(java.sql.Types.INTEGER));
out.assertAttributeEquals("sql.args.3.value", "0");
out.assertAttributeEquals("sql.args.3.value", "1");
out.assertContentEquals("INSERT INTO PERSONS (ID, NAME, CODE) VALUES (?, ?, ?)");
}