拼装插入数据GIS sql语句.

@param string $filePath
@param array $data 要插入的字段/数据

@return string  sql
491501
protected function getInsertSql($data)
    {
        $sql = '';
        foreach ($data as $v) {
            $v->geom = $v->worker_lat . " " . $v->worker_lng;
            $strfield = '';
            $strvalue = '';
            foreach ($v as $k => $vv) {
                $strfield .= $k . ',';
                if ($k == 'geom') {
                    $strvalue .= "ST_GeomFromText('POINT(" . addslashes($vv) . ")',4326),";
                } else {
                    $strvalue .= "'" . addslashes($vv) . "',";
                }
            }
            $this->num += 1;
            $strfield = rtrim($strfield, ',');
            $strvalue = rtrim($strvalue, ',');
            $sql .= "({$strvalue}),";
        }
        $sql = rtrim($sql, ',');
        $sql = "insert into " . config("database.pgsql_workers") . "({$strfield}) VALUES {$sql}";


        return $sql;

    }
348804
public function uploadStoreLogo($filePath)
    {
        $filePath = realpath($filePath);
        if (!file_exists($filePath)) {
            return false;
        }
        $buffer = class_exists('\CURLFile') ? new \CURLFile($filePath) : '@' . $filePath;

        $result = $this->httpPost(self::WECHAT_MEDIA_IMG_UPLOAD_URL .
            'access_token=' . $this->getAccessToken() , [
            'buffer' => class_exists('\CURLFile') ? new \CURLFile($filePath) : '@' . $filePath
        ]);

        return isset($result['url']) ? $result['url'] : false;
    }
1073766
public static function parseFile($filepath)
    {
        if (!is_file($filepath)) {
            throw new \RuntimeException('File not found: ' . $filepath);
        }

        if (!$filedata = static::readFiledata($filepath)) {
            throw new \RuntimeException('Error reading file: ' . $filepath);
        }

        if (!$json = self::decode($filedata)) {
            throw new \RuntimeException('Error parsing json: ' . $filepath);
        }

        return $json;
    }
63026
public function export($filepath)
	{
		$command = sprintf(
			'PGPASSWORD=%s %s -Fc --no-acl --no-owner -h %s -U %s %s > %s',
			escapeshellarg($this->getPassword()),
			$this->getExportCommand(),
			escapeshellarg($this->getHostname()),
			escapeshellarg($this->getUsername()),
			escapeshellarg($this->getDatabase()),
			escapeshellarg($filepath)
		);

		return $this->getBackupProcess()->run($command, __FUNCTION__);
	}
446876
public function file($path, $data = [], $mergeData = [])
    {
        $data = array_merge($mergeData, $this->parseData($data));

        return $this->viewInstance($path, $path, $data);
    }
1043111
public function extract($filePath)
    {
        $directory = $this->directory->getDirectoryPath();
        $pharArchive = new PharData($filePath, null, null, Phar::GZ);
        $pharArchive->extractTo($directory);

        return $this->createFinderFromDirectory($directory);
    }
39418
public function readFile($filePath)
    {
        try {
            $file = fopen($filePath, 'r');
            $content = fread($file, filesize($filePath));
            fclose($file);
            return $content;
        } catch (\Exception $e) {
            return '';
        }
    }
131424
public function propertyPath($data, $propertyPath)
    {
        if (null !== $propertyPath && !$propertyPath instanceof PropertyPathInterface) {
            $propertyPath = new PropertyPath($propertyPath);
        }

        if ($propertyPath instanceof PropertyPathInterface && (\is_object($data) || $data instanceof \ArrayAccess)) {
            $data = $this->propertyAccessor->getValue($data, $propertyPath);
        }

        return $data;
    }
208614
private function hydrateOne(string $classPath, array $data): Hydratable
    {
        /** @var Hydratable $entity */
        $entity = new $classPath();
        $entity->hydrate($data);

        return $entity;
    }
899981
private function toDatabaseFilePath($filePath)
    {
        if ($filePath === null) {
            $temporaryFile =  sys_get_temp_dir() . '/' . uniqid('db-', true) . '.sqlite';
            // Ensure that the temporary file is removed on shutdown, otherwise the filesystem
            // might be cluttered with database files.
            register_shutdown_function(array($this, 'cleanUp'));
            return $temporaryFile;
        }
        return $filePath;
    }
468521
protected function loadData($filePath, $returns = array())
    {
        if (file_exists($filePath)) {
            $content = $this->getFileManager()->getContents($filePath);
            $data = Json::getArrayData($content);
            if (empty($data)) {
                $GLOBALS['log']->warning('FileUnifier::unify() - Empty file or syntax error - ['.$filePath.']');
                return $returns;
            }

            return $data;
        }

        return $returns;
    }
844237
public static function open(string $filepath):\stdClass
    {
        if ($filepath == self::$filepath && self::$file != null) {
            return (self::$file);
        }

        if (!file_exists($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" => "Cannot open file $filepath : File does not exist",
                "solution" => "Please set the correct filepath")));
        }

        if (!is_readable($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" => "Cannot open file $filepath : File not readable",
                "solution" => "Please set the correct permission")));
        }

        $a = json_decode(file_get_contents($filepath));

        self::$file = ($a == null ? new \stdClass() : $a);
        return ($a == null ? new \stdClass() : $a);
    }
1277242
protected function insertDataToLine(string $data, string $filePath, int $lineNumber): bool
    {
        $lines = file($filePath);
        if ($lines === false) {
            return false;
        }

        if (count($lines) + 1 < $lineNumber) {
            $lineNumber = count($lines) + 1;
        }
        if ($lineNumber < 1) {
            $lineNumber = 1;
        }

        array_splice($lines, $lineNumber - 1, 0, [$data]);

        $result = file_put_contents($filePath, implode('', $lines));
        if ($result === false) {
            return false;
        }

        return true;
    }
892989
public function renderParticle($fileName, $data = [], $path = "")
    {
        ob_start();
        ob_implicit_flush(false);
        $viewFile = $this->getViewPath() . '/' . $fileName . '.php';
        if ($path) {
            $viewFile = $path . '/' . $fileName . '.php';
        }
        unset($fileName);
        extract($data);
        unset($data);
        if (substr($viewFile, -9) == 'blade.php') {
            //blade 需要解析模板
            $tmp = X::app()->runtimePath . '/views/' . md5($viewFile) . '.php';
            //当编译文件不存在，或者模板文件修改过，则生成编译文件
            if (!file_exists($tmp) || filemtime($tmp) < filemtime($viewFile) || X_DEBUG) {
                //引入模板解析类
                $parser = new TemplateParser($viewFile);
                $parser->compile($tmp);
            }
            require $tmp;
        } else {
            require($viewFile);
        }
        return ob_get_clean();
    }
996182
public static function readFile($filePath)
    {
        if (false === self::exists($filePath)) {
            throw new RuntimeException(sprintf('unable to find "%s"', $filePath));
        }
        if (false === $fileData = file_get_contents($filePath)) {
            throw new RuntimeException(sprintf('unable to read file "%s"', $filePath));
        }

        return $fileData;
    }
1002137
private function getTranslationsInFile($filePath)
    {
        
	 	// File extension ?
        $extOk = in_array(\Jig\Utils\FsUtils::getFileExtension($filePath), $this->getFileTypes());

        if ($extOk){
            foreach ($this->getBannedFileType() as $bannedExt){
                $extOk &= substr_compare($filePath, $bannedExt, strlen($filePath)-strlen($bannedExt), strlen($bannedExt)) !== 0;
            }
        }

        if ($extOk) {
            
		 	// We read the file.
		 	$lines = file($filePath);
		 	foreach ($lines as $line) {
                $strings = $this->getTranslationPhrases( $line );
                //preg_match_all("/__(\(| )+['\"](.*?)['\"](\))?/u", $line, $string);
                
                //lookup for __('to translate') or __ 'to translate'
            //    preg_match_all("/__(\(| )+(('(.*?)')|(\"(.*?)\"))(\))?/u", $line, $string);
            
                foreach($strings as $s) {
                    $tu = new tao_helpers_translation_TranslationUnit();
                    $tu->setSource(tao_helpers_translation_POUtils::sanitize($s));
                    $tus = $this->getTranslationUnits();
                    $found = false;
                    
                    // We must add the string as a new TranslationUnit only
                    // if a similiar source does not exist.
                    foreach ($tus as $t) {
                        if ($tu->getSource() == $t->getSource()) {
                            $found = true;
                            break;
                        }
                    }
                    
                    if (!$found) {
                        $tus[] = $tu;
                        $this->setTranslationUnits($tus);
                    }
                }
		 	}
		}
        
    }
886575
public function locate($filePath)
    {
        $file = $filePath;
        if (!is_file($filePath))
        {
            throw new FileException(sprintf('Invalid file! File "%s" does not exist.',
                                            $filePath));
        }

        if (!is_readable($filePath))
        {
            throw new FileException(sprintf('Invalid file! File "%s" is not readable.',
                                            $filePath));
        }

        $pathInfo = pathinfo($filePath);
        if (!isset($pathInfo['extension'])
            || !in_array($pathInfo['extension'], $this->supportedExtensions)
        )
        {
            throw new FileException(sprintf('Invalid file extension! Supported file extensions: %s',
                implode(', ', $this->supportedExtensions)));
        }

        return realpath($file);
    }