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

PHP pdo_single_row_query函数代码示例

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

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



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

示例1: testSetupRepositories

 public function testSetupRepositories()
 {
     $insight = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='InsightExample'");
     $insight->Id = $row['id'];
     $insight->Fill();
     $insight->AddRepositories(array(':pserver:[email protected]:/cvsroot/Insight'), array('anoncvs'), array(''), array(''));
     $insight->CTestTemplateScript = 'client testing works';
     $insight->Save();
     $pub = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='PublicDashboard'");
     $pub->Id = $row['id'];
     $pub->Fill();
     $pub->AddRepositories(array('git://cmake.org/cmake.git'), array(''), array(''), array(''));
     $pub->CvsViewerType = 'gitweb';
     $pub->CvsUrl = 'cmake.org/gitweb?p=cmake.git';
     $pub->Save();
     $email = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='EmailProjectExample'");
     $email->Id = $row['id'];
     $email->Fill();
     $email->AddRepositories(array('https://www.kitware.com/svn/CDash/trunk'), array(''), array(''), array(''));
     $pub->CvsViewerType = 'websvn';
     $email->CvsUrl = 'https://www.kitware.com/svn/CDash/trunk';
     $email->Save();
 }
开发者ID:kitware,项目名称:cdash,代码行数:26,代码来源:test_setup_repositories.php


示例2: expectedTest

 private function expectedTest($buildname, $projectname)
 {
     // Mark an old build as expected.
     $query = "\n            SELECT b.siteid, b.type, g.id AS groupid FROM build AS b\n            INNER JOIN build2group AS b2g ON (b.id=b2g.buildid)\n            INNER JOIN buildgroup AS g ON (b2g.groupid=g.id)\n            WHERE b.name='{$buildname}'";
     if ($projectname === 'Trilinos') {
         $query .= ' AND b.parentid=-1';
     }
     $build_row = pdo_single_row_query($query);
     $groupid = $build_row['groupid'];
     $buildtype = $build_row['type'];
     $siteid = $build_row['siteid'];
     if (!pdo_query("\n                    INSERT INTO build2grouprule(groupid,buildtype,buildname,siteid,expected,starttime,endtime)\n                    VALUES ('{$groupid}','{$buildtype}','{$buildname}','{$siteid}','1','2013-01-01 00:00:00','1980-01-01 00:00:00')")) {
         $this->fail("Error marking {$buildname} as expected");
         return 1;
     }
     // Verify that our API lists this build even though it hasn't submitted today.
     $this->get($this->url . "/api/v1/index.php?project={$projectname}");
     $content = $this->getBrowser()->getContent();
     $jsonobj = json_decode($content, true);
     $buildgroup = array_pop($jsonobj['buildgroups']);
     $found = false;
     foreach ($buildgroup['builds'] as $build) {
         if ($build['buildname'] == $buildname && $build['expectedandmissing'] == 1) {
             $found = true;
         }
     }
     // Make it unexpected again.
     pdo_query("DELETE FROM build2grouprule WHERE buildname='{$buildname}'");
     if (!$found) {
         $this->fail("Expected missing build '{$buildname}' not included");
         return 1;
     }
     $this->pass('Passed');
     return 0;
 }
开发者ID:kitware,项目名称:cdash,代码行数:35,代码来源:test_expectedandmissing.php


示例3: testTruncateOutput

 public function testTruncateOutput()
 {
     // Set a limit so long output will be truncated.
     $this->addLineToConfig($this->ConfigLine);
     // Submit our testing data.
     $rep = dirname(__FILE__) . "/data/TruncateOutput";
     if (!$this->submission('InsightExample', "{$rep}/Build.xml")) {
         $this->fail("failed to submit Build.xml");
         $this->cleanup();
         return 1;
     }
     // Query for the ID of the build that we just created.
     $buildid_results = pdo_single_row_query("SELECT id FROM build WHERE name='TruncateOutput'");
     $this->BuildId = $buildid_results['id'];
     // Verify that the output was properly truncated.
     $this->get($this->url . "/api/v1/viewBuildError.php?buildid=" . $this->BuildId);
     $content = $this->getBrowser()->getContent();
     $jsonobj = json_decode($content, true);
     foreach ($jsonobj['errors'] as $error) {
         if ($error['stdoutput'] != $this->Expected) {
             $this->fail("Expected {$this->Expected}, found " . $error['stdoutput']);
             $this->cleanup();
             return 1;
         }
         if ($error['stderror'] != $this->Expected) {
             $this->fail("Expected {$this->Expected}, found " . $error['stderror']);
             $this->cleanup();
             return 1;
         }
     }
     $this->cleanup();
     $this->pass("Passed");
     return 0;
 }
开发者ID:kitware,项目名称:cdash,代码行数:34,代码来源:test_truncateoutput.php


示例4: echo_currently_processing_submissions

function echo_currently_processing_submissions()
{
    include "cdash/config.php";
    if ($CDASH_DB_TYPE == "pgsql") {
        $sql_query = "SELECT now() AT TIME ZONE 'UTC'";
    } else {
        $sql_query = "SELECT UTC_TIMESTAMP()";
    }
    $current_time = pdo_single_row_query($sql_query);
    $sql_query = "SELECT project.name, submission.*, ";
    if ($CDASH_DB_TYPE == "pgsql") {
        $sql_query .= "round((extract(EPOCH FROM now() - created)/3600)::numeric, 2) AS hours_ago ";
    } else {
        $sql_query .= "ROUND(TIMESTAMPDIFF(SECOND, created, UTC_TIMESTAMP)/3600, 2) AS hours_ago ";
    }
    $sql_query .= "FROM " . qid("project") . ", " . qid("submission") . " " . "WHERE project.id = submission.projectid AND status = 1";
    $rows = pdo_all_rows_query($sql_query);
    $sep = ', ';
    echo "<h3>Currently Processing Submissions as of " . $current_time[0] . " UTC</h3>";
    echo '<pre>';
    if (count($rows) > 0) {
        echo 'project name, backlog in hours' . "\n";
        echo '    submission.id, filename, projectid, status, attempts, filesize, filemd5sum, lastupdated, created, started, finished' . "\n";
        echo "\n";
        foreach ($rows as $row) {
            echo $row['name'] . $sep . $row['hours_ago'] . ' hours behind' . "\n";
            echo "    " . $row['id'] . $sep . $row['filename'] . $sep . $row['projectid'] . $sep . $row['status'] . $sep . $row['attempts'] . $sep . $row['filesize'] . $sep . $row['filemd5sum'] . $sep . $row['lastupdated'] . $sep . $row['created'] . $sep . $row['started'] . $sep . $row['finished'] . "\n";
            echo "\n";
        }
    } else {
        echo 'Nothing is currently processing...' . "\n";
    }
    echo '</pre>';
    echo '<br/>';
}
开发者ID:rpshaw,项目名称:CDash,代码行数:35,代码来源:monitor.php


示例5: MD5Exists

 function MD5Exists()
 {
     $md5 = pdo_real_escape_string($this->md5);
     $row = pdo_single_row_query("SELECT buildid FROM buildfile WHERE md5='" . $md5 . "'");
     if (empty($row)) {
         return false;
     }
     return $row[0];
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:9,代码来源:buildfile.php


示例6: pdo_get_field_value

function pdo_get_field_value($qry, $fieldname, $default)
{
    $row = pdo_single_row_query($qry);
    if (!empty($row)) {
        $f = $row["{$fieldname}"];
    } else {
        $f = $default;
    }
    return $f;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:10,代码来源:pdo.php


示例7: testBuildGetDate

 public function testBuildGetDate()
 {
     $retval = 0;
     $build = new Build();
     $build->Id = 1;
     $build->ProjectId = 1;
     $build->Filled = true;
     $row = pdo_single_row_query('SELECT nightlytime FROM project WHERE id=1');
     $original_nightlytime = $row['nightlytime'];
     // Test the case where the project's start time is in the evening.
     pdo_query("UPDATE project SET nightlytime = '20:00:00' WHERE id=1");
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 19:59:59'));
     $expected_date = '2009-02-23';
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Evening case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 20:00:00'));
     $expected_date = '2009-02-24';
     $build->NightlyStartTime = false;
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Evening case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     // Test the case where the project's start time is in the morning.
     pdo_query("UPDATE project SET nightlytime = '09:00:00' WHERE id=1");
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 08:59:59'));
     $expected_date = '2009-02-22';
     $build->NightlyStartTime = false;
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Morning case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 09:00:00'));
     $expected_date = '2009-02-23';
     $build->NightlyStartTime = false;
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Morning case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     pdo_query("UPDATE project SET nightlytime = '{$original_nightlytime}' WHERE id=1");
     if ($retval === 0) {
         $this->pass('Tests passed');
     }
     return $retval;
 }
开发者ID:kitware,项目名称:cdash,代码行数:50,代码来源:test_buildgetdate.php


示例8: Exists

 /** Return whether or not a CoverageSummaryDiff exists for this build. */
 public function Exists()
 {
     if (!$this->BuildId) {
         return false;
     }
     $exists_result = pdo_single_row_query('SELECT COUNT(1) AS numrows FROM coveragesummarydiff
             WHERE buildid=' . qnum($this->BuildId));
     if ($exists_result && array_key_exists('numrows', $exists_result)) {
         $numrows = $exists_result['numrows'];
         if ($numrows > 0) {
             return true;
         }
     }
     return false;
 }
开发者ID:kitware,项目名称:cdash,代码行数:16,代码来源:coveragesummarydiff.php


示例9: get_dynamic_builds

function get_dynamic_builds($projectid, $end_UTCDate)
{
    $builds = array();
    // Get the build rules for each dynamic group belonging to this project.
    $rules = pdo_query("\n    SELECT b2gr.buildname, b2gr.siteid, b2gr.parentgroupid, bg.id, bg.name,\n           bg.type, gp.position\n    FROM build2grouprule AS b2gr\n    LEFT JOIN buildgroup AS bg ON (bg.id = b2gr.groupid)\n    LEFT JOIN buildgroupposition AS gp ON (gp.buildgroupid=bg.id)\n    WHERE bg.projectid='{$projectid}' AND bg.endtime='1980-01-01 00:00:00' AND\n          bg.type != 'Daily'");
    if (!$rules) {
        echo pdo_error();
        return;
    }
    while ($rule = pdo_fetch_array($rules)) {
        $buildgroup_name = $rule['name'];
        $buildgroup_id = $rule['id'];
        $buildgroup_position = $rule['position'];
        if ($rule['type'] == 'Latest') {
            // optional fields: parentgroupid, site, and build name match.
            // Use these to construct a WHERE clause for our query.
            $where = '';
            $whereClauses = array();
            if (!empty($rule['parentgroupid'])) {
                $whereClauses[] = "b2g.groupid='" . $rule['parentgroupid'] . "'";
            }
            if (!empty($rule['siteid'])) {
                $whereClauses[] = "s.id='" . $rule['siteid'] . "'";
            }
            if (!empty($rule['buildname'])) {
                $whereClauses[] = "b.name LIKE '" . $rule['buildname'] . "'";
            }
            if (!empty($whereClauses)) {
                $where = 'WHERE ' . implode($whereClauses, ' AND ');
                $where .= " AND b.starttime<'{$end_UTCDate}'";
            }
            // We only want the most recent build.
            $order = 'ORDER BY b.submittime DESC LIMIT 1';
            $sql = get_index_query();
            $sql .= "{$where} {$order}";
            $build = pdo_single_row_query($sql);
            if (empty($build)) {
                continue;
            }
            $build['groupname'] = $buildgroup_name;
            $build['groupid'] = $buildgroup_id;
            $build['position'] = $buildgroup_position;
            $builds[] = $build;
        }
    }
    return $builds;
}
开发者ID:kitware,项目名称:cdash,代码行数:47,代码来源:index_functions.php


示例10: get_dynamic_builds

function get_dynamic_builds($projectid)
{
    $builds = array();
    // Get the build rules for each dynamic group belonging to this project.
    $rules = pdo_query("\n    SELECT b2gr.buildname, b2gr.siteid, b2gr.parentgroupid, bg.id, bg.name,\n           bg.type, gp.position\n    FROM build2grouprule AS b2gr\n    LEFT JOIN buildgroup AS bg ON (bg.id = b2gr.groupid)\n    LEFT JOIN buildgroupposition AS gp ON (gp.buildgroupid=bg.id)\n    WHERE bg.projectid='{$projectid}' AND bg.endtime='1980-01-01 00:00:00' AND\n          bg.type != 'Daily'");
    if (!$rules) {
        echo pdo_error();
        return;
    }
    while ($rule = pdo_fetch_array($rules)) {
        $buildgroup_name = $rule['name'];
        $buildgroup_id = $rule['id'];
        $buildgroup_position = $rule['position'];
        if ($rule['type'] == 'Latest') {
            // optional fields: parentgroupid, site, and build name match.
            // Use these to construct a WHERE clause for our query.
            $where = "";
            $whereClauses = array();
            if (!empty($rule['parentgroupid'])) {
                $whereClauses[] = "b2g.groupid='" . $rule['parentgroupid'] . "'";
            }
            if (!empty($rule['siteid'])) {
                $whereClauses[] = "s.id='" . $rule['siteid'] . "'";
            }
            if (!empty($rule['buildname'])) {
                $whereClauses[] = "b.name LIKE '" . $rule['buildname'] . "'";
            }
            if (!empty($whereClauses)) {
                $where = "WHERE " . implode($whereClauses, " AND ");
            }
            // We only want the most recent build.
            $order = "ORDER BY b.submittime DESC LIMIT 1";
            // Copied from index.php.
            $sql = "SELECT b.id,b.siteid,b.parentid,\n              bu.status AS updatestatus,\n              i.osname AS osname,\n              bu.starttime AS updatestarttime,\n              bu.endtime AS updateendtime,\n              bu.nfiles AS countupdatefiles,\n              bu.warnings AS countupdatewarnings,\n              c.status AS configurestatus,\n              c.starttime AS configurestarttime,\n              c.endtime AS configureendtime,\n              be_diff.difference_positive AS countbuilderrordiffp,\n              be_diff.difference_negative AS countbuilderrordiffn,\n              bw_diff.difference_positive AS countbuildwarningdiffp,\n              bw_diff.difference_negative AS countbuildwarningdiffn,\n              ce_diff.difference AS countconfigurewarningdiff,\n              btt.time AS testsduration,\n              tnotrun_diff.difference_positive AS counttestsnotrundiffp,\n              tnotrun_diff.difference_negative AS counttestsnotrundiffn,\n              tfailed_diff.difference_positive AS counttestsfaileddiffp,\n              tfailed_diff.difference_negative AS counttestsfaileddiffn,\n              tpassed_diff.difference_positive AS counttestspasseddiffp,\n              tpassed_diff.difference_negative AS counttestspasseddiffn,\n              tstatusfailed_diff.difference_positive AS countteststimestatusfaileddiffp,\n              tstatusfailed_diff.difference_negative AS countteststimestatusfaileddiffn,\n              (SELECT count(buildid) FROM build2note WHERE buildid=b.id)  AS countnotes,\n              (SELECT count(buildid) FROM buildnote WHERE buildid=b.id) AS countbuildnotes,\n              s.name AS sitename,\n              s.outoforder AS siteoutoforder,\n              b.stamp,b.name,b.type,b.generator,b.starttime,b.endtime,b.submittime,\n              b.configureerrors AS countconfigureerrors,\n              b.configurewarnings AS countconfigurewarnings,\n              b.builderrors AS countbuilderrors,\n              b.buildwarnings AS countbuildwarnings,\n              b.testnotrun AS counttestsnotrun,\n              b.testfailed AS counttestsfailed,\n              b.testpassed AS counttestspassed,\n              b.testtimestatusfailed AS countteststimestatusfailed,\n              sp.id AS subprojectid,\n              sp.groupid AS subprojectgroup,\n              (SELECT count(buildid) FROM errorlog WHERE buildid=b.id) AS nerrorlog,\n              (SELECT count(buildid) FROM build2uploadfile WHERE buildid=b.id) AS builduploadfiles\n              FROM build AS b\n              LEFT JOIN build2group AS b2g ON (b2g.buildid=b.id)\n              LEFT JOIN buildgroup AS g ON (g.id=b2g.groupid)\n              LEFT JOIN site AS s ON (s.id=b.siteid)\n              LEFT JOIN build2update AS b2u ON (b2u.buildid=b.id)\n              LEFT JOIN buildupdate AS bu ON (b2u.updateid=bu.id)\n              LEFT JOIN configure AS c ON (c.buildid=b.id)\n              LEFT JOIN buildinformation AS i ON (i.buildid=b.id)\n              LEFT JOIN builderrordiff AS be_diff ON (be_diff.buildid=b.id AND be_diff.type=0)\n              LEFT JOIN builderrordiff AS bw_diff ON (bw_diff.buildid=b.id AND bw_diff.type=1)\n              LEFT JOIN configureerrordiff AS ce_diff ON (ce_diff.buildid=b.id AND ce_diff.type=1)\n              LEFT JOIN buildtesttime AS btt ON (btt.buildid=b.id)\n              LEFT JOIN testdiff AS tnotrun_diff ON (tnotrun_diff.buildid=b.id AND tnotrun_diff.type=0)\n              LEFT JOIN testdiff AS tfailed_diff ON (tfailed_diff.buildid=b.id AND tfailed_diff.type=1)\n              LEFT JOIN testdiff AS tpassed_diff ON (tpassed_diff.buildid=b.id AND tpassed_diff.type=2)\n              LEFT JOIN testdiff AS tstatusfailed_diff ON (tstatusfailed_diff.buildid=b.id AND tstatusfailed_diff.type=3)\n              LEFT JOIN subproject2build AS sp2b ON (sp2b.buildid = b.id)\n              LEFT JOIN subproject as sp ON (sp2b.subprojectid = sp.id)\n              LEFT JOIN label2build AS l2b ON (l2b.buildid = b.id)\n              LEFT JOIN label AS l ON (l.id = l2b.labelid) {$where} {$order}";
            $build = pdo_single_row_query($sql);
            if (empty($build)) {
                continue;
            }
            $build['groupname'] = $buildgroup_name;
            $build['groupid'] = $buildgroup_id;
            $build['position'] = $buildgroup_position;
            $builds[] = $build;
        }
    }
    return $builds;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:46,代码来源:index_functions.php


示例11: testNotesAPI

 public function testNotesAPI()
 {
     echo "1. testNotesAPI\n";
     // Find the smallest buildid that has more than one note.
     // This was 13 at the time this test was written, but things
     // like this have a habit of changing.
     $buildid_result = pdo_single_row_query('SELECT buildid, COUNT(1) FROM build2note
    GROUP BY buildid HAVING COUNT(1) > 1 ORDER BY buildid LIMIT 1');
     if (empty($buildid_result)) {
         $this->fail('No build found with multiple notes');
         return 1;
     }
     $buildid = $buildid_result['buildid'];
     // Use the API to get the notes for this build.
     $this->get($this->url . "/api/v1/viewNotes.php?buildid={$buildid}");
     $response = json_decode($this->getBrowser()->getContentAsText(), true);
     // Verify some details about this builds notes.
     $numNotes = count($response['notes']);
     if ($numNotes != 2) {
         $this->fail("Expected two notes, found {$numNotes}");
         return 1;
     }
     $driverFound = false;
     $cronFound = false;
     foreach ($response['notes'] as $note) {
         if (strpos($note['name'], 'TrilinosDriverDashboard.cmake') !== false) {
             $driverFound = true;
         }
         if (strpos($note['name'], 'cron_driver.bat') !== false) {
             $cronFound = true;
         }
     }
     if ($driverFound === false) {
         $this->fail('Expected to find a note named TrilinosDriverDashboard.cmake');
         return 1;
     }
     if ($cronFound === false) {
         $this->fail('Expected to find a note named cron_driver.bat');
         return 1;
     }
     $this->pass('Passed');
     return 0;
 }
开发者ID:kitware,项目名称:cdash,代码行数:43,代码来源:test_notesapi.php


示例12: testExternalLinksFromTests

 public function testExternalLinksFromTests()
 {
     // Submit our testing data.
     $file_to_submit = dirname(__FILE__) . '/data/ExternalLinksFromTests/Test.xml';
     if (!$this->submission('InsightExample', $file_to_submit)) {
         $this->fail("Failed to submit {$file_to_submit}");
         return 1;
     }
     // Get the IDs for the build and test that we just created.
     $result = pdo_single_row_query("SELECT id FROM build WHERE name = 'test_output_link'");
     $buildid = $result['id'];
     $result = pdo_single_row_query("SELECT testid FROM build2test WHERE buildid={$buildid}");
     $testid = $result['testid'];
     // Use the API to verify that our external link was parsed properly.
     $this->get($this->url . "/api/v1/testDetails.php?test={$testid}&build={$buildid}");
     $content = $this->getBrowser()->getContent();
     $jsonobj = json_decode($content, true);
     $measurement = array_pop($jsonobj['test']['measurements']);
     $success = true;
     $error_msg = '';
     if ($measurement['name'] !== 'Interesting website') {
         $error_msg = "Expected name to be 'Interesting website', instead found " . $measurement['name'];
         $success = false;
     }
     if ($measurement['type'] !== 'text/link') {
         $error_msg = "Expected type to be 'text/link', instead found " . $measurement['type'];
         $success = false;
     }
     if ($measurement['value'] !== 'http://www.google.com') {
         $error_msg = "Expected value to be 'http://www.google.com', instead found " . $measurement['value'];
         $success = false;
     }
     // Delete the build that we created during this test.
     remove_build($buildid);
     if (!$success) {
         $this->fail($error_msg);
         return 1;
     }
     $this->pass('Tests passed');
     return 0;
 }
开发者ID:kitware,项目名称:cdash,代码行数:41,代码来源:test_externallinksfromtests.php


示例13: onlyColumn

 public function onlyColumn($method)
 {
     // Submit our testing file.
     $rep = dirname(__FILE__) . '/data/HideColumns';
     if (!$this->submission('InsightExample', "{$rep}/{$method}.xml")) {
         return false;
     }
     // Use our API to verify which columns will be displayed.
     $content = $this->connect($this->url . '/api/v1/index.php?project=InsightExample&date=2015-10-06');
     $jsonobj = json_decode($content, true);
     $buildgroup = array_pop($jsonobj['buildgroups']);
     $retval = false;
     switch ($method) {
         case 'Update':
             if ($buildgroup['hasupdatedata'] == true && $buildgroup['hasconfiguredata'] == false && $buildgroup['hascompilationdata'] == false && $buildgroup['hastestdata'] == false) {
                 $retval = true;
             }
             break;
         case 'Configure':
             if ($buildgroup['hasupdatedata'] == false && $buildgroup['hasconfiguredata'] == true && $buildgroup['hascompilationdata'] == false && $buildgroup['hastestdata'] == false) {
                 $retval = true;
             }
             break;
         case 'Build':
             if ($buildgroup['hasupdatedata'] == false && $buildgroup['hasconfiguredata'] == false && $buildgroup['hascompilationdata'] == true && $buildgroup['hastestdata'] == false) {
                 $retval = true;
             }
             break;
         case 'Test':
             if ($buildgroup['hasupdatedata'] == false && $buildgroup['hasconfiguredata'] == false && $buildgroup['hascompilationdata'] == false && $buildgroup['hastestdata'] == true) {
                 $retval = true;
             }
             break;
     }
     // Remove the build that we just created.
     $buildid_results = pdo_single_row_query("SELECT id FROM build WHERE name='HideColumns'");
     $buildid = $buildid_results['id'];
     remove_build($buildid);
     return $retval;
 }
开发者ID:kitware,项目名称:cdash,代码行数:40,代码来源:test_hidecolumns.php


示例14: testParallelSubmissions

 public function testParallelSubmissions()
 {
     // Delete the existing Trilinos build.
     $row = pdo_single_row_query("SELECT id FROM build\n                WHERE parentid=-1 AND\n                projectid=(SELECT id FROM project WHERE name='Trilinos') AND\n                name='Windows_NT-MSVC10-SERIAL_DEBUG_DEV' AND\n                starttime BETWEEN '2011-07-22 00:00:00' AND '2011-07-22 23:59:59'");
     remove_build($row['id']);
     // Disable submission processing so that the queue will accumulate.
     $this->addLineToConfig($this->DisableProcessingConfig);
     // Re-submit the Trilinos build.
     $begin = time();
     $this->submitFiles('ActualTrilinosSubmission', true);
     echo 'Submission took ' . (time() - $begin) . " seconds.\n";
     // Re-enable submission processing and enable parallel processing
     $this->removeLineFromConfig($this->DisableProcessingConfig);
     $this->addLineToConfig($this->ParallelProcessingConfig);
     // Submit another file to Trilinos to start the processing loop.
     $file = dirname(__FILE__) . '/data/SubProjectNextPrevious/Build_1.xml';
     $this->submission('Trilinos', $file);
     // Wait for processing to complete.
     $todo = 999;
     $begin = time();
     while ($todo > 0) {
         $row = pdo_single_row_query('SELECT count(1) AS todo
                 FROM submission WHERE status=0 OR status=1');
         $todo = $row['todo'];
         sleep(1);
         if (time() - $begin > 120) {
             $this->fail("Processing took longer than 120 seconds.\n");
             break;
         }
     }
     echo 'Processing took ' . (time() - $begin) . " seconds.\n";
     // Verify the results.
     $this->verifyResults();
     // Clean up by reverting our config settings and deleting the
     // extra build that we created to trigger the processing.
     $this->removeLineFromConfig($this->ParallelProcessingConfig);
     $row = pdo_single_row_query("SELECT build.id FROM build\n                WHERE build.parentid=-1 AND\n                projectid=(SELECT id FROM project WHERE name='Trilinos') AND\n                stamp='20110723-1515-Experimental'");
     remove_build($row['id']);
 }
开发者ID:kitware,项目名称:cdash,代码行数:39,代码来源:test_parallelsubmissions.php


示例15: htmlspecialchars

require_once "filterdataFunctions.php";
@($date = $_GET["date"]);
if ($date != NULL) {
    $date = htmlspecialchars(pdo_real_escape_string($date));
}
@($projectname = $_GET["project"]);
if ($projectname != NULL) {
    $projectname = htmlspecialchars(pdo_real_escape_string($projectname));
}
$start = microtime_float();
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
pdo_select_db("{$CDASH_DB_NAME}", $db);
if ($projectname == '') {
    $project = pdo_single_row_query("SELECT * FROM project LIMIT 1");
} else {
    $project = pdo_single_row_query("SELECT * FROM project WHERE name='{$projectname}'");
}
checkUserPolicy(@$_SESSION['cdash']['loginid'], $project['id']);
list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project['nightlytime']);
$xml = begin_XML_for_XSLT();
$xml .= "<title>CDash : " . $project['name'] . "</title>";
$xml .= get_cdash_dashboard_xml_by_name($project['name'], $date);
// Filters:
//
$filterdata = get_filterdata_from_request();
$filter_sql = $filterdata['sql'];
$limit_sql = '';
if ($filterdata['limit'] > 0) {
    $limit_sql = ' LIMIT ' . $filterdata['limit'];
}
$xml .= $filterdata['xml'];
开发者ID:rpshaw,项目名称:CDash,代码行数:31,代码来源:queryTests.php


示例16: UpdateParentConfigureNumbers

 /**
  * Update the tally of configure errors & warnings for this build's
  * parent.
  **/
 function UpdateParentConfigureNumbers($newWarnings, $newErrors)
 {
     $this->ParentId = $this->GetParentBuildId();
     if ($this->ParentId < 1) {
         return;
     }
     $numErrors = 0;
     $numWarnings = 0;
     $parent = pdo_single_row_query("SELECT configureerrors, configurewarnings\n       FROM build WHERE id=" . qnum($this->ParentId));
     // Don't let the -1 default value screw up our math.
     if ($parent['configureerrors'] == -1) {
         $parent['configureerrors'] = 0;
     }
     if ($parent['configurewarnings'] == -1) {
         $parent['configurewarnings'] = 0;
     }
     $numErrors = $newErrors + $parent['configureerrors'];
     $numWarnings = $newWarnings + $parent['configurewarnings'];
     pdo_query("UPDATE build SET configureerrors='{$numErrors}',\n                        configurewarnings='{$numWarnings}'\n                    WHERE id=" . qnum($this->ParentId));
     add_last_sql_error("Build:UpdateParentConfigureNumbers", $this->ProjectId, $this->Id);
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:25,代码来源:build.php


示例17: put_submit_file

/** Function to deal with the external tool mechanism */
function put_submit_file()
{
    include "models/buildfile.php";
    // We expect GET to contain the following values:
    $vars = array('buildid', 'type');
    foreach ($vars as $var) {
        if (!isset($_GET[$var]) || empty($_GET[$var])) {
            $response_array['status'] = 1;
            $response_array['description'] = 'Variable \'' . $var . '\' not set but required.';
            echo json_encode($response_array);
            return;
        }
    }
    // Verify buildid.
    if (!is_numeric($_GET['buildid'])) {
        $response_array['status'] = 1;
        $response_array['description'] = 'Variable \'buildid\' is not numeric.';
        echo json_encode($response_array);
        return;
    }
    // Abort early if we already have this file.
    $buildfile = new BuildFile();
    $buildfile->BuildId = $_GET['buildid'];
    $buildfile->Type = htmlspecialchars(pdo_real_escape_string($_GET['type']));
    $buildfile->md5 = htmlspecialchars(pdo_real_escape_string($_GET['md5']));
    $buildfile->Filename = htmlspecialchars(pdo_real_escape_string($_GET['filename']));
    if (!$buildfile->Insert()) {
        $response_array['status'] = 1;
        $response_array['description'] = 'Cannot insert buildfile into database. The file might already exist.';
        echo json_encode($response_array);
        return;
    }
    // Get the ID of the project associated with this build.
    $row = pdo_single_row_query("SELECT projectid FROM build WHERE id = {$buildfile->BuildId}");
    if (empty($row)) {
        $response_array['status'] = 1;
        $response_array['description'] = "Cannot find projectid for build #{$buildfile->BuildId}";
        echo json_encode($response_array);
        return;
    }
    $projectid = $row[0];
    // Begin writing this file to the backup directory.
    global $CDASH_BACKUP_DIRECTORY;
    $uploadDir = $CDASH_BACKUP_DIRECTORY;
    $ext = pathinfo($buildfile->Filename, PATHINFO_EXTENSION);
    $filename = $uploadDir . "/" . $buildfile->BuildId . "_" . $buildfile->md5 . ".{$ext}";
    if (!($handle = fopen($filename, 'w'))) {
        $response_array['status'] = 1;
        $response_array['description'] = "Cannot open file ({$filename})";
        echo json_encode($response_array);
        return;
    }
    // Read the data 1 KB at a time and write to the file.
    $putdata = fopen("php://input", "r");
    while ($data = fread($putdata, 1024)) {
        fwrite($handle, $data);
    }
    // Close the streams.
    fclose($handle);
    fclose($putdata);
    // Check that the md5sum of the file matches what we were expecting.
    $md5sum = md5_file($filename);
    if ($md5sum != $buildfile->md5) {
        $response_array['status'] = 1;
        $response_array['description'] = "md5 mismatch. expected: {$buildfile->md5}, received: {$md5sum}";
        unlink($filename);
        $buildfile->Delete();
        echo json_encode($response_array);
        return;
    }
    global $CDASH_ASYNCHRONOUS_SUBMISSION;
    if ($CDASH_ASYNCHRONOUS_SUBMISSION) {
        // Create a new entry in the submission table for this file.
        $bytes = filesize($filename);
        $now_utc = gmdate(FMT_DATETIMESTD);
        pdo_query("INSERT INTO submission (filename,projectid,status,attempts,filesize,filemd5sum,created) " . "VALUES ('{$filename}','{$projectid}','0','0','{$bytes}','{$buildfile->md5}','{$now_utc}')");
        // Trigger the processing loop in case it's not already running.
        trigger_process_submissions($projectid);
    } else {
        // synchronous processing.
        $handle = fopen($filename, 'r');
        do_submit($handle, $projectid, $buildfile->md5, false);
        // The file is given a more appropriate name during do_submit, so we can
        // delete the old file now.
        unlink($filename);
    }
    // Returns the OK submission
    $response_array['status'] = 0;
    echo json_encode($response_array);
}
开发者ID:rpshaw,项目名称:CDash,代码行数:91,代码来源:do_submit.php


示例18: array

//
if ($projectdisplaylabels) {
    // Get the set of labels involved:
    //
    $labels = array();
    $covlabels = pdo_all_rows_query('SELECT DISTINCT id, text FROM label, label2coveragefile WHERE ' . 'label.id=label2coveragefile.labelid AND ' . 'label2coveragefile.buildid=' . qnum($buildid));
    foreach ($covlabels as $row) {
        $labels[$row['id']] = $row['text'];
    }
    // For each label, compute the percentcoverage for files with
    // that label:
    //
    if (count($labels) > 0) {
        $xml .= '<labels>';
        foreach ($labels as $id => $label) {
            $row = pdo_single_row_query('SELECT COUNT(*) AS c, SUM(loctested) AS loctested, SUM(locuntested) AS locuntested ' . 'FROM label2coveragefile, coverage WHERE ' . 'label2coveragefile.labelid=' . qnum($id) . ' AND ' . 'label2coveragefile.buildid=' . qnum($buildid) . ' AND ' . 'coverage.buildid=label2coveragefile.buildid AND ' . 'coverage.fileid=label2coveragefile.coveragefileid');
            $loctested = $row['loctested'];
            $locuntested = $row['locuntested'];
            $percentcoverage = compute_percentcoverage($loctested, $locuntested);
            $xml .= '<label>';
            $xml .= add_XML_value('name', $label);
            $xml .= add_XML_value('percentcoverage', $percentcoverage);
            $xml .= '</label>';
        }
        $xml .= '</labels>';
    }
}
$coveredfiles = pdo_query("SELECT count(covered) FROM coverage WHERE buildid='{$buildid}' AND covered='1'");
$coveredfiles_array = pdo_fetch_array($coveredfiles);
$ncoveredfiles = $coveredfiles_array[0];
$files = pdo_query("SELECT count(covered) FROM coverage WHERE buildid='{$buildid}'");
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:viewCoverage.php


示例19: Update

 /** Update the content of the file */
 function Update($buildid)
 {
     if (!is_numeric($buildid) || $buildid == 0) {
         return;
     }
     include "cdash/config.php";
     // Compute the crc32 of the file (before compression for backward compatibility)
     $this->Crc32 = crc32($this->FullPath . $this->File);
     $this->FullPath = pdo_real_escape_string($this->FullPath);
     if ($CDASH_USE_COMPRESSION) {
         $file = gzcompress($this->File);
         if ($file === false) {
             $file = $this->File;
         } else {
             if ($CDASH_DB_TYPE == "pgsql") {
                 if (strlen($this->File) < 2000) {
                     $file = $this->File;
                 }
                 $file = pg_escape_bytea(base64_encode($file));
                 // hopefully does the escaping correctly
             }
         }
     } else {
         $file = $this->File;
         if ($CDASH_DB_TYPE == "pgsql") {
             $file = pg_escape_bytea($file);
         }
     }
     $file = pdo_real_escape_string($file);
     $coveragefile = pdo_query("SELECT id FROM coveragefile WHERE crc32=" . qnum($this->Crc32));
     add_last_sql_error("CoverageFile:Update");
     if (pdo_num_rows($coveragefile) > 0) {
         $coveragefile_array = pdo_fetch_array($coveragefile);
         $this->Id = $coveragefile_array["id"];
         // Update the current coverage.fileid
         $coverage = pdo_query("SELECT c.fileid FROM coverage AS c,coveragefile AS cf \n                            WHERE c.fileid=cf.id AND c.buildid=" . qnum($buildid) . "\n                              AND cf.fullpath='{$this->FullPath}'");
         $coverage_array = pdo_fetch_array($coverage);
         $prevfileid = $coverage_array["fileid"];
         pdo_query("UPDATE coverage SET fileid=" . qnum($this->Id) . " WHERE buildid=" . qnum($buildid) . " AND fileid=" . qnum($prevfileid));
         add_last_sql_error("CoverageFile:Update");
         $row = pdo_single_row_query("SELECT COUNT(*) AS c FROM label2coveragefile WHERE buildid=" . qnum($buildid) . " AND coveragefileid=" . qnum($prevfileid));
         if (isset($row['c']) && $row['c'] > 0) {
             pdo_query("UPDATE label2coveragefile SET coveragefileid=" . qnum($this->Id) . " WHERE buildid=" . qnum($buildid) . " AND coveragefileid=" . qnum($prevfileid));
             add_last_sql_error("CoverageFile:Update");
         }
         // Remove the file if the crc32 is NULL
         pdo_query("DELETE FROM coveragefile WHERE id=" . qnum($prevfileid) . " AND file IS NULL and crc32 IS NULL");
         add_last_sql_error("CoverageFile:Update");
     } else {
         // We find the current fileid based on the name and the file should be null
         $coveragefile = pdo_query("SELECT cf.id,cf.file FROM coverage AS c,coveragefile AS cf \n                                   WHERE c.fileid=cf.id AND c.buildid=" . qnum($buildid) . "\n                                   AND cf.fullpath='{$this->FullPath}' ORDER BY cf.id ASC");
         $coveragefile_array = pdo_fetch_array($coveragefile);
         // The GcovTarHandler creates coveragefiles before coverages
         // so we need a simpler query in this case.
         if (empty($coveragef 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP pdo_update函数代码示例发布时间:2022-05-15
下一篇:
PHP pdo_select_db函数代码示例发布时间: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