Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #149 #153

Merged
merged 4 commits into from
Nov 2, 2021
Merged

Fix for #149 #153

merged 4 commits into from
Nov 2, 2021

Conversation

wseaton
Copy link
Collaborator

@wseaton wseaton commented Nov 2, 2021

This patch solves the issue outlined in #149 on my particular database, could probably be refactored to reduce repetition but couldn't figure out how in a way I liked, any pointers? 🙂

@wangxiaoying
Copy link
Contributor

Thanks @wseaton ! The code looks good. Can you also add this modification to the BinaryProtocol's prepare stage: https://github.com/sfu-db/connector-x/pull/153/files#diff-9a26d294fe1517a58485b5b2709196a4613e51fd9f99acd82ca16028a771b53eL218 to make the count consistent? (It seems like we didn't add the check limit on CSVProtocol and CursorProtocol previously, can you also help to add this check? Thanks for helping to find this inconsistency!)

The repetition looks ok to me since it's not much. But if we want to reduce it, I think one way might be extracting a count function, which's input is reference to a connection and a query, and output is the count result in usize. All three protocols can invoke it in this function prepare stage and set the self.nrows using the returned result.

@wseaton
Copy link
Collaborator Author

wseaton commented Nov 2, 2021

@wangxiaoying was above to remove the duplication as per your suggestion, still works great against my database. Thanks for the help!

@wangxiaoying wangxiaoying merged commit 91c976d into sfu-db:main Nov 2, 2021
@wangxiaoying
Copy link
Contributor

@wseaton Looks great! Thanks for the PR. I have merged this.

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.

2 participants