mirror of https://github.com/apache/nifi.git
NIFI-4729: This closes #2366. ConvertJSONToSQL converted boolean values in reverse
Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
parent
9f919b9b65
commit
1959586389
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 (?, ?, ?)");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue