Skip to content

If no data is found return empty set#194

Open
123FLO321 wants to merge 1 commit intoKitura:masterfrom
123FLO321:fix-empty
Open

If no data is found return empty set#194
123FLO321 wants to merge 1 commit intoKitura:masterfrom
123FLO321:fix-empty

Conversation

@123FLO321
Copy link

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

@CLAassistant
Copy link

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.

@mbarnach
Copy link
Member

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 mbarnach requested review from dannys42 and mbarnach April 23, 2021 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants