db.sqlite Return types #19076
Closed
jacksonmowry
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I have recently been contributing to the db section of vlib and had a question about the api of db.sqlite.
Currently some methods return single strings or ints, others return []Row and a code, and others return a result type of either an error or []Row.
First, the methods
q_int
andq_string
make sense to return their single value, but should also have the possibility of returning an error. Currently if there is a mistake in the query passed to the db the user has no indication of what went wrong.Second,
db.exec(query)
returns([]Row, int)
(indicating the code returning from the db). Should this be changed to![]Row
for consistency with exec_param and exec_param_many? The code can still be accessed through the error value by reading thecode
field of the error struct. This would also bring exec closer to the rest of the rest of the methods in db.sqlite.Lastly, I know this would be a breaking change, but this is something I am willing to work on if the V core team thinks this would be worthwhile.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions