本文整理匯總了PHP中Transaction::getCurrentTransaction方法的典型用法代碼示例。如果您正苦於以下問題:PHP Transaction::getCurrentTransaction方法的具體用法?PHP Transaction::getCurrentTransaction怎麽用?PHP Transaction::getCurrentTransaction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Transaction
的用法示例。
在下文中一共展示了Transaction::getCurrentTransaction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: set
/**
* Set string param
*
* @param String $value value to set
*/
public function set($value)
{
$transaction = Transaction::getCurrentTransaction();
if (!$transaction) {
$connection = new Connection();
} else {
$connection = $transaction->getConnection();
}
$connection->escapestring($value);
$this->params[$this->idx++] = "'" . $value . "'";
}
示例2: executeQuery
private static function executeQuery($sqlQuery)
{
self::$transaction = Transaction::getCurrentTransaction();
self::$connection = self::getConnection();
$query = $sqlQuery->getQuery();
self::$connection->executeQuery("SET NAMES 'utf8'");
$result = self::$connection->executeQuery($query);
if (!$result) {
throw new Exception("SQL Error: -->" . $query . "<--" . mysql_error());
}
return $result;
}
示例3: queryForString
/**
* Wykonaniew zapytania do bazy
*
* @param sqlQuery obiekt typu SqlQuery
* @return wynik zapytania
*/
public static function queryForString($sqlQuery){
$transaction = Transaction::getCurrentTransaction();
if(!$transaction){
$connection = new Connection();
}else{
$connection = $transaction->getConnection();
}
$result = $connection->executeQuery($sqlQuery->getQuery());
if(!$result){
throw new Exception(mysql_error());
}
$row = mysql_fetch_array($result);
return $row[0];
}