Skip to content

Conversation

@esmaeelghasemi
Copy link

🛠️ Added Database Transaction Feature

This PR introduces a database transaction system that provides complete control over transactions with a flow similar to synchronous execution.

📋 Changes Overview

  • Added a Transaction clause to manage transactional operations.
  • Introduced a beginTransaction() method to start a new transaction context.
  • Added support for adding queries to the transaction using a unique name and query type (SELECT, INSERT, UPDATE, or DELETE).
  • Each query can also include a callback (closure) to handle the result.
  • After all queries are added, the compile() method executes them in sequence and handles their results.
  • If all queries execute successfully, the transaction is automatically committed, and the result of the last query is returned.
  • Queries are executed synchronously to ensure proper transaction control.

📦 Query Result Access

  • Query results are stored in a QueryResultCollection class.
  • The collection is injected into each query’s callback, allowing access to the results of all previous queries within the transaction.

@hasanparasteh hasanparasteh merged commit c3b9323 into SarafApp:main Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants