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

Affected rows count with queries returning data? #49

Open
0x777 opened this issue Jun 13, 2016 · 2 comments
Open

Affected rows count with queries returning data? #49

0x777 opened this issue Jun 13, 2016 · 2 comments

Comments

@0x777
Copy link

0x777 commented Jun 13, 2016

data WithAffectedRows a 
  = WithAffectedRows Int64 a

withAffectedRows :: Result a -> Result (WithAffectedRows a)

Useful when using returning in insert/update/delete queries.

UPDATE t SET x = 1 WHERE y = 2 RETURNING id;
@nikita-volkov
Copy link
Owner

Sorry. I somehow missed this issue. What makes this case special? You're still receiving a vector of "id" columns, which you can just as well measure the length of.

I'm asking because I'm currently putting finishing touches on the new release of Hasql, and considering whether to do anything about this issue.

@0x777
Copy link
Author

0x777 commented Oct 9, 2017

The length of the vector need not be computed. It can be extracted from the Result. Then again, getting the length of a vector is a constant time operation. So, I guess it doesn't add any significant advantage.

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

No branches or pull requests

2 participants