is it possible to do this?
I have 2 datasets, new_data/ND (JSON) and old_data/OD (my_database),
the logic is
if old_data != new_data, I create new one data (so keep the history of the data)
if old_data == new_data, don't do anything
example:
OD = [D1,D2,D3,D4,D5,D6,...]
and your input data:
ND = [D4,D5]
Then you can assume:
OD DIFFERENT ND =
[D1-NULL=D1,
D2-NULL=D2,
D3-NULL=D3,
OD_D4-ND_D4={if(OD_D4==ND_D4)?OD_D4:ND_D4},
OD_D5-ND_D5={if(OD_D5==ND_D5)?OD_D5:ND_D5},
D6-NULL=D6]
final result [D1,D2,D3,OD_D4 OR ND_D4,OD_D5 OR ND_D5,D6,...]
and we should not insert/update if the data is the same.
Aucun commentaire:
Enregistrer un commentaire