本文整理匯總了PHP中DB_Transaction函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Transaction函數的具體用法?PHP DB_Transaction怎麽用?PHP DB_Transaction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_Transaction函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Array_UnShift
#-------------------------------------------------------------------------------
Array_UnShift($Params, $Path = SPrintF('Tasks/%s', $Task['TypeID']));
#-------------------------------------------------------------------------------
if (Is_Error(System_Element(SPrintF('comp/%s.comp.php', $Path)))) {
#-------------------------------------------------------------------------------
$FreeLock = DB_Query(SPrintF("SELECT RELEASE_LOCK('Tasks%s')", $TaskID));
if (Is_Error($FreeLock)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
return new gException('TASK_HANDLER_NOT_APPOINTED', 'Заданию не назначен обработчик');
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#--------------------------------TRANSACTION------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('TaskExecute')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$__SYSLOG =& $GLOBALS['__SYSLOG'];
#-------------------------------------------------------------------------------
$Index = Count($__SYSLOG);
#-------------------------------------------------------------------------------
$Result = Call_User_Func_Array('Comp_Load', $Params);
#-------------------------------------------------------------------------------
$Log = Implode("\n", Array_Slice($__SYSLOG, $Index));
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/www/Administrator/API/TaskExecute]: Result = %s',print_r($Result,true)));
switch (ValueOf($Result)) {
case 'error':
示例2: DB_Select
#-------------------------------------------------------------------------
$Group = DB_Select('Groups', 'ID', array('UNIQ', 'Where' => "`IsDefault` = 'yes'"));
#-------------------------------------------------------------------------
switch (ValueOf($Group)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
$IUser['GroupID'] = $Group['ID'];
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('Import')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------
$UserID = DB_Insert('Users', $IUser);
if (Is_Error($UserID)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------
$Contracts = $User['Contracts'];
#-------------------------------------------------------------------------
$Contracts = Is_Array($Contracts) ? $Contracts : array();
#-------------------------------------------------------------------------
foreach ($Contracts as $Contract) {
#-----------------------------------------------------------------------
$TypeID = $Contract['TypeID'];
示例3: SPrintF
/******************************************************************************/
/******************************************************************************/
$Where = SPrintF("`StatusID` = 'Waiting' AND `StatusDate` < UNIX_TIMESTAMP( ) - %d *86400", $Params['Invoices']['DaysBeforeDeleted']);
#-------------------------------------------------------------------------------
$Invoices = DB_Select('InvoicesOwners', array('ID', 'UserID'), array('SortOn' => 'CreateDate', 'IsDesc' => TRUE, 'Where' => $Where));
switch (ValueOf($Invoices)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return TRUE;
case 'array':
#---------------------------------------------------------------------------
foreach ($Invoices as $Invoice) {
Debug(SPrintF("[Tasks/GC/SetDeletedWaitingInvoice]: Отмена счёта #%d.", $Invoice['ID']));
#----------------------------------TRANSACTION----------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/SetDeletedWaitingInvoice')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------
$Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'Invoices', 'StatusID' => 'Rejected', 'RowsIDs' => $Invoice['ID'], 'Comment' => SPrintF('Автоматическая отмена счёта, неоплачен более %d дней', $Params['Invoices']['DaysBeforeDeleted'])));
#-------------------------------------------------------------------------
switch (ValueOf($Comp)) {
case 'array':
$Event = array('UserID' => $Invoice['UserID'], 'PriorityID' => 'Billing', 'Text' => SPrintF('Автоматическая отмена счёта #%d, неоплачен более %d дней', $Invoice['ID'], $Params['Invoices']['DaysBeforeDeleted']));
$Event = Comp_Load('Events/EventInsert', $Event);
if (!$Event) {
return ERROR | @Trigger_Error(500);
}
break;
default:
return ERROR | @Trigger_Error(500);
示例4: foreach
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
foreach ($DomainOrders as $DomainOrder) {
#-------------------------------------------------------------------------------
if (!($DomainOrder['StatusID'] == 'ForTransfer' || $DomainOrder['StatusID'] == 'OnTransfer' && In_Array($DomainOrder['Name'], array('ru', 'su', 'рф')))) {
#-------------------------------------------------------------------------------
Debug(SPrintF("[Tasks/GC/DeleteDomainForTransfer]: Домен не попал в условие: '%s.%s', статус: '%s'", $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID']));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
Debug(SPrintF("[Tasks/GC/DeleteDomainForTransfer]: Удаление домена '%s.%s', статус '%s'", $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID']));
#----------------------------------TRANSACTION----------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/DeleteDomainForTransfer')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'DomainOrders', 'StatusID' => 'Deleted', 'RowsIDs' => $DomainOrder['ID'], 'Comment' => SPrintF('Заказ домена не был перенесён к регистратору %s, более 180 дней', $DomainOrder['Params']['Name'])));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
case 'array':
#-------------------------------------------------------------------------------
$Event = array('UserID' => $DomainOrder['UserID'], 'PriorityID' => 'Hosting', 'Text' => SPrintF('Автоматическое удаление домена (%s.%s), находится в статусе "%s" более 180 дней', $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID']));
$Event = Comp_Load('Events/EventInsert', $Event);
#-------------------------------------------------------------------------------
if (!$Event) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例5: gException
$Theme = (string) @$Args['Theme'];
$Message = (string) @$Args['Message'];
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'libs/Upload.php'))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (!$Theme) {
return new gException('THEME_IS_EMPTY', 'Введите тему обсуждения');
}
#-------------------------------------------------------------------------------
if (!$Message) {
return new gException('MESSAGE_IS_EMPTY', 'Введите сообщение');
}
#-------------------------------------------------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('EdeskEdit')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$__USER = $GLOBALS['__USER'];
#-------------------------------------------------------------------------------
$IEdesk = array('UserID' => $__USER['ID'], 'TargetGroupID' => 1, 'TargetUserID' => 1, 'PriorityID' => 'Low', 'Theme' => $Theme, 'UpdateDate' => Time());
#-------------------------------------------------------------------------------
$EdeskID = DB_Insert('Edesks', $IEdesk);
if (Is_Error($EdeskID)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'Edesks', 'StatusID' => 'Opened', 'RowsIDs' => $EdeskID));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
示例6: array
<?php
#-------------------------------------------------------------------------------
/** @author Alex Keda, for www.host-food.ru */
/******************************************************************************/
/******************************************************************************/
#-------------------------------------------------------------------------------
#---------------------------TRANSACTION-----------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('Dedicated')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$CPUtype = array('Opteron' => 'AMD Opteron', 'Athlon' => 'AMD Athlon', 'Phenom' => 'AMD Phenom', 'Sempron' => 'AMD Sempron', 'Xeon' => 'Intel Xeon', 'Nehalem' => 'Intel Nehalem', 'PentiumD' => 'Pentium D', 'i5' => 'Intel Core i5', 'i3' => 'Intel Core i3', 'c2' => 'Intel Core 2 Duo', 'c4' => 'Intel Core 2 Quad', 'p4' => 'Intel Pentium IV', 'Celeron' => 'Intel Celeron', 'Atom' => 'Intel Atom', 'PIII' => 'Intel Pentium 3');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Schemes = DB_Select('DSSchemes', '*');
#-------------------------------------------------------------------------------
switch (ValueOf($Schemes)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
#-------------------------------------------------------------------------------
$IsUpdate = FALSE;
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
case 'array':
#-------------------------------------------------------------------------------
$IsUpdate = TRUE;
示例7: array
continue;
}
#---------------------------------------------------------------------
$Columns = array('MIN(`CreateDate`) as `CreateDate`', 'ContractID', 'Month', 'ServiceID', 'Comment', 'SUM(`Amount`) as `Amount`', 'Cost', 'Discont');
#---------------------------------------------------------------------
$WorksComplite = DB_Select('WorksComplite', $Columns, array('GroupBy' => array('ContractID', 'ServiceID', 'Comment', 'Cost', 'Discont'), 'Where' => SPrintF('`ContractID` = %u', $Contract['ID'])));
#---------------------------------------------------------------------
switch (ValueOf($WorksComplite)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
# No more...
break;
case 'array':
#---------------------------TRANSACTION---------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('WorksComplite')))) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------
$IsDelete = DB_Delete('WorksComplite', array('Where' => SPrintF('`ContractID` = %u', $Contract['ID'])));
if (Is_Error($IsDelete)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------
foreach ($WorksComplite as $WorkComplite) {
#---------------------------------------------------------------
$IsInsert = DB_Insert('WorksComplite', $WorkComplite);
if (Is_Error($IsInsert)) {
return ERROR | @Trigger_Error(500);
}
}
示例8: Round
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
# заказ существует, он неактивен
$ExistsOrderID = $ExistsOrder['ID'];
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# реализация JBS-940
if (Is_Error(DB_Transaction($TransactionID = UniqID('CostPay')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Services/Bonuses', $Scheme['MinDaysPay'], $ServiceID, $SchemeID, $Order['Row']['UserID'], '0.00', $Scheme['CostDay'], FALSE);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (Is_Error(DB_Roll($TransactionID))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$CostPay = Round($Comp['CostPay'], 2);
#-------------------------------------------------------------------------------
if ($CostPay > 0 && $IsZeroPriceOrder) {
示例9: gException
return ERROR | @Trigger_Error(500);
case 'exception':
return new gException('FIELDS_NOT_DEFINED', 'Поля услуги не определены');
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Validators = $Config['Services']['Fields']['Validators'];
#-------------------------------------------------------------------------------
#---------------------------TRANSACTION-----------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('ServiceOrder')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($ContractID != $Order['ContractID']) {
#-------------------------------------------------------------------------------
$Contract = DB_Select('Contracts', 'ID', array('UNIQ', 'ID' => $ContractID));
#-------------------------------------------------------------------------------
switch (ValueOf($Contract)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
break;
示例10: unset
#-------------------------------------------------------------------------------
if (Is_Null($Task)) {
return 'Пожалуйста, попробуйте повторить попытку позже';
}
#-------------------------------------------------------------------------------
unset($Links[$LinkID]);
return 3600;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
case 'true':
#-------------------------------------------------------------------------------
Debug(SPrintF('[comp/Tasks/SMS]: Отправка успешна, ответ шлюза: %s', $SMS->success));
#-------------------------------------------------------------------------------
if (!$ChargeFree && isset($After)) {
#------------------------------TRANSACTION--------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('PostingSMS')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsUpdated = DB_Update('Contracts', array('Balance' => $After), array('ID' => $ContractID));
if (Is_Error($IsUpdated)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IPosting = array('ContractID' => $ContractID, 'ServiceID' => '2000', 'Comment' => "SMS уведомление ({$SMSCount} шт)", 'Before' => $Contract['Balance'], 'After' => $After);
#-------------------------------------------------------------------------------
$PostingID = DB_Insert('Postings', $IPosting);
if (Is_Error($PostingID)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例11: Comp_Load
case 'false':
return ERROR | @Trigger_Error(700);
case 'true':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Password = Comp_Load('Passwords/Generator');
if (Is_Error($Password)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------TRANSACTION-------------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('DNSmanagerOrder')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Where = SPrintF("`ContractID` = %u AND `TypeID` = 'DNSmanagerRules'", $Contract['ID']);
#-------------------------------------------------------------------------------
$Count = DB_Count('ContractsEnclosures', array('Where' => $Where));
if (Is_Error($Count)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count < 1) {
#-------------------------------------------------------------------------------
$Comp = Comp_Load('www/API/ContractEnclosureMake', array('ContractID' => $Contract['ID'], 'TypeID' => 'DNSmanagerRules'));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
示例12: array
# нет групп, нечего делать
break;
case 'array':
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Array($VPSServersGroups)) {
#-------------------------------------------------------------------------------
#---------------------------TRANSACTION-----------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('VPSServers')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$iServersGroups = array();
#-------------------------------------------------------------------------------
$ServersGroups = DB_Select('ServersGroups', 'ID', array('Where' => '`ServiceID` = 30000'));
#-------------------------------------------------------------------------------
switch (ValueOf($ServersGroups)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
break;
case 'array':
#-------------------------------------------------------------------------------
示例13: gException
}
if ($ToContract['TypeID'] == "NaturalPartner") {
return new gException('ATTEMPT_TRANSFER_TO_Juridical', 'Переводы на партнёрский договор запрещены');
}
# проверяем баланс договора с кторого переводим
if ($FromContract['Balance'] < $Summ) {
$fSumm = Comp_Load('Formats/Currency', $FromContract['Balance']);
if (Is_Error($fSumm)) {
return ERROR | @Trigger_Error(500);
}
return new gException('CONTRACT_BALLANCE_TOO_LOW', 'На балансе выбранного договора слишком мало средств. Введите сумму меньшую или равную ' . $fSumm);
}
#-------------------------------------------------------------------
#-------------------------------------------------------------------
#-----------------------------TRANSACTION-------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('ContractFundsTransfer')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------
$NumberFrom = Comp_Load('Formats/Contract/Number', $FromContract['ID']);
if (Is_Error($NumberFrom)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------
$NumberTo = Comp_Load('Formats/Contract/Number', $ToContract['ID']);
if (Is_Error($NumberTo)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------
# снимаем с одного договора деньгу
#Debug(print_r($GLOBALS, true));
示例14: Config
$Config = Config();
#-------------------------------------------------------------------------------
$PaymentSystems = $Config['Invoices']['PaymentSystems'];
#-------------------------------------------------------------------------------
if (!isset($PaymentSystems[$PaymentSystemID])) {
return new gException('PAYMENT_SYSTEM_NOT_FOUND', 'Платежная система не найдена');
}
#-------------------------------------------------------------------------------
$PaymentSystem = $PaymentSystems[$PaymentSystemID];
#-------------------------------------------------------------------------------
if (!$PaymentSystem['ContractsTypes'][$Contract['TypeID']]) {
return new gException('WRONG_CONTRACT_TYPE', 'Данный вид договора не может быть использован для выписывания счета данного типа');
}
#-------------------------------------------------------------------------------
#-----------------------------TRANSACTION---------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('InvoiceMake')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IInvoice = array('ContractID' => $Contract['ID'], 'PaymentSystemID' => $PaymentSystemID);
#-------------------------------------------------------------------------------
$InvoiceID = DB_Insert('Invoices', $IInvoice);
if (Is_Error($InvoiceID)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Where = SPrintF('`ContractID` = %u', $Contract['ID']);
#-------------------------------------------------------------------------------
$Basket = DB_Select('BasketOwners', array('ID', 'ServiceID', 'Comment', 'OrderID', 'Amount', 'Summ'), array('Where' => $Where));
#-------------------------------------------------------------------------------
示例15: gException
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Source) {
return new gException('NO_SOURCE', 'Не указана исходная платёжная система');
}
#-------------------------------------------------------------------------------
if (!$Destination) {
return new gException('NO_DESTINATION', 'Не указана система оплаты');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$UCollation = array('IsActive' => $IsActive, 'Source' => $Source, 'Destination' => $Destination, 'Image' => $Image, 'Prompt' => $Prompt, 'Description' => $Description, 'AdminNotice' => $AdminNotice, 'SortID' => $SortID);
#-------------------------------------------------------------------------------
#-----------------------------TRANSACTION---------------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('CollationEdit')))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Answer = array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($CollationID) {
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('PaymentSystemsCollation', $UCollation, array('ID' => $CollationID));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
} else {