當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ca_objects::removeTransaction方法代碼示例

本文整理匯總了PHP中ca_objects::removeTransaction方法的典型用法代碼示例。如果您正苦於以下問題:PHP ca_objects::removeTransaction方法的具體用法?PHP ca_objects::removeTransaction怎麽用?PHP ca_objects::removeTransaction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ca_objects的用法示例。


在下文中一共展示了ca_objects::removeTransaction方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: removeAllObjects

 /**
  * Unlinks any ca_objects rows related to the currently loaded ca_object_lots record. Note that this does *not*
  * delete the related objects. It only removes their link to this lot.  Note that on error, the database maybe left in 
  * an inconsistent state where some objects are still linked to the lot. If you want to prevent this then wrap your
  * call to removeAllObjects in a transaction and rollback the transaction on error.
  *
  * @return boolean Returns true on success, false if there were errors.
  */
 public function removeAllObjects()
 {
     if (!($vn_lot_id = $this->getPrimaryKey())) {
         return null;
     }
     $o_db = $this->getDb();
     $qr_res = $o_db->query("\n\t\t\t\tSELECT object_id\n\t\t\t\tFROM ca_objects\n\t\t\t\tWHERE\n\t\t\t\t\tlot_id = ? AND deleted = 0\n\t\t\t", (int) $vn_lot_id);
     $t_object = new ca_objects();
     if ($o_t = $this->getTransaction()) {
         $t_object->setTransaction($o_t);
     }
     $vb_errors = false;
     while ($qr_res->nextRow()) {
         if ($t_object->load($qr_res->get('object_id'))) {
             $t_object->setMode(ACCESS_WRITE);
             $t_object->set('lot_id', null);
             $t_object->update();
             if ($t_object->numErrors()) {
                 $this->errors = array_merge($this->errors, $t_object->errors);
                 $vb_errors = true;
             }
         }
     }
     if ($t_object->inTransaction()) {
         $t_object->removeTransaction(true);
     }
     return !$vb_errors;
     // return true if no errors, false if errors
 }
開發者ID:ffarago,項目名稱:pawtucket2,代碼行數:37,代碼來源:ca_object_lots.php


注:本文中的ca_objects::removeTransaction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。