MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / commit

Method commit

src/database/transaction.rs:119–154  ·  view source on GitHub ↗
(mut self)

Source from the content-addressed store, hash-verified

117 #[instrument(level = "trace")]
118 #[allow(unreachable_code, unused_mut)]
119 pub async fn commit(mut self) -> Result<(), DbErr> {
120 match *self.conn.lock().await {
121 #[cfg(feature = "sqlx-mysql")]
122 InnerConnection::MySql(ref mut c) => {
123 <sqlx::MySql as sqlx::Database>::TransactionManager::commit(c)
124 .await
125 .map_err(sqlx_error_to_query_err)
126 }
127 #[cfg(feature = "sqlx-postgres")]
128 InnerConnection::Postgres(ref mut c) => {
129 <sqlx::Postgres as sqlx::Database>::TransactionManager::commit(c)
130 .await
131 .map_err(sqlx_error_to_query_err)
132 }
133 #[cfg(feature = "sqlx-sqlite")]
134 InnerConnection::Sqlite(ref mut c) => {
135 <sqlx::Sqlite as sqlx::Database>::TransactionManager::commit(c)
136 .await
137 .map_err(sqlx_error_to_query_err)
138 }
139 #[cfg(feature = "mock")]
140 InnerConnection::Mock(ref mut c) => {
141 c.commit();
142 Ok(())
143 }
144 #[cfg(feature = "proxy")]
145 InnerConnection::Proxy(ref mut c) => {
146 c.commit().await;
147 Ok(())
148 }
149 #[allow(unreachable_patterns)]
150 _ => Err(conn_err("Disconnected")),
151 }?;
152 self.open = false;
153 Ok(())
154 }
155
156 /// rolls back a transaction in case error are encountered during the operation
157 #[instrument(level = "trace")]

Callers 1

runMethod · 0.45

Calls 2

conn_errFunction · 0.85
lockMethod · 0.80

Tested by

no test coverage detected