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

[question] about data update wrapper #215

Open
fawdlstty opened this issue Feb 24, 2022 · 2 comments
Open

[question] about data update wrapper #215

fawdlstty opened this issue Feb 24, 2022 · 2 comments

Comments

@fawdlstty
Copy link

How many rows has modified by an update command?
What value when auto_increment of primary key after inserted?

@zauguin
Copy link
Collaborator

zauguin commented Feb 24, 2022

Assuming sqlite::database db(...);:

How many rows has modified by an update command?

auto changed = db.rows_modified();

What value when auto_increment of primary key after inserted?
If the primary key is a INTEGER PRIMARY KEY (aka an alias for the rowid), then you can use

auto last_id = db.last_insert_rowid();

Otherwise I don't think that sqlite makes that information available. (But if you want to use an auto_increment primary key you normally want to make it a rowid alias anyway)

@fawdlstty
Copy link
Author

Thank's, I'll try.

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