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

PHP pdo_num_rows函数代码示例

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

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



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

示例1: Save

 /** Save */
 public function Save()
 {
     $version = pdo_real_escape_string($this->Version);
     $path = pdo_real_escape_string($this->Path);
     // Check if the version already exists
     $query = pdo_query("SELECT id FROM client_cmake WHERE version='" . $version . "'");
     if (pdo_num_rows($query) == 0) {
         $sql = "INSERT INTO client_cmake (version)\n              VALUES ('" . $version . "')";
         pdo_query($sql);
         $this->Id = pdo_insert_id('client_cmake');
         add_last_sql_error('clientCMake::Save()');
     } else {
         // update
         $query_array = pdo_fetch_array($query);
         $this->Id = $query_array['id'];
         $sql = "UPDATE client_cmake SET version='" . $version . "' WHERE id=" . qnum($this->Id);
         pdo_query($sql);
         add_last_sql_error('clientCMake::Save()');
     }
     // Insert into the siteid
     $query = pdo_query('SELECT cmakeid FROM client_site2cmake WHERE cmakeid=' . qnum($this->Id) . ' AND siteid=' . qnum($this->SiteId));
     if (pdo_num_rows($query) == 0) {
         $sql = 'INSERT INTO client_site2cmake (siteid,cmakeid,path)
           VALUES (' . qnum($this->SiteId) . ',' . qnum($this->Id) . ",'" . $path . "')";
         pdo_query($sql);
         add_last_sql_error('clientCMake::Save()');
     } else {
         // update
         $sql = "UPDATE client_site2cmake SET path='" . $path . "' WHERE cmakeid=" . qnum($this->Id) . ' AND siteid=' . qnum($this->SiteId);
         pdo_query($sql);
         add_last_sql_error('clientCMake::Save()');
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:34,代码来源:clientcmake.php


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


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


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


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


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


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


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


示例9: GetText

 /** Return the text */
 function GetText()
 {
     $query = pdo_query("SELECT text FROM banner WHERE projectid=" . qnum($this->ProjectId));
     if (pdo_num_rows($query) == 0) {
         return false;
     }
     $query_array = pdo_fetch_array($query);
     $this->Text = $query_array['text'];
     if (strlen($this->Text) == 0) {
         return false;
     }
     return $this->Text;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:14,代码来源:banner.php


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


示例11: orsee_session_read

function orsee_session_read($aKey)
{
    $query = "SELECT DataValue FROM " . table('http_sessions') . " WHERE SessionID=:aKey";
    $pars = array(':aKey' => $aKey);
    $result = or_query($query, $pars);
    if (pdo_num_rows($result) == 1) {
        $r = pdo_fetch_assoc($result);
        return $r['DataValue'];
    } else {
        $query = "INSERT INTO " . table('http_sessions') . " (SessionID, LastUpdated, DataValue)\n                       VALUES (:aKey, NOW(), '')";
        or_query($query, $pars);
        return "";
    }
}
开发者ID:danorama,项目名称:orsee,代码行数:14,代码来源:session_handler.php


示例12: Save

 /** Save the site information */
 function Save()
 {
     if ($this->OSName != "" || $this->OSPlatform != "" || $this->OSRelease != "" || $this->OSVersion != "") {
         if (empty($this->BuildId)) {
             return false;
         }
         // Check if we already have a buildinformation for that build. If yes we just skip it
         $query = pdo_query("SELECT buildid FROM buildinformation WHERE buildid=" . qnum($this->BuildId));
         add_last_sql_error("BuildInformation Insert", 0, $this->BuildId);
         if (pdo_num_rows($query) == 0) {
             pdo_query("INSERT INTO buildinformation (buildid,osname,osrelease,osversion,osplatform,compilername,compilerversion) \n                    VALUES (" . qnum($this->BuildId) . ",'{$this->OSName}','{$this->OSRelease}',\n                            '{$this->OSVersion}','{$this->OSPlatform}','{$this->CompilerName}','{$this->CompilerVersion}')");
             add_last_sql_error("BuildInformation Insert", 0, $this->BuildId);
         }
         return true;
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:17,代码来源:buildinformation.php


示例13: pdo_single_row_query

function pdo_single_row_query($qry)
{
    $result = pdo_query($qry);
    if (FALSE === $result) {
        add_log('error: pdo_query failed: ' . pdo_error(), 'pdo_single_row_query', LOG_ERR);
        return array();
    }
    $num_rows = pdo_num_rows($result);
    if (0 !== $num_rows && 1 !== $num_rows) {
        add_log('error: at most 1 row should be returned, not ' . $num_rows, 'pdo_single_row_query', LOG_ERR);
        add_log('warning: returning the first row anyway even though result ' . 'contains ' . $num_rows . ' rows', 'pdo_single_row_query', LOG_WARNING);
    }
    $row = pdo_fetch_array($result);
    pdo_free_result($result);
    return $row;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:16,代码来源:pdo.php


示例14: Insert

 public function Insert()
 {
     if (strlen($this->UpdateId) == 0) {
         echo 'BuildUpdateFile:Insert UpdateId not set';
         return false;
     }
     $this->Filename = pdo_real_escape_string($this->Filename);
     // Sometimes the checkin date is not found in that case we put the usual date
     if ($this->CheckinDate == 'Unknown') {
         $this->CheckinDate = '1980-01-01';
     }
     if (strtotime($this->CheckinDate) === false && is_numeric($this->CheckinDate)) {
         $this->CheckinDate = date(FMT_DATETIME, $this->CheckinDate);
     } elseif (strtotime($this->CheckinDate) !== false) {
         $this->CheckinDate = date(FMT_DATETIME, strtotime($this->CheckinDate));
     } else {
         $this->CheckinDate = '1980-01-01';
     }
     $this->Author = pdo_real_escape_string($this->Author);
     $this->UpdateId = pdo_real_escape_string($this->UpdateId);
     // Check if we have a robot file for this build
     $robot = pdo_query('SELECT authorregex FROM projectrobot,build,build2update
             WHERE projectrobot.projectid=build.projectid
             AND build2update.buildid=build.id
             AND build2update.updateid=' . qnum($this->UpdateId) . " AND robotname='" . $this->Author . "'");
     if (pdo_num_rows($robot) > 0) {
         $robot_array = pdo_fetch_array($robot);
         $regex = $robot_array['authorregex'];
         preg_match($regex, $this->Log, $matches);
         if (isset($matches[1])) {
             $this->Author = $matches[1];
         }
     }
     $this->Email = pdo_real_escape_string($this->Email);
     $this->Committer = pdo_real_escape_string($this->Committer);
     $this->CommitterEmail = pdo_real_escape_string($this->CommitterEmail);
     $this->Log = pdo_real_escape_string($this->Log);
     $this->Revision = pdo_real_escape_string($this->Revision);
     $this->PriorRevision = pdo_real_escape_string($this->PriorRevision);
     $query = 'INSERT INTO updatefile (updateid,filename,checkindate,author,email,log,revision,priorrevision,status,committer,committeremail)
           VALUES (' . qnum($this->UpdateId) . ",'{$this->Filename}','{$this->CheckinDate}','{$this->Author}','{$this->Email}',\n                      '{$this->Log}','{$this->Revision}','{$this->PriorRevision}','{$this->Status}','{$this->Committer}','{$this->CommitterEmail}')";
     if (!pdo_query($query)) {
         add_last_sql_error('BuildUpdateFile Insert', 0, $this->UpdateId);
         return false;
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:46,代码来源:buildupdatefile.php


示例15: Save

 /** Save a site */
 function Save()
 {
     $name = $this->GetNameFromPlatform($this->Name);
     $version = $this->GetNameFromVersion($this->Version);
     if (strlen($name) == 0) {
         return false;
     }
     // Check if the name and bits system already exists
     $query = pdo_query("SELECT id FROM client_os WHERE name='" . $name . "' AND version='" . $version . "' AND bits='" . $this->Bits . "'");
     if (pdo_num_rows($query) == 0) {
         $sql = "INSERT INTO client_os (name,version,bits) \n              VALUES ('" . $name . "','" . $version . "','" . $this->Bits . "')";
         pdo_query($sql);
         $this->Id = pdo_insert_id('client_os');
         add_last_sql_error("ClientOS::Save()");
     } else {
         $query_array = pdo_fetch_array($query);
         $this->Id = $query_array['id'];
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:20,代码来源:clientos.php


示例16: Exists

 /** Check if exists */
 public function Exists()
 {
     // If no id specify return false
     if ($this->Id) {
         $query = pdo_query("SELECT count(*) AS c FROM image WHERE id='" . $this->Id . "'");
         $query_array = pdo_fetch_array($query);
         if ($query_array['c'] == 0) {
             return false;
         }
         return true;
     } else {
         // Check if the checksum exists
         $query = pdo_query("SELECT id FROM image WHERE checksum='" . $this->Checksum . "'");
         if (pdo_num_rows($query) > 0) {
             $query_array = pdo_fetch_array($query);
             $this->Id = $query_array['id'];
             return true;
         }
         return false;
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:23,代码来源:image.php


示例17: Insert

 function Insert()
 {
     if (!$this->BuildId) {
         echo "BuildFile::Insert(): BuildId not set<br>";
         return false;
     }
     if (!$this->Type) {
         echo "BuildFile::Insert(): Type not set<br>";
         return false;
     }
     if (!$this->md5) {
         echo "BuildFile::Insert(): md5 not set<br>";
         return false;
     }
     if (!$this->Filename) {
         echo "BuildFile::Insert(): Filename not set<br>";
         return false;
     }
     $filename = pdo_real_escape_string($this->Filename);
     $type = pdo_real_escape_string($this->Type);
     $md5 = pdo_real_escape_string($this->md5);
     // Check if we already have a row
     $query = "SELECT buildid FROM buildfile WHERE buildid=" . qnum($this->BuildId) . " AND md5='" . $md5 . "'";
     $query_result = pdo_query($query);
     if (!$query_result) {
         add_last_sql_error("BuildFile Insert", 0, $this->BuildId);
         return false;
     }
     if (pdo_num_rows($query_result) > 0) {
         return false;
     }
     $query = "INSERT INTO buildfile (buildid,type,filename,md5)\n              VALUES (" . qnum($this->BuildId) . ",'" . $type . "','" . $filename . "','" . $md5 . "')";
     if (!pdo_query($query)) {
         add_last_sql_error("BuildFile Insert", 0, $this->BuildId);
         return false;
     }
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:38,代码来源:buildfile.php


示例18: Exists

 /** Check if the site already exists */
 function Exists()
 {
     // If no id specify return false
     if (!$this->Id && !$this->Name) {
         return false;
     }
     if ($this->Id) {
         $query = pdo_query("SELECT count(*) AS c FROM site WHERE id=" . qnum($this->Id));
         $query_array = pdo_fetch_array($query);
         if ($query_array['c'] > 0) {
             return true;
         }
     }
     if ($this->Name) {
         $query = pdo_query("SELECT id FROM site WHERE name='" . $this->Name . "'");
         if (pdo_num_rows($query) > 0) {
             $query_array = pdo_fetch_array($query);
             $this->Id = $query_array['id'];
             return true;
         }
     }
     return false;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:24,代码来源:site.php


示例19: Insert

 function Insert()
 {
     if (!is_numeric($this->ProjectId) || !is_numeric($this->BuildId) || !is_numeric($this->ResourceId) || !is_numeric($this->ResourceType) || !is_numeric($this->Type)) {
         return false;
     }
     $description = pdo_real_escape_string($this->Description);
     // If the projectid is not set but the buildid is we are trying to find
     // the projectid
     if ($this->ProjectId == 0 && $this->BuildId > 0) {
         $query = pdo_query("SELECT projectid FROM build WHERE id='" . $this->BuildId . "'");
         if (pdo_num_rows($query) > 0) {
             $query_array = pdo_fetch_array($query);
             $this->ProjectId = $query_array['projectid'];
         }
     }
     // Insert a new row every time an error exists
     $now = date("Y-m-d H:i:s");
     $sql = "INSERT INTO errorlog (projectid,buildid,type,date,resourcetype,resourceid,description)\n               VALUES ('" . $this->ProjectId . "','" . $this->BuildId . "','" . $this->Type . "','" . $now . "','" . $this->ResourceType . "','" . $this->ResourceId . "','" . $description . "')";
     pdo_query($sql);
     echo pdo_error();
     // We don't log on purpose (loop loop ;)
     return true;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:23,代码来源:errorlog.php


示例20: Save

 /** Save */
 function Save()
 {
     // Check if the name/version already exists
     $query = pdo_query("SELECT id FROM client_library WHERE name='" . $this->Name . "' AND version='" . $this->Version . "'");
     if (pdo_num_rows($query) == 0) {
         $sql = "INSERT INTO client_library (name,version)\n              VALUES ('" . $this->Name . "','" . $this->Version . "')";
         pdo_query($sql);
         $this->Id = pdo_insert_id('client_library');
         add_last_sql_error("ClientLibrary::Save()");
     } else {
         $query_array = pdo_fetch_array($query);
         $this->Id = $query_array['id'];
         $sql = "UPDATE client_library SET version='" . $this->Version . "' WHERE id=" . qnum($this->Id);
         pdo_query($sql);
         add_last_sql_error("ClientLibrary::Save()");
     }
     // Insert into the siteid
     $query = pdo_query("SELECT libraryid FROM client_site2library WHERE libraryid=" . qnum($this->Id) . " AND siteid=" . qnum($this->SiteId));
     if (pdo_num_rows($query) == 0) {
         $sql = "INSERT INTO client_site2library (siteid,libraryid,path,include)\n              VALUES (" . qnum($this->SiteId) . "," . qnum($this->Id) . ",'" . $this->Path . "','" . $this->Include . "')";
         pdo_query($sql);
         add_last_sql_error("ClientLibrary::Save()");
     } else {
         $sql = "UPDATE client_site2library SET path='" . $this->Path . "',include='" . $this->Include . "' WHERE libraryid=" . qnum($this->Id) . " AND siteid=" . qnum($this->SiteId);
         pdo_query($sql);
         add_last_sql_error("ClientLibrary::Save()");
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:29,代码来源:clientlibrary.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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