jonathangeiger / kohana-jelly

See the link below for the most up-to-date code
https://github.com/creatoro/jelly
MIT License
146 stars 34 forks source link

Add support for transactions #171

Closed bistory closed 14 years ago

bistory commented 14 years ago

Add support for "BEGIN", "COMMIT" and "ROLLBACK". Simple short-hands like Jelly::begin() should be sufficient. This will help improving performances on InnoDB engine and will increase functionnality level for Jelly.

Thanks !

loonies commented 14 years ago

Already supported by using the DB module:

try
{
    DB::query(NULL, 'BEGIN')->execute();

    Jelly::whatever();

    DB::query(NULL, 'COMMIT')->execute();
}
catch (Database_Exception $e)
{
    DB::query(NULL, 'ROLLBACK')->execute();
}
bistory commented 14 years ago

Yes like any other SQL query... The idea is to have an unified way to handle transactions.

banks commented 14 years ago

The idea is to have an unified way to handle transactions.

I don't see that there is away since different DBMSs have different support for transactions. I don't feel it is the responsibility of Jelly to manage this when it is trying to be DB agnostic. loonies provides a neat and useable solution.

If you are using a specific DB and want to include methods in your models that use non-standard SQL features go ahead but I don't think this will go into the core.

bistory commented 14 years ago

Ok thanks, no prob :)