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


PHP add_last_sql_error函数代码示例

本文整理汇总了PHP中add_last_sql_error函数的典型用法代码示例。如果您正苦于以下问题:PHP add_last_sql_error函数的具体用法?PHP add_last_sql_error怎么用?PHP add_last_sql_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_last_sql_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Insert

 function Insert()
 {
     $text = pdo_real_escape_string($this->Text);
     // Get this->Id from the database if text is already in the label table:
     $this->Id = pdo_get_field_value("SELECT id FROM label WHERE text='{$text}'", 'id', 0);
     // Or, if necessary, insert a new row, then get the id of the inserted row:
     if (0 == $this->Id) {
         $query = "INSERT INTO label (text) VALUES ('{$text}')";
         if (!pdo_query($query)) {
             add_last_sql_error('Label::Insert');
             return false;
         }
         $this->Id = pdo_insert_id('label');
     }
     // Insert relationship records, too, but only for those relationships
     // established by callers. (If coming from test.php, for example, TestId
     // will be set, but none of the others will. Similarly for other callers.)
     $this->InsertAssociation('label2build', 'buildid', $this->BuildId);
     $this->InsertAssociation('label2buildfailure', 'buildfailureid', $this->BuildFailureId);
     $this->InsertAssociation('label2coveragefile', 'buildid', $this->CoverageFileBuildId, 'coveragefileid', $this->CoverageFileId);
     $this->InsertAssociation('label2dynamicanalysis', 'dynamicanalysisid', $this->DynamicAnalysisId);
     $this->InsertAssociation('label2test', 'buildid', $this->TestBuildId, 'testid', $this->TestId);
     // TODO: Implement this:
     //
     //$this->InsertAssociation($this->UpdateFileKey,
     //  'label2updatefile', 'updatefilekey');
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:28,代码来源:label.php

示例2: Insert

 function Insert()
 {
     if (!$this->BuildId) {
         echo "BuildUserNote::Insert(): BuildId is not set<br>";
         return false;
     }
     if (!$this->UserId) {
         echo "BuildUserNote::Insert(): UserId is not set<br>";
         return false;
     }
     if (!$this->Note) {
         echo "BuildUserNote::Insert(): Note is not set<br>";
         return false;
     }
     if (!$this->TimeStamp) {
         echo "BuildUserNote::Insert(): TimeStamp is not set<br>";
         return false;
     }
     if (!$this->Status) {
         echo "BuildUserNote::Insert(): Status is not set<br>";
         return false;
     }
     $query = "INSERT INTO buildnote (buildid,userid,note,timestamp,status)\n              VALUES ('{$this->BuildId}','{$this->UserId}','{$this->Note}','{$this->TimeStamp}','{$this->Status}')";
     if (!pdo_query($query)) {
         add_last_sql_error("BuildUserNote Insert", 0, $this->BuildId);
         return false;
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:29,代码来源:buildusernote.php

示例3: Save

 /** Save in the database */
 public function Save()
 {
     if (!$this->BuildId) {
         echo 'BuildConfigureErrorDiff::Save(): BuildId not set';
         return false;
     }
     if ($this->Exists()) {
         // Update
         $query = 'UPDATE configureerrordiff SET';
         $query .= ' type=' . qnum($this->Type);
         $query .= ',difference=' . qnum($this->Difference);
         $query .= ' WHERE buildid=' . qnum($this->BuildId);
         if (!pdo_query($query)) {
             add_last_sql_error('BuildConfigureErrorDiff:Update', 0, $this->BuildId);
             return false;
         }
     } else {
         // insert
         $query = 'INSERT INTO configureerrordiff (buildid,type,difference)
              VALUES (' . qnum($this->BuildId) . ',' . qnum($this->Type) . ',' . qnum($this->Difference) . ')';
         if (!pdo_query($query)) {
             add_last_sql_error('BuildConfigureErrorDiff:Create', 0, $this->BuildId);
             return false;
         }
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:28,代码来源:buildconfigureerrordiff.php

示例4: Insert

 function Insert()
 {
     if (!$this->BuildId) {
         echo "BuildTestDiff::Insert(): BuildId is not set<br>";
         return false;
     }
     if ($this->Type != 0 && empty($this->Type)) {
         echo "BuildTestDiff::Insert(): Type is not set<br>";
         return false;
     }
     if (!is_numeric($this->DifferenceNegative)) {
         echo "BuildTestDiff::Insert(): DifferenceNegative is not set<br>";
         return false;
     }
     if (!is_numeric($this->DifferencePositive)) {
         echo "BuildTestDiff::Insert(): DifferencePositive is not set<br>";
         return false;
     }
     $query = "INSERT INTO testdiff (buildid,type,difference_negative,difference_positive) \n              VALUES ('{$this->BuildId}','{$this->Type}','{$this->DifferenceNegative}','{$this->DifferencePositive}')";
     if (!pdo_query($query)) {
         add_last_sql_error("BuildTestDiff Insert", 0, $this->BuildId);
         return false;
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:25,代码来源:buildtestdiff.php

示例5: Save

 /** Save the group */
 public function Save()
 {
     if (!$this->DailyUpdateId) {
         echo 'DailyUpdateFile::Save(): DailyUpdateId not set!';
         return false;
     }
     if (!$this->Filename) {
         echo 'DailyUpdateFile::Save(): Filename not set!';
         return false;
     }
     if (!$this->CheckinDate) {
         echo 'DailyUpdateFile::Save(): CheckinDate not set!';
         return false;
     }
     if ($this->Exists()) {
         // Update the project
         $query = 'UPDATE dailyupdatefile SET';
         $query .= " checkindate='" . $this->CheckinDate . "'";
         $query .= ",author='" . $this->Author . "'";
         $query .= ",log='" . $this->Log . "'";
         $query .= ",revision='" . $this->Revision . "'";
         $query .= ",priorrevision='" . $this->PriorRevision . "'";
         $query .= " WHERE dailyupdateid='" . $this->DailyUpdateId . "' AND filename='" . $this->Filename . "'";
         if (!pdo_query($query)) {
             add_last_sql_error('DailyUpdateFile Update');
             return false;
         }
     } else {
         if (!pdo_query("INSERT INTO dailyupdatefile (dailyupdateid,filename,checkindate,author,log,revision,priorrevision)\n                     VALUES ('{$this->DailyUpdateId}','{$this->Filename}','{$this->CheckinDate}','{$this->Author}','{$this->Log}',\n                     '{$this->Revision}','{$this->PriorRevision}')")) {
             add_last_sql_error('DailyUpdateFile Insert');
             return false;
         }
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:36,代码来源:dailyupdatefile.php

示例6: Insert

 /** Update the content of the file */
 function Insert()
 {
     if (!$this->BuildId || !is_numeric($this->BuildId)) {
         add_log("BuildId not set", "CoverageFileLog::Insert()", LOG_ERR, 0, $this->BuildId, CDASH_OBJECT_COVERAGE, $this->FileId);
         return false;
     }
     if (!$this->FileId || !is_numeric($this->FileId)) {
         add_log("FileId not set", "CoverageFileLog::Insert()", LOG_ERR, 0, $this->BuildId, CDASH_OBJECT_COVERAGE, $this->FileId);
         return false;
     }
     $log = '';
     foreach ($this->Lines as $lineNumber => $code) {
         $log .= $lineNumber . ':' . $code . ';';
     }
     foreach ($this->Branches as $lineNumber => $code) {
         $log .= 'b' . $lineNumber . ':' . $code . ';';
     }
     if ($log != '') {
         $sql = "INSERT INTO coveragefilelog (buildid,fileid,log) VALUES ";
         $sql .= "(" . qnum($this->BuildId) . "," . qnum($this->FileId) . ",'" . $log . "')";
         pdo_query($sql);
         add_last_sql_error("CoverageFileLog::Insert()");
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:26,代码来源:coveragefilelog.php

示例7: SetText

 function SetText($text)
 {
     if ($this->ProjectId == -1) {
         echo "Banner::SetText(): no ProjectId specified";
         return false;
     }
     $this->Text = pdo_real_escape_string($text);
     // Check if the project is already
     if ($this->Exists()) {
         // Update the project
         $query = "UPDATE banner SET";
         $query .= " text='" . $this->Text . "'";
         $query .= " WHERE projectid='" . $this->ProjectId . "'";
         if (!pdo_query($query)) {
             add_last_sql_error("Banner:SetText", $this->ProjectId);
             echo $query;
             return false;
         }
     } else {
         $query = "INSERT INTO banner (projectid,text)\n                VALUES (" . qnum($this->ProjectId) . ",'" . $this->Text . "')";
         if (!pdo_query($query)) {
             add_last_sql_error("Banner:SetText", $this->ProjectId);
             echo $query;
             return false;
         }
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:28,代码来源:banner.php

示例8: GetNumberOfFailures

 /** Get the number of tests that are failing */
 function GetNumberOfFailures($checktesttiming, $testtimemaxstatus)
 {
     if (!$this->BuildId) {
         echo "BuildTest::GetNumberOfFailures(): BuildId not set";
         return false;
     }
     $sql = "SELECT testfailed,testnotrun,testtimestatusfailed FROM build WHERE id=" . qnum($this->BuildId);
     $query = pdo_query($sql);
     if (!$query) {
         add_last_sql_error("BuildTest:GetNumberOfFailures", 0, $this->BuildId);
         return false;
     }
     $nfail_array = pdo_fetch_array($query);
     $sumerrors = 0;
     if ($nfail_array['testfailed'] > 0) {
         $sumerrors += $nfail_array['testfailed'];
     }
     if ($nfail_array['testnotrun'] > 0) {
         $sumerrors += $nfail_array['testnotrun'];
     }
     // Find if the build has any test failings
     if ($checktesttiming) {
         if ($nfail_array['testtimestatusfailed'] > 0) {
             $sumerrors += $nfail_array['testtimestatusfailed'];
         }
     }
     return $sumerrors;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:29,代码来源:buildtest.php

示例9: Save

 /** Save in the database */
 function Save()
 {
     if (!$this->BuildId) {
         echo "BuildConfigureErrorDiff::Save(): BuildId not set";
         return false;
     }
     if ($this->Exists()) {
         // Update
         $query = "UPDATE configureerrordiff SET";
         $query .= " type=" . qnum($this->Type);
         $query .= ",difference=" . qnum($this->Difference);
         $query .= " WHERE buildid=" . qnum($this->BuildId);
         if (!pdo_query($query)) {
             add_last_sql_error("BuildConfigureErrorDiff:Update", 0, $this->BuildId);
             return false;
         }
     } else {
         $query = "INSERT INTO configureerrordiff (buildid,type,difference)\n                 VALUES (" . qnum($this->BuildId) . "," . qnum($this->Type) . "," . qnum($this->Difference) . ")";
         if (!pdo_query($query)) {
             add_last_sql_error("BuildConfigureErrorDiff:Create", 0, $this->BuildId);
             return false;
         }
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:26,代码来源:buildconfigureerrordiff.php

示例10: GetAuthors

 /** Get all the authors of a file */
 public function GetAuthors($filename, $onlylast = false)
 {
     if (!$this->ProjectId) {
         echo 'DailyUpdate::GetAuthors(): ProjectId is not set<br>';
         return false;
     }
     // Check if the note already exists
     $filename = pdo_real_escape_string($filename);
     // Remove
     if (substr($filename, 0, 2) == './') {
         $filename = substr($filename, 2);
     }
     $sql = '';
     if ($onlylast) {
         $sql = ' ORDER BY dailyupdate.id DESC LIMIT 1';
     }
     $query = pdo_query('SELECT DISTINCT up.userid,dailyupdate.id FROM user2project AS up,user2repository AS ur,dailyupdatefile,dailyupdate
                     WHERE dailyupdatefile.dailyupdateid=dailyupdate.id
                     AND dailyupdate.projectid=up.projectid
                     AND ur.credential=dailyupdatefile.author
                     AND up.projectid=' . qnum($this->ProjectId) . '
                     AND up.userid=ur.userid
                     AND (ur.projectid=0 OR ur.projectid=' . qnum($this->ProjectId) . ")\n                        AND dailyupdatefile.filename LIKE '%" . $filename . "'" . $sql);
     if (!$query) {
         add_last_sql_error('DailyUpdate GetAuthors', $this->ProjectId);
         return false;
     }
     $authorids = array();
     while ($query_array = pdo_fetch_array($query)) {
         $authorids[] = $query_array['userid'];
     }
     return $authorids;
 }
开发者ID:kitware,项目名称:cdash,代码行数:34,代码来源:dailyupdate.php

示例11: removeFirstBuilds

/** Remove the first builds that are at the beginning of the queue */
function removeFirstBuilds($projectid, $days, $maxbuilds, $force = false)
{
    require 'config/config.php';
    require_once 'include/pdo.php';
    require_once 'include/common.php';
    @set_time_limit(0);
    if (!$force && !isset($CDASH_AUTOREMOVE_BUILDS)) {
        return;
    }
    if (!$force && $CDASH_AUTOREMOVE_BUILDS != '1') {
        return;
    }
    if ($days < 2) {
        return;
    }
    // First remove the builds with the wrong date
    $currentdate = time() - 3600 * 24 * $days;
    $startdate = date(FMT_DATETIME, $currentdate);
    add_log('about to query for builds to remove', 'removeFirstBuilds');
    $builds = pdo_query("SELECT id FROM build\n            WHERE parentid IN (0, -1) AND\n            starttime<'{$startdate}' AND\n            projectid=" . qnum($projectid) . "\n            ORDER BY starttime ASC LIMIT {$maxbuilds}");
    add_last_sql_error('dailyupdates::removeFirstBuilds');
    $buildids = array();
    while ($builds_array = pdo_fetch_array($builds)) {
        $buildids[] = $builds_array['id'];
    }
    $s = 'removing old buildids for projectid: ' . $projectid;
    add_log($s, 'removeFirstBuilds');
    echo '  -- ' . $s . "\n";
    // for "interactive" command line feedback
    remove_build($buildids);
    // Remove any job schedules that are older than our cutoff date
    // and not due to repeat again.
    require_once 'models/constants.php';
    require_once 'models/clientjobschedule.php';
    $sql = 'SELECT scheduleid FROM client_job AS cj
    LEFT JOIN client_jobschedule AS cjs ON cj.scheduleid = cjs.id
    WHERE cj.status > ' . CDASH_JOB_RUNNING . "\n    AND cjs.projectid={$projectid} AND cj.startdate < '{$startdate}'\n    AND (cjs.repeattime = 0.00 OR\n      (cjs.enddate < '{$startdate}' AND cjs.enddate != '1980-01-01 00:00:00'))";
    $job_schedules = pdo_query($sql);
    while ($job_schedule = pdo_fetch_array($job_schedules)) {
        $ClientJobSchedule = new ClientJobSchedule();
        $ClientJobSchedule->Id = $job_schedule['scheduleid'];
        $ClientJobSchedule->Remove();
    }
    // Remove any jobs that are older than our cutoff date.
    // This occurs when a job schedule is set to continue repeating, but
    // some of its past runs are older than our autoremove threshold.
    require_once 'models/clientjob.php';
    $sql = 'SELECT cj.id FROM client_job AS cj
    LEFT JOIN client_jobschedule AS cjs ON cj.scheduleid = cjs.id
    WHERE cj.status > ' . CDASH_JOB_RUNNING . "\n    AND cjs.projectid={$projectid} AND cj.startdate < '{$startdate}'";
    $jobs = pdo_query($sql);
    while ($job = pdo_fetch_array($jobs)) {
        $ClientJob = new ClientJob();
        $ClientJob->Id = $job['id'];
        $ClientJob->Remove();
    }
}
开发者ID:kitware,项目名称:cdash,代码行数:58,代码来源:autoremove.php

示例12: Insert

 public function Insert()
 {
     $role = pdo_real_escape_string($this->Role);
     $query = "INSERT INTO test2image (imgid,testid,role)\n              VALUES ('{$this->Id}','{$this->TestId}','{$role}')";
     if (!pdo_query($query)) {
         add_last_sql_error('TestImage Insert');
         return false;
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:10,代码来源:testimage.php

示例13: Add

 /** Save the goup position */
 function Add()
 {
     if (!$this->Exists()) {
         if (!pdo_query("INSERT INTO buildgroupposition (buildgroupid,position,starttime,endtime)\n                     VALUES ('{$this->GroupId}','{$this->Position}','{$this->StartTime}','{$this->EndTime}')")) {
             add_last_sql_error("BuildGroupPosition Insert()");
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:12,代码来源:buildgroupposition.php

示例14: Insert

 function Insert()
 {
     $name = pdo_real_escape_string($this->Name);
     $type = pdo_real_escape_string($this->Type);
     $value = pdo_real_escape_string($this->Value);
     $query = "INSERT INTO testmeasurement (testid,name,type,value)\n              VALUES ('{$this->TestId}','{$name}','{$type}','{$value}')";
     if (!pdo_query($query)) {
         add_last_sql_error("TestMeasurement Insert");
         return false;
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:12,代码来源:testmeasurement.php

示例15: Add

 /** Save the goup position */
 public function Add()
 {
     if (empty($this->GroupId) || empty($this->BuildType) || empty($this->BuildName) || empty($this->SiteId) || empty($this->Expected)) {
         return false;
     }
     if (!$this->Exists()) {
         if (!pdo_query("INSERT INTO build2grouprule (groupid,buildtype,buildname,siteid,expected,starttime,endtime)\n                     VALUES ('{$this->GroupId}','{$this->BuildType}','{$this->BuildName}','{$this->SiteId}','{$this->Expected}','{$this->StartTime}','{$this->EndTime}')")) {
             add_last_sql_error('BuildGroupRule Insert()');
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:kitware,项目名称:cdash,代码行数:15,代码来源:buildgrouprule.php


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