SQL for QSL status and to update QSL status from third party tool
Posted: 25 Jul 2022, 23:09
After doing some research I found the QSL data in the qslconfirmations field. The Data is stored as JSON and I can pull it out.
I updated the MariaDB to v10.6 so I could JSON_TABLE feature in sql.
I am lazy and I do not want to pull the field out and parse it into JSON just so I can update the values. Is there a way to update the JSON in the field with a raw SQL statement? I tried this and it does not work:
If anyone has any tips or tricks, I am open to learn.
73 for now de AC9HP
I updated the MariaDB to v10.6 so I could JSON_TABLE feature in sql.
Code: Select all
select qsoid, callsign, qsodate, email, band, mode, rstsent,name, j.*
from log,JSON_TABLE(log.qsoconfirmations,'$[*]'
COLUMNS (
ct VARCHAR(10) PATH '$.CT', S VARCHAR(10) PATH '$.S',
R VARCHAR(10) PATH '$.R',
SV VARCHAR(100) PATH '$.SV',
RV VARCHAR(100) PATH '$.RV',
SD VARCHAR(100) PATH '$.SD',
RD VARCHAR(100) PATH '$.RD' ) ) as j where j.ct = 'QSL' and callsign = 'N9DBJ' and j.S <> '';
Code: Select all
update log,JSON_TABLE(log.qsoconfirmations,'$[*]'
COLUMNS (
ct VARCHAR(10) PATH '$.CT', S VARCHAR(10) PATH '$.S',
R VARCHAR(10) PATH '$.R',
SV VARCHAR(100) PATH '$.SV',
RV VARCHAR(100) PATH '$.RV',
SD VARCHAR(100) PATH '$.SD',
RD VARCHAR(100) PATH '$.RD' ) ) as j set j.S = 'Yes' where qsoid = '20210208015823435' and j.S <> 'Yes' and j.ct = 'QSL';
73 for now de AC9HP