[
https://issues.apache.org/jira/browse/NIFI-3742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Koji Kawamura updated NIFI-3742:
--------------------------------
Resolution: Fixed
Status: Resolved (was: Patch Available)
> 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)