Transactions

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
DevGiu
AppGini Super Hero
AppGini Super Hero
Posts: 151
Joined: 2016-05-27 09:08

Transactions

Post by DevGiu » 2016-08-11 10:06

If you need to do some process and want to use transaction, you need the connection object to do this.
You can obtain it with db_link() function.

Code: Select all

$conn = db_link();
var_dump($conn);
returns the mysqli object.
This means, you can do something like this

Code: Select all

$conn = db_link();
$conn->autocommit(false);
sql("UPDATE mytable set myfield = '12345'", $eo);
if (itsallok){
   $conn->commit();
}else if (OMG_forgot_where_clause){
   $conn->rollback();
}

And data
/Giuseppe
Professional Outsourcing Services

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Transactions

Post by grimblefritz » 2016-08-30 09:49

This would be a nice option in the designer - use transactions y/n - either globally or by table.

Post Reply