當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dataset::setDatasetId方法代碼示例

本文整理匯總了PHP中Dataset::setDatasetId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dataset::setDatasetId方法的具體用法?PHP Dataset::setDatasetId怎麽用?PHP Dataset::setDatasetId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dataset的用法示例。


在下文中一共展示了Dataset::setDatasetId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDatasetsArray

 public static function getDatasetsArray($rows)
 {
     $datasets = array();
     if (!empty($rows)) {
         // Convert the array of arrays into an array of Datasets
         // and set the id and date_created fields
         foreach ($rows as $datasetRow) {
             $dataset = new Dataset($datasetRow);
             $datasetId = $datasetRow['dataset_id'];
             $dataset->setDatasetId($datasetId);
             $datasetDateCreated = $datasetRow['date_created'];
             $dataset->setDateCreated($datasetDateCreated);
             // TODO: We should also get the dataset's associated sensors
             // Coordinate this in the controller
             array_push($datasets, $dataset);
         }
     }
     return $datasets;
 }
開發者ID:mr-augustine,項目名稱:sensor-data-repo,代碼行數:19,代碼來源:DatasetsDB.class.php

示例2: updateDataset

 private function updateDataset()
 {
     $dataset = $_SESSION['dataset'];
     if (empty($dataset)) {
         HomeView::show();
         header('Location: /' . $_SESSION['base']);
     } elseif ($_SERVER['REQUEST_METHOD'] == 'GET') {
         DatasetView::showUpdate();
     } else {
         $params = $dataset->getParameters();
         $params['dataset_name'] = array_key_exists('dataset_name', $_POST) ? $_POST['dataset_name'] : '';
         $params['description'] = array_key_exists('description', $_POST) ? $_POST['description'] : '';
         $updatedDataset = new Dataset($params);
         $updatedDataset->setDatasetId($dataset->getDatasetId());
         $returnedDataset = DatasetsDB::updateDataset($updatedDataset);
         if ($returnedDataset->getErrorCount() == 0) {
             // Show the Dataset view which should display the updated params
             DatasetView::show();
             header('Location: /' . $_SESSION['base'] . '/dataset/show/' . $dataset->getDatasetId());
         } else {
             // Carry over the sensors, if any
             $updatedDataset->setSensors($dataset->getSensors());
             $_SESSION['dataset'] = $updatedDataset;
             DatasetView::showUpdate();
         }
     }
 }
開發者ID:mr-augustine,項目名稱:sensor-data-repo,代碼行數:27,代碼來源:DatasetController.class.php

示例3: testUpdateDatasetDescription

 public function testUpdateDatasetDescription()
 {
     $myDb = DBMaker::create('sensordatarepotest');
     Database::clearDB();
     $db = Database::getDB('sensordatarepotest', 'C:\\xampp\\myConfig.ini');
     $testDatasetId = 1;
     $datasets = DatasetsDB::getDatasetsBy('dataset_id', $testDatasetId);
     $dataset = $datasets[0];
     $this->assertTrue(empty($dataset->getDescription()), 'Before the update, it should have an empty description');
     $params = $dataset->getParameters();
     $params['description'] = 'Updated description';
     $newDataset = new Dataset($params);
     $newDataset->setDatasetId($testDatasetId);
     $returnedDataset = DatasetsDB::updateDataset($newDataset);
     $this->assertEquals($returnedDataset->getDescription(), $params['description'], 'After the update it should have the name ' . $params['description']);
 }
開發者ID:mr-augustine,項目名稱:sensor-data-repo,代碼行數:16,代碼來源:DatasetsDBTest.php


注:本文中的Dataset::setDatasetId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。