Skip to content

Implement AnyQueryResult for Sqlite and MySQL - #3608

Merged
abonander merged 5 commits into
transact-rs:mainfrom
pxp9:main
Nov 26, 2024
Merged

abonander merged 5 commits into
transact-rs:mainfrom
pxp9:main

Conversation

@pxp9

@pxp9 pxp9 commented Nov 23, 2024

Copy link
Copy Markdown
Contributor

Title is self explanatory.

@pxp9

pxp9 commented Nov 23, 2024

Copy link
Copy Markdown
Contributor Author

@abonander could you review plz ? (sorry for ping).

Comment thread sqlx-mysql/src/any.rs Resolved
Comment thread sqlx-sqlite/src/any.rs Resolved
Comment thread sqlx-mysql/src/query_result.rs Resolved
Comment thread sqlx-sqlite/src/query_result.rs Resolved
@pxp9
pxp9 requested a review from abonander November 26, 2024 18:39
@pxp9

pxp9 commented Nov 26, 2024

Copy link
Copy Markdown
Contributor Author

Hey @abonander , done some changes , feel free to comment more concerns or close the comments.

@abonander
abonander merged commit d4ae6ff into transact-rs:main Nov 26, 2024
CairoLee added a commit to CairoLee/sqlx that referenced this pull request Feb 24, 2026
…sert_id`

The `map_result()` function in `sqlx-sqlite/src/any.rs` was hardcoding
`last_insert_id: None`, discarding the actual `last_insert_rowid` from
`SqliteQueryResult`. Meanwhile, a correct `From<SqliteQueryResult>`
implementation already existed in `query_result.rs` (added in transact-rs#3608)
but was never used by the actual query execution path.

This commit replaces the manual construction in `map_result()` with
a delegation to `AnyQueryResult::from()`, which properly maps the
SQLite `last_insert_rowid` value.

A regression test is added to verify that `AnyQueryResult::last_insert_id()`
returns the correct value after INSERT operations on SQLite.

Closes transact-rs#2982
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.

2 participants