当前位置: 首页>>代码示例>>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;未经允许,请勿转载。