blob: 4fb18c84ae931462574a8aec9120aa3d273be7cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
Prado::using('Application.db.DBTransaction');
Prado::using('System.Data.TDbConnection');
class DBConnection extends TDbConnection {
public function __construct($dsn = '', $username = '', $password = '', $charset = '') {
$this->setTransactionClass('Application.Code.DBTransaction');
parent::__construct($dsn, $username, $password, $charset);
}
private $_transaction = NULL;
public function getCurrentTransaction() {
if (!$this->_transaction->getActive()) {
$this->_transaction = NULL;
}
return $this->_transaction;
}
public function beginTransaction() {
if ($this->_transaction && $this->_transaction->getActive()) {
$this->_transaction->beginNestedTransaction();
}
else {
$this->_transaction = parent::beginTransaction();
}
return $this->_transaction;
}
}
?>
|