Skip to content

Commit

Permalink
impl AnyQueryResult for Sqlite and MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
pxp9 committed Nov 23, 2024
1 parent 82d332f commit e14b89d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sqlx-mysql/src/query_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ impl Extend<MySqlQueryResult> for MySqlQueryResult {
}
}
}

#[cfg(feature = "any")]
impl From<MySqlQueryResult> for crate::any::AnyQueryResult {
fn from(done: MySqlQueryResult) -> Self {
crate::any::AnyQueryResult {
rows_affected: done.rows_affected,
last_insert_id: Some(done.last_insert_id),
}
}
}
10 changes: 10 additions & 0 deletions sqlx-sqlite/src/query_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ impl Extend<SqliteQueryResult> for SqliteQueryResult {
}
}
}

#[cfg(feature = "any")]
impl From<SqliteQueryResult> for crate::any::AnyQueryResult {
fn from(done: SqliteQueryResult) -> Self {
crate::any::AnyQueryResult {
rows_affected: done.rows_affected,
last_insert_id: Some(done.last_insert_rowid),
}
}
}

0 comments on commit e14b89d

Please sign in to comment.