• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pdo_fetch_array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: copy_build_table

/**
 * Copy table rows by assigning them a new buildid.
 **/
function copy_build_table($old_buildid, $new_buildid, $table)
{
    $result = pdo_query("SELECT * FROM {$table} WHERE buildid={$old_buildid}");
    while ($result_array = pdo_fetch_array($result)) {
        // Remove the old buildid from our SELECT results, as we will be replacing
        // that with the new buildid.
        unset($result_array['buildid']);
        // Generate an INSERT query by listing all of the table columns
        // and their values.  This is slightly complicated by the fact that
        // our array has both string and integer keys.
        $keys = array();
        $values = array();
        foreach ($result_array as $key => $val) {
            if (!is_int($key)) {
                $keys[] = $key;
                $values[] = $val;
            }
        }
        $insert_query = "INSERT INTO {$table} (buildid,";
        $insert_query .= implode(",", $keys) . ")";
        $insert_query .= " VALUES ('{$new_buildid}','";
        $insert_query .= implode("','", $values) . "')";
        pdo_query($insert_query);
    }
}
开发者ID:rpshaw,项目名称:CDash,代码行数:28,代码来源:copy_build_data.php


示例2: Authenticate

 /**
  * Authenticate to the web API as a project admin
  * @param project the name of the project
  * @param key the web API key for that project
  */
 function Authenticate()
 {
     include_once '../cdash/common.php';
     if (!isset($this->Parameters['project'])) {
         return array('status' => false, 'message' => "You must specify a project parameter.");
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         return array('status' => false, 'message' => 'Project not found.');
     }
     if (!isset($this->Parameters['key']) || $this->Parameters['key'] == '') {
         return array('status' => false, 'message' => "You must specify a key parameter.");
     }
     $key = $this->Parameters['key'];
     $query = pdo_query("SELECT webapikey FROM project WHERE id={$projectid}");
     if (pdo_num_rows($query) == 0) {
         return array('status' => false, 'message' => "Invalid projectid.");
     }
     $row = pdo_fetch_array($query);
     $realKey = $row['webapikey'];
     if ($key != $realKey) {
         return array('status' => false, 'message' => "Incorrect API key passed.");
     }
     $token = create_web_api_token($projectid);
     return array('status' => true, 'token' => $token);
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:31,代码来源:api_project.php


示例3: 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


示例4: 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


示例5: get_related_dates

function get_related_dates($projectname, $basedate)
{
    include "cdash/config.php";
    require_once "cdash/pdo.php";
    $dates = array();
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    pdo_select_db("{$CDASH_DB_NAME}", $db);
    $dbQuery = pdo_query("SELECT nightlytime FROM project WHERE name='{$projectname}'");
    if (pdo_num_rows($dbQuery) > 0) {
        $project = pdo_fetch_array($dbQuery);
        $nightlytime = $project['nightlytime'];
        //echo "query result nightlytime: " . $nightlytime . "<br/>";
    } else {
        $nightlytime = "00:00:00";
        //echo "default nightlytime: " . $nightlytime . "<br/>";
    }
    if (!isset($basedate) || strlen($basedate) == 0) {
        $basedate = gmdate(FMT_DATE);
    }
    // Convert the nightly time into GMT
    $nightlytime = gmdate(FMT_TIME, strtotime($nightlytime));
    $nightlyhour = time2hour($nightlytime);
    $nightlyminute = time2minute($nightlytime);
    $nightlysecond = time2second($nightlytime);
    $basemonth = date2month($basedate);
    $baseday = date2day($basedate);
    $baseyear = date2year($basedate);
    $dates['nightly+2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 2, $baseyear);
    $dates['nightly+1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 1, $baseyear);
    $dates['nightly-0'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday, $baseyear);
    $dates['nightly-1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 1, $baseyear);
    $dates['nightly-2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 2, $baseyear);
    // Snapshot of "now"
    //
    $currentgmtime = time();
    $currentgmdate = gmdate(FMT_DATE, $currentgmtime);
    // Find the most recently past nightly time:
    //
    $todaymonth = date2month($currentgmdate);
    $todayday = date2day($currentgmdate);
    $todayyear = date2year($currentgmdate);
    $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    while ($currentnightly > $currentgmtime) {
        $todayday = $todayday - 1;
        $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    }
    $dates['now'] = $currentgmtime;
    $dates['most-recent-nightly'] = $currentnightly;
    $dates['today_utc'] = $currentgmdate;
    $dates['basedate'] = gmdate(FMT_DATE, $dates['nightly-0']);
    // CDash equivalent of DART1's "last rollup time"
    if ($dates['basedate'] === $dates['today_utc']) {
        // If it's today, it's now:
        $dates['last-rollup-time'] = $dates['now'];
    } else {
        // If it's not today, it's the nightly time on the basedate:
        $dates['last-rollup-time'] = $dates['nightly-0'];
    }
    return $dates;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:60,代码来源:viewChanges.php


示例6: CoveragePerDirectory

 /** Return the coverage per directory with the number of lines
  * covered and not covered */
 private function CoveragePerDirectory()
 {
     include_once '../cdash/common.php';
     if (!isset($this->Parameters['project'])) {
         echo "Project not set";
         return;
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         echo "Project not found";
         return;
     }
     // Select the last build that has coverage from the project
     $query = pdo_query("SELECT buildid FROM coveragesummary,build WHERE build.id=coveragesummary.buildid\n                              AND build.projectid='{$projectid}' ORDER BY buildid DESC LIMIT 1");
     echo pdo_error();
     if (pdo_num_rows($query) == 0) {
         echo "No coverage entries found for this project";
         return;
     }
     $query_array = pdo_fetch_array($query);
     $buildid = $query_array['buildid'];
     // Find the coverage files
     $query = pdo_query("SELECT cf.fullpath,c.loctested,c.locuntested FROM coverage as c,coveragefile as cf\n                 WHERE c.fileid=cf.id AND c.buildid='" . $buildid . "' ORDER BY cf.fullpath ASC");
     echo pdo_error();
     $coveragearray = array();
     while ($query_array = pdo_fetch_array($query)) {
         $fullpath = $query_array['fullpath'];
         $paths = explode('/', $fullpath);
         $current = array();
         for ($i = 1; $i < count($paths) - 1; $i++) {
             if ($i == 1) {
                 if (!isset($coveragearray[$paths[$i]])) {
                     $coveragearray[$paths[$i]] = array();
                 }
                 $current =& $coveragearray[$paths[$i]];
             } else {
                 if ($i == count($paths) - 2) {
                     if (isset($current[$paths[$i]])) {
                         $v = $current[$paths[$i]]['locuntested'];
                         $current[$paths[$i]]['locuntested'] = (int) $v + $query_array['locuntested'];
                         $v = $current[$paths[$i]]['loctested'];
                         $current[$paths[$i]]['loctested'] = (int) $v + $query_array['loctested'];
                     } else {
                         @($current[$paths[$i]]['locuntested'] = $query_array['locuntested']);
                         @($current[$paths[$i]]['loctested'] = $query_array['loctested']);
                     }
                     unset($current);
                 } else {
                     $current[$paths[$i]] = array();
                     $current[$paths[$i]]['locuntested'] = 0;
                     $current[$paths[$i]]['loctested'] = 0;
                     $current =& $current[$paths[$i]];
                 }
             }
         }
     }
     return $coveragearray;
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:60,代码来源:api_coverage.php


示例7: testTestHistory

 public function testTestHistory()
 {
     // Submit our testing data.
     $rep = dirname(__FILE__) . '/data/TestHistory';
     if (!$this->submission('InsightExample', "{$rep}/Test_1.xml")) {
         $this->fail('Failed to submit Test_1.xml');
         return 1;
     }
     if (!$this->submission('InsightExample', "{$rep}/Test_2.xml")) {
         $this->fail('Failed to submit Test_1.xml');
         return 1;
     }
     // Get the IDs for the two builds that we just created.
     $result = pdo_query("SELECT id FROM build WHERE name='TestHistory'");
     $num_builds = pdo_num_rows($result);
     if ($num_builds != 2) {
         $this->fail("Expected 2 builds, found {$num_builds}");
         return 1;
     }
     $buildids = array();
     while ($row = pdo_fetch_array($result)) {
         $buildids[] = $row['id'];
     }
     // Verify that testing history matches what we expect.
     $content = $this->connect($this->url . '/api/v1/viewTest.php?groupid=15&previous_builds=' . $buildids[1] . ',+' . $buildids[0] . '&projectid=5&tests%5B%5D=fails&tests%5B%5D=notrun&tests%5B%5D=flaky&tests%5B%5D=passes&time_begin=2015-11-16T01:00:00&time_end=2015-11-17T01:00:00');
     $jsonobj = json_decode($content, true);
     $success = true;
     $error_message = '';
     foreach ($jsonobj['tests'] as $test) {
         $history = $test['history'];
         if ($test['name'] == 'fails' && $history != 'Broken') {
             $error_message = "Expected history for test 'fails' to be 'Broken', instead found '{$history}'";
             $success = false;
         }
         if ($test['name'] == 'notrun' && $history != 'Inactive') {
             $error_message = "Expected history for test 'notrun' to be 'Inactive', instead found '{$history}'";
             $success = false;
         }
         if ($test['name'] == 'flaky' && $history != 'Unstable') {
             $error_message = "Expected history for test 'flaky' to be 'Unstable', instead found '{$history}'";
             $success = false;
         }
         if ($test['name'] == 'passes' && $history != 'Stable') {
             $error_message = "Expected history for test 'passes' to be 'Stable', instead found '{$history}'";
             $success = false;
         }
     }
     // Delete the builds that we created during this test.
     remove_build($buildids[0]);
     remove_build($buildids[1]);
     if ($success) {
         $this->pass('Test passed');
         return 0;
     } else {
         $this->fail($error_message);
         return 1;
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:58,代码来源:test_testhistory.php


示例8: Exists

 /** Return if exists */
 public function Exists()
 {
     $query = pdo_query("SELECT count(*) AS c FROM test2image WHERE imgid='" . $this->Id . "' AND testid='" . $this->TestId . "' AND role='" . $this->Role . "'");
     $query_array = pdo_fetch_array($query);
     if ($query_array['c'] > 0) {
         return true;
     }
     return false;
 }
开发者ID:kitware,项目名称:cdash,代码行数:10,代码来源:testimage.php


示例9: get_last_fileid_dynamicanalysis

/** Get the last file id dynamicanalysis */
function get_last_fileid_dynamicanalysis($filename, $projectid, $siteid, $buildtype, $buildname, $starttime)
{
    $nextbuild = pdo_query("SELECT dynamicanalysis.id FROM build,dynamicanalysis\n                          WHERE build.siteid='{$siteid}' AND build.type='{$buildtype}' AND build.name='{$buildname}'\n                          AND build.projectid='{$projectid}' \n                          AND dynamicanalysis.buildid=build.id\n                          AND dynamicanalysis.name='{$filename}'\n                          ORDER BY build.starttime DESC LIMIT 1");
    if (pdo_num_rows($nextbuild) > 0) {
        $nextbuild_array = pdo_fetch_array($nextbuild);
        return $nextbuild_array["id"];
    }
    return 0;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:10,代码来源:viewDynamicAnalysisFile.php


示例10: Exists

 /** Return if exists */
 function Exists()
 {
     $query = pdo_query("SELECT count(*) AS c FROM banner WHERE projectid=" . qnum($this->ProjectId));
     $query_array = pdo_fetch_array($query);
     if ($query_array['c'] > 0) {
         return true;
     }
     return false;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:10,代码来源:banner.php


示例11: Exists

 /** Return if exists */
 function Exists()
 {
     $query = pdo_query("SELECT count(*) AS c FROM configureerrordiff WHERE buildid=" . qnum($this->BuildId));
     $query_array = pdo_fetch_array($query);
     if ($query_array['c'] > 0) {
         return true;
     }
     return false;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:10,代码来源:buildconfigureerrordiff.php


示例12: GetSite

 /** Get Site */
 public function GetSite()
 {
     if (!$this->Id) {
         add_log('ClientJob::GetSite', 'Id not set');
         return;
     }
     $sys = pdo_query('SELECT siteid FROM client_job WHERE id=' . qnum($this->Id));
     $row = pdo_fetch_array($sys);
     return $row[0];
 }
开发者ID:kitware,项目名称:cdash,代码行数:11,代码来源:clientjob.php


示例13: GetNumberOfErrors

 /** Find how many dynamic analysis tests were failed or notrun status */
 public function GetNumberOfErrors()
 {
     if (strlen($this->BuildId) == 0) {
         echo 'DynamicAnalysis::GetNumberOfErrors BuildId not set';
         return false;
     }
     $query = 'SELECT count(*) FROM dynamicanalysis WHERE buildid=' . qnum($this->BuildId) . " AND status IN ('notrun','failed')";
     $errorcount = pdo_query($query);
     $error_array = pdo_fetch_array($errorcount);
     return $error_array[0];
 }
开发者ID:kitware,项目名称:cdash,代码行数:12,代码来源:dynamicanalysis.php


示例14: Insert

 public function Insert()
 {
     if (!$this->BuildId) {
         add_log('BuildId not set', 'BuildNote::Insert()', LOG_ERR, 0, $this->Id);
         return false;
     }
     if (!$this->Time) {
         add_log('Time not set', 'BuildNote::Insert()', LOG_ERR, 0, $this->Id);
         return false;
     }
     if (!$this->Name) {
         add_log('Name not set', 'BuildNote::Insert()', LOG_ERR, 0, $this->Id);
         return false;
     }
     if (!$this->Text) {
         add_log('Text not set', 'BuildNote::Insert()', LOG_ERR, 0, $this->Id);
         return false;
     }
     // Check if the note already exists
     $crc32 = $this->GetCrc32();
     $text = pdo_real_escape_string($this->Text);
     $timestamp = pdo_real_escape_string($this->Time);
     $name = pdo_real_escape_string($this->Name);
     $notecrc32 = pdo_query("SELECT id FROM note WHERE crc32='{$crc32}'");
     if (pdo_num_rows($notecrc32) == 0) {
         if ($this->Id) {
             $query = "INSERT INTO note (id,text,name,crc32) VALUES ('{$this->Id}','{$text}','{$name}','{$crc32}')";
         } else {
             $query = "INSERT INTO note (text,name,crc32) VALUES ('{$text}','{$name}','{$crc32}')";
         }
         if (!pdo_query($query)) {
             add_last_sql_error('BuildNote:Insert', 0, $this->BuildId);
             return false;
         }
         if (!$this->Id) {
             $this->Id = pdo_insert_id('note');
         }
     } else {
         // already there
         $notecrc32_array = pdo_fetch_array($notecrc32);
         $this->Id = $notecrc32_array['id'];
     }
     if (!$this->Id) {
         echo 'BuildNote::Insert(): No NoteId';
         return false;
     }
     $query = "INSERT INTO build2note (buildid,noteid,time)\n            VALUES ('{$this->BuildId}','{$this->Id}','{$this->Time}')";
     if (!pdo_query($query)) {
         add_last_sql_error('BuildNote:Insert', 0, $this->BuildId);
         return false;
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:53,代码来源:buildnote.php


示例15: Insert

 function Insert()
 {
     if (!$this->BuildId) {
         echo "BuildNote::Insert(): BuildId is not set<br>";
         return false;
     }
     if (!$this->Time) {
         echo "BuildNote::Insert(): Time is not set<br>";
         return false;
     }
     if (!$this->Name) {
         echo "BuildNote::Insert(): Name is not set<br>";
         return false;
     }
     if (!$this->Text) {
         echo "BuildNote::Insert(): Text is not set<br>";
         return false;
     }
     // Check if the note already exists
     $crc32 = $this->GetCrc32();
     $text = pdo_real_escape_string($this->Text);
     $timestamp = pdo_real_escape_string($this->Time);
     $name = pdo_real_escape_string($this->Name);
     $notecrc32 = pdo_query("SELECT id FROM note WHERE crc32='{$crc32}'");
     if (pdo_num_rows($notecrc32) == 0) {
         if ($this->Id) {
             $query = "INSERT INTO note (id,text,name,crc32) VALUES ('{$this->Id}','{$text}','{$name}','{$crc32}')";
         } else {
             $query = "INSERT INTO note (text,name,crc32) VALUES ('{$text}','{$name}','{$crc32}')";
         }
         if (!pdo_query($query)) {
             add_last_sql_error("BuildNote:Insert", 0, $this->BuildId);
             return false;
         }
         if (!$this->Id) {
             $this->Id = pdo_insert_id("note");
         }
     } else {
         $notecrc32_array = pdo_fetch_array($notecrc32);
         $this->Id = $notecrc32_array["id"];
     }
     if (!$this->Id) {
         echo "BuildNote::Insert(): No NoteId";
         return false;
     }
     $query = "INSERT INTO build2note (buildid,noteid,time)\n              VALUES ('{$this->BuildId}','{$this->Id}','{$this->Time}')";
     if (!pdo_query($query)) {
         add_last_sql_error("BuildNote:Insert", 0, $this->BuildId);
         return false;
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:52,代码来源:buildnote.php


示例16: Exists

 /** Check if the rule already exists */
 public function Exists()
 {
     // If no id specify return false
     if (empty($this->GroupId) || empty($this->BuildType) || empty($this->BuildName) || empty($this->SiteId)) {
         return false;
     }
     $query = pdo_query("SELECT count(*) AS c FROM build2grouprule WHERE\n                        groupid='" . $this->GroupId . "' AND buildtype='" . $this->BuildType . "'\n                        AND buildname='" . $this->BuildName . "'\n                        AND siteid='" . $this->SiteId . "'\n                        AND starttime='" . $this->StartTime . "'\n                        AND endtime='" . $this->EndTime . "'");
     $query_array = pdo_fetch_array($query);
     if ($query_array['c'] == 0) {
         return false;
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:14,代码来源:buildgrouprule.php


示例17: Exists

 /** Check if exists */
 public function Exists()
 {
     // If no id specify return false
     if (!$this->DailyUpdateId || !$this->Filename) {
         return false;
     }
     $query = pdo_query("SELECT count(*) AS c FROM dailyupdatefile WHERE dailyupdateid='" . $this->DailyUpdateId . "' AND filename='" . $this->Filename . "'");
     $query_array = pdo_fetch_array($query);
     if ($query_array['c'] == 0) {
         return false;
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:14,代码来源:dailyupdatefile.php


示例18: Exists

 /** Check if the position already exists */
 function Exists()
 {
     // If no id specify return false
     if (!$this->GroupId) {
         return false;
     }
     $query = pdo_query("SELECT count(*) AS c FROM buildgroupposition WHERE \n                        buildgroupid='" . $this->GroupId . "' AND position='" . $this->Position . "'\n                        AND starttime='" . $this->StartTime . "'\n                        AND endtime='" . $this->EndTime . "'");
     $query_array = pdo_fetch_array($query);
     if ($query_array['c'] == 0) {
         return false;
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:14,代码来源:buildgroupposition.php


示例19: testBuildsRemovedOnSubmission

 function testBuildsRemovedOnSubmission()
 {
     $this->enableAutoRemoveConfigSetting();
     $this->setAutoRemoveTimeFrame();
     $this->deleteLog($this->logfilename);
     $this->startCodeCoverage();
     $result = $this->db->query("SELECT id FROM project WHERE name = 'EmailProjectExample'");
     $projectid = $result[0]['id'];
     // Submit the first build
     $rep = dirname(__FILE__) . "/data/EmailProjectExample";
     $testxml1 = "{$rep}/1_test.xml";
     if (!$this->submission('EmailProjectExample', $testxml1)) {
         $this->fail("submission 1 failed");
         $this->stopCodeCoverage();
         return;
     }
     // Check that the test is actually there
     if (!($query = pdo_query("SELECT name FROM build WHERE projectid='{$projectid}' AND stamp='20090223-0100-Nightly'"))) {
         $this->fail("pdo_query returned false");
         return 1;
     }
     $query_array = pdo_fetch_array($query);
     if ($query_array[0] != 'Win32-MSVC2009') {
         echo $query_array[0];
         $this->fail("First build not inserted correctly");
         return 1;
     }
     // Looks like it's a new day
     $this->db->query("DELETE FROM dailyupdate WHERE projectid='{$projectid}'");
     $testxml2 = "{$rep}/2_test.xml";
     if (!$this->submission('EmailProjectExample', $testxml2)) {
         $this->fail("submission 2 failed");
         $this->stopCodeCoverage();
         return 1;
     }
     // The removal of the builds are done asynchronously so we might need to wait a little bit
     // in order for the process to be done
     sleep(10);
     // seconds
     // Check that the first test is gone
     if (!($query = pdo_query("SELECT id FROM build WHERE projectid='{$projectid}' AND stamp='20090223-0100-Nightly'"))) {
         $this->fail("pdo_query returned false");
         return 1;
     }
     if (pdo_num_rows($query) > 0) {
         $this->fail("Auto remove build on submit failed");
         return 1;
     }
     $this->pass("Passed");
     $this->stopCodeCoverage();
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:51,代码来源:test_autoremovebuilds_on_submit.php


示例20: ListDefects

 /** List Defects */
 private function ListDefects()
 {
     include_once 'cdash/common.php';
     if (!isset($this->Parameters['project'])) {
         echo "Project not set";
         return;
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         echo "Project not found";
         return;
     }
     // We need multiple queries (4 to be exact)
     // First for the build failures
     $users = array();
     $query = pdo_query("SELECT SUM(errors) AS nerrors,SUM(nfiles) AS nfiles,author FROM(\n            SELECT b.id,bed.difference_positive AS errors,u.author,\n            COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n            FROM build2group AS b2g, buildgroup AS bg,updatefile AS u,build2update AS b2u, builderrordiff AS bed, build AS b\n            WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n            AND bed.buildid=b.id AND bed.difference_positive>0 AND bed.difference_negative!=bed.difference_positive\n            AND b.starttime<NOW()\n            GROUP BY b.id,bed.difference_positive,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['builderrors'] = $query_array['nerrors'];
         $users[$query_array['author']]['builderrorsfiles'] = $query_array['nfiles'];
     }
     // Then for the build fixes
     $query = pdo_query("SELECT SUM(fixes) AS nfixes,SUM(nfiles) AS nfiles,author FROM(\n            SELECT b.id,bed.difference_positive AS errors,bed.difference_negative AS fixes,u.author,\n            COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n            FROM build2group AS b2g, buildgroup AS bg,updatefile AS u,build2update AS b2u, builderrordiff AS bed, build AS b\n            WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n            AND bed.buildid=b.id AND bed.difference_negative>0 AND bed.difference_positive<bed.difference_negative\n            AND b.starttime<NOW()\n            GROUP BY b.id,bed.difference_positive,bed.difference_negative,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['buildfixes'] = $query_array['nfixes'];
         $users[$query_array['author']]['buildfixesfiles'] = $query_array['nfiles'];
     }
     // Then for the test failures
     $query = pdo_query("SELECT SUM(testerrors) AS ntesterrors,SUM(nfiles) AS nfiles,author FROM(SELECT b.id, td.difference_positive AS testerrors,\n              u.author,COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n              FROM build2group AS b2g, buildgroup AS bg,updatefile AS u, build2update AS b2u, build AS b, testdiff AS td\n              WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n              AND td.buildid=b.id AND td.difference_positive>0 AND td.type=1\n              AND b.starttime<NOW()\n              GROUP BY b.id,td.difference_positive,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['testerrors'] = $query_array['ntesterrors'];
         $users[$query_array['author']]['testerrorsfiles'] = $query_array['nfiles'];
     }
     // Then for the test fixes
     $query = pdo_query("SELECT SUM(testfixes) AS ntestfixes,SUM(nfiles) AS nfiles,author FROM(SELECT b.id, td.difference_positive AS testfixes,\n              u.author,COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n              FROM build2group AS b2g, buildgroup AS bg,updatefile AS u, build2update AS b2u, build AS b, testdiff AS td\n              WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n              AND td.buildid=b.id AND td.difference_positive>0 AND td.type=2 AND td.difference_negative=0\n              AND b.starttime<NOW()\n              GROUP BY b.id,td.difference_positive,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['testfixes'] = $query_array['ntestfixes'];
         $users[$query_array['author']]['testfixesfiles'] = $query_array['nfiles'];
     }
     // Another select for neutral
     $query = pdo_query("SELECT b.id, bed.difference_positive AS errors,\n          u.author AS author,count(*) AS nfiles\n         FROM build2group AS b2g, buildgroup AS bg,updatefile AS u, build2update AS b2u, build AS b\n         LEFT JOIN builderrordiff AS bed ON (bed.buildid=b.id AND difference_positive!=difference_negative)\n         LEFT JOIN testdiff AS t ON (t.buildid=b.id)\n         WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n         AND bed.difference_positive IS NULL\n         AND t.difference_positive IS NULL\n         AND b.starttime<NOW() GROUP BY u.author,b.id,bed.difference_positive");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['neutralfiles'] = $query_array['nfiles'];
     }
     return $users;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:51,代码来源:api_user.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pdo_fetch_assoc函数代码示例发布时间:2022-05-15
下一篇:
PHP pdo_fetch函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap