dji-sdk / DJI-Cloud-API-Demo

MIT License
147 stars 105 forks source link

1.9.0 (and also 1.8.0) - the result of some generated SQL queries is not portable #54

Open neilyoung opened 9 months ago

neilyoung commented 9 months ago

...at least not from MySQL to MS SQL Server.

I'm not talking about this monster statement here, which I could only convert to MSSQL by use of ChatGPT (thanks, btw):

https://github.com/dji-sdk/DJI-Cloud-API-Demo/blob/c196f70c0c270d56ad772629e3856ee807554626/sample/src/main/java/com/dji/sample/manage/dao/IDeviceFirmwareMapper.java#L17

But also here: "LIMIT 1" might work in MySQL, but doesn't work in MSSQL.

Found at various places. Some constructs look like "overkill security", like suspenders AND belt, because their formulation cannot bring more than max result record at a time. Please review your tables to find another way to ensure uniqueness. One way would be to capture all candidates and then deliver just the last (if) by code.

Here the candidates:

https://github.com/dji-sdk/DJI-Cloud-API-Demo/blob/c196f70c0c270d56ad772629e3856ee807554626/sample/src/main/java/com/dji/sample/manage/service/impl/DeviceDictionaryServiceImpl.java#L32

https://github.com/dji-sdk/DJI-Cloud-API-Demo/blob/c196f70c0c270d56ad772629e3856ee807554626/sample/src/main/java/com/dji/sample/map/service/impl/FlightAreaFileServiceImpl.java#L83

https://github.com/dji-sdk/DJI-Cloud-API-Demo/blob/c196f70c0c270d56ad772629e3856ee807554626/sample/src/main/java/com/dji/sample/map/service/impl/GroupServiceImpl.java#L49