Swift-Kuery icon indicating copy to clipboard operation
Swift-Kuery copied to clipboard

If no data is found return empty set

Open 123FLO321 opened this issue 5 years ago • 2 comments

If we query the db and get an empty set we should return an empty set instead of nil.

123FLO321 avatar Mar 17 '20 23:03 123FLO321

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Sep 27 '20 02:09 CLAassistant

I'm re-reading the change, and I'm not so sure about it now. It is creating a discrepancy between asRows and asResultSet. If you look at the test TestQueryResult.testQueryResult, you see that we still return nil in that case. This is due to the getRows function, that first check if the asResultSet is nil, before returning the rows. If we want to be consistent, then we should also change asResultSet to return an empty result set, but that doesn't seem very doable.

I agree that empty is more consistent when no records are found, but if you look at the error, it is clear that there is no error. My opinion is that is should stay like that. @dannys42 do you want to comment/add on this one?

mbarnach avatar Apr 23 '21 08:04 mbarnach