amphitheatre-app / amphitheatre-app/omi

Implement start, rollback, and commit functions for simple transaction processing

オープン
#9 コメント 2 件 リアクション 0 件 担当者 1 名 @ssword が担当を希望しています GitHub で見る
good first issue help wanted
主要言語
Rust
スター
8
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

説明

## Functions:
omi::transaction::start();
omi::transaction::rollback();
omi::transaction::commit();

## Source file:
https://github.com/amphitheatre-app/omi/blob/master/src/transaction.rs

## Intro

To start a new transaction in MySQL, you can use the START TRANSACTION statement. For example:
```
START TRANSACTION;
```

This statement will start a new transaction and allow you to execute multiple SQL statements as a single unit of work. When you are ready to commit the transaction, you can use the COMMIT statement. For example:

```
COMMIT;
```

Alternatively, if you want to roll back the transaction and discard any changes made by the SQL statements, you can use the ROLLBACK statement. For example:

```
ROLLBACK;
```

It's important to note that starting a transaction will not automatically commit or roll back the changes made by the SQL statements. You must explicitly issue a COMMIT or ROLLBACK statement to either save or discard the changes.

## Demo

```rust
// transaction.rs
use sql_query_builder as sql;

/// Start a transaction
pub fn start() {
let query = sql::Select::new().raw("START TRANSACTION").as_string();
db::execute(sql);
}

See [sql_query_builder#raw-queries](https://github.com/belchior/sql_query_builder#raw-queries) for more information.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。