private function escape($arg) { return "'" . ($this->connection ? $this->connection->escape($arg) : mysql_escape_string($arg)) . "'"; }
/** * 处理当前链接已经有事务的情况 * * @param ZcDbConnection $conn * @param ZcTransactionDefinition $transactionDefinition */ private function handleExistingTransaction($conn, $transactionDefinition) { if ($transactionDefinition->getPropagationBehavior() == ZcTransactionDefinition::PROPAGATION_REQUIRED) { $status = new ZcTransactionStatus($conn, $transactionDefinition, false); return $status; } if ($transactionDefinition->getPropagationBehavior() == ZcTransactionDefinition::PROPAGATION_NESTED) { if (!$conn->supportsSavepoints()) { throw new ZcDbException("{$conn} do not support savepoints"); } $status = new ZcTransactionStatus($conn, $transactionDefinition, false); $status->createAndHoldSavepoint(); return $status; } }
public function hasTransaction() { return $this->connection->isTransactionActive(); }