当前位置: 首页>>代码示例>>PHP>>正文


PHP DbHelper::exec方法代码示例

本文整理汇总了PHP中DbHelper::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP DbHelper::exec方法的具体用法?PHP DbHelper::exec怎么用?PHP DbHelper::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbHelper的用法示例。


在下文中一共展示了DbHelper::exec方法的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: addslashes

    //////// UPDATE ISSUE DETAILS
    case 'updateIssueDetails':
        $error = DbHelper::exec('UPDATE ' . TBL_ISSUES . ' SET ' . ISSUE_MILESTONE_ID . '=' . (empty($_POST['new_milestone']) ? 'null' : $_POST['new_milestone']) . ', ' . ISSUE_COMMENT . '="' . addslashes($_POST['new_comment']) . '"' . ' WHERE ' . ISSUE_ID . '=' . $_POST['issue_id']);
        if ($error == null) {
            Helper::pushAlert(ALERT_SUCCESS, 'Issue updated with success !');
        } else {
            Helper::pushAlert(ALERT_ERROR, 'An error occured while updating the issue !');
        }
        header('Location:index.php?p=' . PAGE_ID_ISSUES);
        break;
        //////// DELETE MILESTONE
    //////// DELETE MILESTONE
    case 'delMilestone':
        $error = null;
        if (isset($_POST['mId']) && $_POST['mId'] > 0) {
            if (DbHelper::exec('DELETE FROM ' . TBL_MILESTONES . ' WHERE ' . MILE_ID . '=' . $_POST['mId']) != null) {
                $error = 'An error occured while deleting milestone !';
            }
        } else {
            $error = 'Invalid milestone id !';
        }
        if ($error == null) {
            Helper::pushAlert(ALERT_SUCCESS, 'Milestone deleted with success !');
        } else {
            Helper::pushAlert(ALERT_ERROR, $error);
        }
        header('Location:index.php?p=' . PAGE_ID_ISSUES . '&n=mil');
        break;
    default:
        die("UNHANDLED ACTION REQUESTED !");
}
开发者ID:xi67,项目名称:MAB-LAB,代码行数:31,代码来源:issuescontroller.php


注:本文中的DbHelper::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。