Skip to content

Database Transaction Feature #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

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.

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.

1 participant