Skip to content

db.sqlite: change to result return types - #19093

Merged
spytheman merged 8 commits into
vlang:masterfrom
jacksonmowry:sqlite_return_type_consistency
Aug 10, 2023
Merged

spytheman merged 8 commits into
vlang:masterfrom
jacksonmowry:sqlite_return_type_consistency

Conversation

@jacksonmowry

@jacksonmowry jacksonmowry commented Aug 9, 2023 •

Copy link
Copy Markdown
Contributor

fixes: #19084

This change brings db.sqlite up to speed with the rest of the db modules by returning result types where it makes sense. Mostly in exec and other methods that call exec.

Because this is a breaking change fixes also had to be applied across tests in the orm, and db modules. Along with fixing some code in v/examples to handle the new return types.

In addition to change the return types, sqlite3_errstr was swapped out in favor of sqlite3_errmsg to give more verbose errors for methods where that makes sense, and sqlite.error_message was used where that made the most sense.

πŸ€– Generated by Copilot at 881fbb6

This pull request improves the error handling of the sqlite module and its users by using the ! operator and the error_message method. It also fixes some minor issues with the sqlite3_errmsg function and the q_int fallback value. It updates the test and example files to reflect the changes.

πŸ€– Generated by Copilot at 881fbb6

Comment thread examples/database/sqlite.v Outdated
Comment thread vlib/db/sqlite/README.md Outdated
Comment thread examples/database/sqlite.v Outdated
Comment thread examples/database/sqlite.v Outdated
Comment thread examples/database/sqlite.v Outdated
Comment thread examples/database/sqlite.v Outdated
Comment thread vlib/db/sqlite/sqlite_orm_test.v

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

Change error handling

Co-authored-by: Delyan Angelov <delian66@gmail.com>
@jacksonmowry

Copy link
Copy Markdown
Contributor Author

Thank you @spytheman
I updated the error handling sections you requested.

@jacksonmowry

Copy link
Copy Markdown
Contributor Author

I just realized that my commit that changed the doc comments for updated functions got pushed to the wrong branch. I will get those doc comments updated as soon as I can. Sorry about that

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.

db.sqlite Return types

2 participants