amphitheatre-app / amphitheatre-app/omi

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

Ouverte
#9 2 commentaires 0 réactions 1 personne assignée Réclamée par @ssword Voir sur GitHub
good first issue help wanted
Langage dominant
Rust
Étoiles
8
Forks
3
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## 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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.