[PR #77] Fix compare of data fields for NULL values #252

Open
opened 2026-03-07 20:42:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/DBDiff/DBDiff/pull/77
Author: @dev-jan
Created: 4/26/2018
Status: 🔄 Open

Base: masterHead: fix-null-data-compare


📝 Commits (2)

  • 18f42c1 Fix compare of data fields for NULL values
  • dd7cc73 Fix test suite: Only run tests with php 7 and higher

📊 Changes

2 files changed (+14 additions, -7 deletions)

View changed files

📝 .travis.yml (+0 -3)
📝 src/DB/Data/LocalTableData.php (+14 -4)

📄 Description

The MySQL md5() function will return NULL if one of the given columns has
a NULL values in it. So if one field in the row is NULL, the whole MD5
will be NULL and the compare not actually work.

If the values is wrapped into a "IFNULL", all NULL values will be replaced
with '' (an empty string) for the compare of the values. This can maybe be
bad also, as the values '' and NULL are threaded the same. For this reason
all NULL values are joined together to check if there are still the same
as before.

Fixes #53


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/DBDiff/DBDiff/pull/77 **Author:** [@dev-jan](https://github.com/dev-jan) **Created:** 4/26/2018 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix-null-data-compare` --- ### 📝 Commits (2) - [`18f42c1`](https://github.com/DBDiff/DBDiff/commit/18f42c1aea5488f31ed7f7a8f3ddae0908a9d0a6) Fix compare of data fields for NULL values - [`dd7cc73`](https://github.com/DBDiff/DBDiff/commit/dd7cc73a086bec65f86de8d8cc49db6103a4b62b) Fix test suite: Only run tests with php 7 and higher ### 📊 Changes **2 files changed** (+14 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.travis.yml` (+0 -3) 📝 `src/DB/Data/LocalTableData.php` (+14 -4) </details> ### 📄 Description The MySQL md5() function will return NULL if one of the given columns has a NULL values in it. So if one field in the row is NULL, the whole MD5 will be NULL and the compare not actually work. If the values is wrapped into a "IFNULL", all NULL values will be replaced with '' (an empty string) for the compare of the values. This can maybe be bad also, as the values '' and NULL are threaded the same. For this reason all NULL values are joined together to check if there are still the same as before. Fixes #53 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/DBDiff#252
No description provided.