Skip to content

Commit 2df2794

Browse files
committed
🔨 add transactional methods
Signed-off-by: otengkwame <[email protected]>
1 parent e36282a commit 2df2794

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

Core/core/Models/EasyModel.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,69 @@ public function set($key, $value = '', $escape = true)
16001600
$this->db->set($key, $value, $escape);
16011601
return $this;
16021602
}
1603+
1604+
/**
1605+
* Start Transaction
1606+
*
1607+
* @param bool $test_mode = false
1608+
* @return bool
1609+
*/
1610+
public function startTransaction($testMode = false)
1611+
{
1612+
return $this->db->trans_start($testMode);
1613+
}
1614+
1615+
/**
1616+
* Begin Transaction
1617+
*
1618+
* @param bool $test_mode = false
1619+
* @return bool
1620+
*/
1621+
public function beginTransaction($testMode = false)
1622+
{
1623+
return $this->db->trans_begin($testMode);
1624+
}
1625+
1626+
/**
1627+
* Complete Transaction
1628+
*
1629+
* @return bool
1630+
*/
1631+
public function completeTransaction()
1632+
{
1633+
return $this->db->trans_complete();
1634+
}
1635+
1636+
/**
1637+
* Lets you retrieve the transaction flag
1638+
* to determine if it has failed
1639+
*
1640+
* @return bool
1641+
*/
1642+
public function transactionStatus()
1643+
{
1644+
return $this->db->trans_status();
1645+
}
1646+
1647+
/**
1648+
* Rollback Transaction
1649+
*
1650+
* @return bool
1651+
*/
1652+
public function rollbackTransaction()
1653+
{
1654+
return $this->db->trans_rollback();
1655+
}
1656+
1657+
/**
1658+
* Commit Transaction
1659+
*
1660+
* @return bool
1661+
*/
1662+
public function commitTransaction()
1663+
{
1664+
return $this->db->trans_commit();
1665+
}
16031666

16041667
}
16051668
/* end of file Core/core/Models/EasyModel.php */

0 commit comments

Comments
 (0)