labfy-investigation/include/database/transaction.h
2026-07-19 18:05:22 +02:00

62 lines
1.4 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************************************
* @file transaction.h
* @brief Gestion des transactions SQLite.
******************************************************************************/
#ifndef LABFY_INVESTIGATION_TRANSACTION_H
#define LABFY_INVESTIGATION_TRANSACTION_H
#include "database/database.h"
#include <stdbool.h>
/**
* @brief Indique si une transaction est actuellement active.
*
* Cette fonction ne modifie ni la connexion ni son erreur courante.
*
* @param database Connexion à inspecter.
*
* @return true lorsquune transaction est active, sinon false.
* Une connexion NULL retourne false.
*/
bool database_transaction_is_active(
const Database *database
);
/**
* @brief Démarre une transaction d'écriture immédiate.
*
* Une seule transaction peut être active sur une instance Database.
*
* @param database Connexion à la base.
*
* @return true en cas de succès, sinon false.
*/
bool database_transaction_begin(
Database *database
);
/**
* @brief Valide la transaction active.
*
* @param database Connexion à la base.
*
* @return true en cas de succès, sinon false.
*/
bool database_transaction_commit(
Database *database
);
/**
* @brief Annule la transaction active.
*
* @param database Connexion à la base.
*
* @return true en cas de succès, sinon false.
*/
bool database_transaction_rollback(
Database *database
);
#endif