当前位置: 首页>>代码示例>>PHP>>正文


PHP Map::fromRecordSet方法代码示例

本文整理汇总了PHP中Map::fromRecordSet方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::fromRecordSet方法的具体用法?PHP Map::fromRecordSet怎么用?PHP Map::fromRecordSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


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

示例1: get

 /**
  * @param string $filename
  * @param string $path
  * @return Map
  * @throws \InvalidArgumentException
  */
 function get($filename, $path)
 {
     if (mb_detect_encoding($filename, 'UTF-8', true) === false) {
         $utf8Filename = utf8_encode($filename);
     } else {
         $utf8Filename = $filename;
     }
     if (!file_exists($this->mapDirectory . $path . $filename)) {
         $this->db()->execute('DELETE FROM Maps WHERE path=%s AND filename=%s', $this->db()->quote($path), $this->db()->quote($utf8Filename));
         throw new \InvalidArgumentException($this->mapDirectory . $path . $utf8Filename . ': file does not exist');
     }
     $fileStats = stat($this->mapDirectory . $path . $filename);
     $result = $this->db()->execute('SELECT * FROM Maps WHERE path=%s AND filename=%s AND size=%d AND mTime=FROM_UNIXTIME(%d)', $this->db()->quote($path), $this->db()->quote($utf8Filename), $fileStats['size'], $fileStats['mtime']);
     if (!$result->recordCount()) {
         $mapInfo = \DedicatedManager\Utils\GbxReader\Map::read($this->mapDirectory . $path . $filename);
         $map = new Map();
         $fields = array('uid', 'name', 'environment', 'mood', 'type', 'displayCost', 'nbLaps', 'authorLogin', 'authorNick', 'authorZone', 'authorTime', 'goldTime', 'silverTime', 'bronzeTime', 'authorScore', 'size', 'mTime');
         $this->db()->execute('INSERT INTO Maps(path, filename, %s) ' . 'VALUES (%s,%s,%s,%s,%s,%s,%s,%d,%d,%s,%s,%s,%d,%d,%d,%d,%d,%d,FROM_UNIXTIME(%d)) ' . 'ON DUPLICATE KEY UPDATE ' . \ManiaLib\Database\Tools::getOnDuplicateKeyUpdateValuesString($fields), implode(',', $fields), $this->db()->quote($map->path = $path), $this->db()->quote($map->filename = $utf8Filename), $this->db()->quote($map->uid = $mapInfo->uid), $this->db()->quote($map->name = $mapInfo->name), $this->db()->quote($map->environment = $mapInfo->environment), $this->db()->quote($map->mood = $mapInfo->mood), $this->db()->quote($map->type = $mapInfo->type), $map->displayCost = $mapInfo->displayCost, $map->nbLaps = $mapInfo->nbLaps, $this->db()->quote($map->authorLogin = $mapInfo->author->login), $this->db()->quote($map->authorNick = $mapInfo->author->nickname), $this->db()->quote($map->authorZone = $mapInfo->author->zone), $map->authorTime = $mapInfo->authorTime, $map->goldTime = $mapInfo->goldTime, $map->silverTime = $mapInfo->silverTime, $map->bronzeTime = $mapInfo->bronzeTime, $map->authorScore = $mapInfo->authorScore, $fileStats['size'], $fileStats['mtime']);
         if ($mapInfo->thumbnail) {
             imagejpeg($mapInfo->thumbnail, MANIALIB_APP_PATH . '/www/media/images/thumbnails/' . $map->uid . '.jpg', 100);
         }
     } else {
         $map = Map::fromRecordSet($result);
     }
     return $map;
 }
开发者ID:maniaplanet,项目名称:dedicated-manager,代码行数:32,代码来源:MapService.php

示例2: get

 function get($filename)
 {
     $result = $this->db()->execute('SELECT * FROM Maps WHERE CONCAT(path,filename) = %s', $this->db()->quote($filename));
     return Map::fromRecordSet($result);
 }
开发者ID:nadeolive-legacy,项目名称:maniahost,代码行数:5,代码来源:MapService.php


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