MCPcopy Create free account
hub / github.com/erans/pgsqlite / execute_transaction

Method execute_transaction

src/query/extended.rs:5669–5695  ·  view source on GitHub ↗
(
        framed: &mut Framed<T, crate::protocol::PostgresCodec>,
        db: &Arc<DbHandler>,
        session: &Arc<SessionState>,
        query: &str,
    )

Source from the content-addressed store, hash-verified

5667 }
5668
5669 async fn execute_transaction<T>(
5670 framed: &mut Framed<T, crate::protocol::PostgresCodec>,
5671 db: &Arc<DbHandler>,
5672 session: &Arc<SessionState>,
5673 query: &str,
5674 ) -> Result<(), PgSqliteError>
5675 where
5676 T: tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin,
5677 {
5678 if query_starts_with_ignore_case(query, "BEGIN")
5679 || query_starts_with_ignore_case(query, "START") {
5680 db.begin_with_session(&session.id).await?;
5681 framed.send(BackendMessage::CommandComplete { tag: "BEGIN".to_string() }).await
5682 .map_err(PgSqliteError::Io)?;
5683 } else if query_starts_with_ignore_case(query, "COMMIT")
5684 || query_starts_with_ignore_case(query, "END") {
5685 db.commit_with_session(&session.id).await?;
5686 framed.send(BackendMessage::CommandComplete { tag: "COMMIT".to_string() }).await
5687 .map_err(PgSqliteError::Io)?;
5688 } else if query_starts_with_ignore_case(query, "ROLLBACK") {
5689 db.rollback_with_session(&session.id).await?;
5690 framed.send(BackendMessage::CommandComplete { tag: "ROLLBACK".to_string() }).await
5691 .map_err(PgSqliteError::Io)?;
5692 }
5693
5694 Ok(())
5695 }
5696
5697 async fn execute_generic<T>(
5698 framed: &mut Framed<T, crate::protocol::PostgresCodec>,

Callers

nothing calls this directly

Calls 4

begin_with_sessionMethod · 0.80
commit_with_sessionMethod · 0.80
rollback_with_sessionMethod · 0.80

Tested by

no test coverage detected