Skip to content
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

Transactional for RDBMS #11

Open
Velliz opened this issue Mar 21, 2021 · 1 comment
Open

Transactional for RDBMS #11

Velliz opened this issue Mar 21, 2021 · 1 comment

Comments

@Velliz
Copy link
Owner

Velliz commented Mar 21, 2021

Until now, pukoframework don't have transactional feature, so i decided to add this function in next release into the PDA section on this framework.

Usage demonstration in my head so far,,, archived in 3 different way:

  • DBI ORM Style
$transaction = DBI::Transactional('primary');

$x = new obj();
...
$x->save($transaction);
...
$y->modify($transaction);
...

$transaction->commit();
$transaction->cancel();
  • DBI Original
$pk = 'id';
$data = [...];
$id = [...];

DBI::Prepare('users', 'primary')->Save($data, $pk, $transaction);
DBI::Prepare('users', 'primary')->Update($id, $data, $transaction);
DBI::Prepare('users', 'primary')->Delete($id, $transaction);

$transaction->commit();
//or
$transaction->cancel();
  • DBI Function Component (Idea comes from doctrine and laravel implementation)
$result = DBI::Transactional('primary', function($DBI) {

   $x = new obj();
   ...
   $x->save($DBI);
   ...
   $y->modify($DBI);
   ...

});

A lot of works happens in DBI class. Witch i must move out the $dbi instance out. So the object is being reusable in the transaction lifecycle.

Let's see if there was a progress in here.

@Velliz
Copy link
Owner Author

Velliz commented Apr 4, 2021

As mentioned in commits 165a0f8 the transactional achieved with DBI Function Component and will be shipped in next release.

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

No branches or pull requests

1 participant