[
https://issues.apache.org/jira/browse/NIFI-3742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15988084#comment-15988084
]
ASF subversion and git services commented on NIFI-3742:
-------------------------------------------------------
Commit d61f5193261844661aedec68152db6fa78787a31 in nifi's branch
refs/heads/master from [~mattyb149]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=d61f519 ]
NIFI-3742: Fixed handling of nulls in DELETE for PutDatabaseRecord
This closes #1709.
Signed-off-by: Koji Kawamura <[email protected]>
> PutDatabaseRecord can not delete row if it contains null value
> --------------------------------------------------------------
>
> Key: NIFI-3742
> URL: https://issues.apache.org/jira/browse/NIFI-3742
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.2.0
> Reporter: Koji Kawamura
> Assignee: Matt Burgess
> Fix For: 1.2.0
>
>
> For example, let's say a table which has null-able columns. When rows get
> deleted, CaptureChangeMySQL emits 'delete' events for each deleted row with
> all column values including null-able ones. From those data,
> PutDatabaseRecord can generate delete statements for other table which have
> where clause like this:
> {code}
> DELETE FROM users WHERE id = 4 AND title = null AND first = 'Koji' AND last =
> 'Kawamura' AND street = null AND city = null AND state = null AND zip = null
> AND gender = null AND email = null AND username = null AND password = null
> AND phone = null AND cell = null AND ssn = null AND date_of_birth = null AND
> reg_date = null AND large = null AND medium = null AND thumbnail = null AND
> version = null AND nationality = null
> {code}
> However, a condition like 'title = null' doesn't hit with any record, because
> for null value, we should use 'title IS null' instead.
> I think we should do something like below in order to treat these null-able
> columns:
> {code}
> # With a prepared statement like this:
> DELETE FROM users WHERE id = ? AND (title = ? OR (title is null AND ? is
> null)) AND ... so on ...;
> # Which is executed like this:
> DELETE FROM users WHERE id = 4 AND (title = null OR (title is null AND null
> is null)) … and so on …;
> {code}
> Reference:
> http://stackoverflow.com/questions/4215135/how-to-deal-with-maybe-null-values-in-a-preparedstatement
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)