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


PHP DbHelper::fetchOrInsertApplication方法代碼示例

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


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

示例1: define

define('DIRECT_ACCESS_CHECK', true);
define('BASE_PATH', '../../');
require_once '../updatehelper.php';
require_once BASE_PATH . 'includes/reporthelper.class.php';
$mUpdateHelper = new UpdateHelper();
$mUpdateHelper->begin();
$mUpdateHelper->applySQLUpdateFile();
$mUpdateHelper->exitOnError();
$mUpdateHelper->printStartNextStepMsg("Start updating issues table");
$succeeded = true;
$packages = DbHelper::selectRows(TBL_REPORTS, null, REPORT_PACKAGE_NAME, REPORT_ISSUE . ', ' . REPORT_PACKAGE_NAME, REPORT_ISSUE, null, false);
foreach ($packages as $package) {
    $issueId = $package[0];
    $packageName = $package[1];
    // skip empty package name
    if (strlen($packageName) == 0) {
        $mUpdateHelper->printStepMsg("Found empty package name !", true, false);
        continue;
    }
    $appId = DbHelper::fetchOrInsertApplication($packageName, ReportHelper::formatPackageName($packageName, true));
    if ($appId == -1) {
        $succeeded = false;
    }
    $mUpdateHelper->printStepMsg("Inserted application " . $packageName . ", id is " . $appId, $appId == -1, false);
    $mUpdateHelper->printStepMsg('Update issued #' . $issueId . ' with application id #' . $appId, false, false);
    DbHelper::exec('UPDATE ' . TBL_ISSUES . ' SET ' . ISSUE_APP_ID . '=' . $appId . ' WHERE ' . ISSUE_ID . '=' . $issueId, false);
}
$mUpdateHelper->printEndStepMsg($succeeded, null, false);
$mUpdateHelper->printEndStepMsg(true, null, true);
$mUpdateHelper->end();
開發者ID:xi67,項目名稱:MAB-LAB,代碼行數:30,代碼來源:update.php

示例2: insertSale

 public static function insertSale($values)
 {
     $error = null;
     $packageName = $values[SALE_PRODUCT_ID];
     $appId = DbHelper::fetchOrInsertApplication($packageName, ReportHelper::formatPackageName($packageName, true));
     Debug::logd('Application id #' . $appId, 'INSERT SALE');
     if ($appId > 0) {
         $values[SALE_APP_ID] = $appId;
         $error = self::exec('REPLACE INTO ' . TBL_SALES . ' ' . self::convertArrToInsertValues($values));
         if ($error != null) {
             if (self::countRows(TBL_SALES, SALE_ORDER_NUMBER . '=' . $values[SALE_ORDER_NUMBER]) == 0) {
                 $error = 'Row insertion check failed !';
             }
         }
     } else {
         $error = 'Retreive or insert application failed !';
     }
     return $error;
 }
開發者ID:andi3000,項目名稱:MAB-LAB,代碼行數:19,代碼來源:dbhelper.class.php


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