示例#1
0
 public function __construct(kxDB &$connection, $name = NULL)
 {
     $this->connection =& $connection;
     // If there is no transaction depth, then no transaction has started. Name
     // the transaction 'drupal_transaction'.
     if (!($depth = $connection->transactionDepth())) {
         $this->name = 'drupal_transaction';
     } elseif (!$name) {
         $this->name = 'savepoint_' . $depth;
     } else {
         $this->name = $name;
     }
     $this->connection->pushTransaction($this->name);
 }
示例#2
0
 public function pushTransaction($name)
 {
     if ($this->savepointSupport) {
         return parent::pushTransaction($name);
     }
     if (!$this->supportsTransactions()) {
         return;
     }
     if (isset($this->transactionLayers[$name])) {
         throw new DatabaseTransactionNameNonUniqueException($name . " is already in use.");
     }
     if (!$this->inTransaction()) {
         PDO::beginTransaction();
     }
     $this->transactionLayers[$name] = $name;
 }