Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/883#discussion_r75413240
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutSQL.java
---
@@ -787,6 +792,12 @@ private void setParameter(final PreparedStatement
stmt, final String attrName, f
stmt.setTimestamp(parameterIndex, new
Timestamp(lTimestamp));
break;
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ byte[] bValue = parameterValue.getBytes("ASCII");
+ stmt.setBinaryStream(parameterIndex, new
ByteArrayInputStream(bValue), bValue.length);
--- End diff --
This should work for the use case you described in the Jira case
(Avro->JSON->SQL), but what about SQL statements generated in other ways, where
the attribute value is something like "0xDEADBEEF"? The attribute value is a
String like you said (all attributes are), but the bytes shouldn't be
interpreted as ASCII, rather in this case Integer.decode() seems like the right
method versus getBytes().
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---