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

how can i know the number of update rows #126

Open
skyatgit opened this issue Jan 30, 2023 · 5 comments
Open

how can i know the number of update rows #126

skyatgit opened this issue Jan 30, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@skyatgit
Copy link

db.query_result don't show the number of update rows

@skyatgit skyatgit added the bug Something isn't working label Jan 30, 2023
@2shady4u
Copy link
Owner

Hi @skyatgit

At the moment there's no way to get the number of changes.
I'll see about implementing it in the next version.

@skyatgit
Copy link
Author

ok,thanks

@2shady4u 2shady4u added enhancement New feature or request and removed bug Something isn't working labels Jan 30, 2023
@2shady4u
Copy link
Owner

Hello @skyatgit

Good news 😄
You can already get the number of changes in the current version of the library by using following query:

db.query("SELECT CHANGES();")
print(db.query_result)

Which will then output the following in the Godot console:

[{CHANGES():0}]

With 0 being replaced with whatever number changes were done in the previous query.

I'll see if there's any merit to implementing some additional wrappers around the sqlite3_total_changes and sqlite3_changes-methods, but I assume that the query above already fixes your issue 😄

@skyatgit
Copy link
Author

skyatgit commented Feb 1, 2023

@2shady4u ok,thank you~ and i think in the next version if the query is not 'select',the query_result return the changes count is a good thing,of course, it depends on your decision

@feefladder
Copy link
Contributor

maybe the return value for update_rows could be made to reflect that? e.g. -1 for error and 0,1... for success? Not sure if really necessary though, but would be nice (breaks compatibility)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants