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


PHP Helpers::loadFromFile方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $connection = new \Nette\Database\Connection('mysql:host=127.0.0.1;dbname=test', 'root', '');
     \Nette\Database\Helpers::loadFromFile($connection, __DIR__ . '/sql/db.sql');
     $structure = new \Nette\Database\Structure($connection, new \Nette\Caching\Storages\FileStorage(__DIR__ . '/../../temp/'));
     $conventions = new \Nette\Database\Conventions\DiscoveredConventions($structure);
     $this->database = new \Nette\Database\Context($connection, $structure, $conventions, new \Nette\Caching\Storages\FileStorage(__DIR__ . '/../../temp/'));
     $this->cache = new Nette\Caching\Storages\FileStorage(__DIR__ . '/../../temp');
 }
开发者ID:kravcik,项目名称:core,代码行数:9,代码来源:Service.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $connection = $this->database->getConnection();
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_USERS_TABLE));
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_ROLES_TABLE));
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_RESOURCES_TABLE));
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_USER_ROLE_TABLE));
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_USER_REQUEST_TABLE));
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_ROLES_DATA_TABLE));
     Nette\Database\Helpers::loadFromFile($connection, $this->getFile(static::FILE_IDENTITY_HASH_TABLE));
 }
开发者ID:trejjam,项目名称:authorization,代码行数:11,代码来源:Install.php

示例3: __testbench_ndb_setupDatabase

 /** @internal */
 private function __testbench_ndb_setupDatabase(Connection $db, $container)
 {
     $this->__testbench_ndb_databaseName = 'db_tests_' . getmypid();
     $this->__testbench_ndb_dropDatabase($db);
     $this->__testbench_ndb_createDatabase($db);
     if (isset($container->parameters['testbench']['sqls'])) {
         foreach ($container->parameters['testbench']['sqls'] as $file) {
             \Nette\Database\Helpers::loadFromFile($db, $file);
         }
     }
     register_shutdown_function(function () use($db) {
         $this->__testbench_ndb_dropDatabase($db);
     });
 }
开发者ID:jakubskrz,项目名称:testbench,代码行数:15,代码来源:TNetteDatabase.php

示例4: __testbench_database_setup

 /** @internal */
 public function __testbench_database_setup($connection, \Nette\DI\Container $container, $persistent = FALSE)
 {
     $config = $container->parameters['testbench'];
     $this->__testbench_databaseName = $config['dbprefix'] . getenv(\Tester\Environment::THREAD);
     $this->__testbench_database_drop($connection, $container);
     $this->__testbench_database_create($connection, $container);
     foreach ($config['sqls'] as $file) {
         \Nette\Database\Helpers::loadFromFile($connection, $file);
     }
     if ($persistent === FALSE) {
         register_shutdown_function(function () use($connection, $container) {
             $this->__testbench_database_drop($connection, $container);
         });
     }
 }
开发者ID:mrtnzlml,项目名称:testbench,代码行数:16,代码来源:NetteDatabaseConnectionMock.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $connection = $this->database->getConnection();
     $driverName = $connection->getPdo()->getAttribute(\PDO::ATTR_DRIVER_NAME);
     Nette\Database\Helpers::loadFromFile($connection, $this->getFileName($driverName . '.' . static::FILE_LABELS_TABLE));
 }
开发者ID:trejjam,项目名称:utils,代码行数:6,代码来源:Install.php

示例6: set_time_limit

require_once __DIR__ . "/libs/Curl.php";
require_once __DIR__ . "/libs/CurlResponse.php";
require_once __DIR__ . "/libs/Parser.php";
use Nette\Diagnostics\Debugger;
set_time_limit(0);
Debugger::enable(Debugger::DEVELOPMENT, __DIR__);
Debugger::timer();
/************************************ SQLite *************************************/
/*if (file_exists(__DIR__."/db.sqlite")) {
	copy(__DIR__."/db.sqlite", __DIR__."/backup/".date("Y-m-d_H-i-s-").substr(microtime(TRUE)-time(), 2, 4).".sqlite");
}
$connection = new \Nette\Database\Connection('sqlite:' . __DIR__ . '/db.sqlite');
\Nette\Database\Helpers::loadFromFile($connection, __DIR__ . '/db.structure.sqlite.sql');
/************************************ MySQL *************************************/
$connection = new \Nette\Database\Connection('mysql:host=localhost;dbname=njlogparser', 'nette', 'nette');
\Nette\Database\Helpers::loadFromFile($connection, __DIR__ . '/db.structure.mysql.sql');
if (!defined('STDIN')) {
    echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Nette Jabber Log Parser</title></head><body><code><pre>';
}
$parser = new Parser($connection);
$parser->originalDataDir = __DIR__ . "/data";
//$parser->debug = TRUE;
$factory = new \Nette\Http\RequestFactory();
$factory->setEncoding('UTF-8');
$req = $factory->createHttpRequest();
if (($date = $req->getQuery('date', NULL)) || ($date = isset($argv[1]) ? $argv[1] : NULL)) {
    $parser->parseDate($date, TRUE);
} else {
    $parser->parse(10);
}
echo "\n\n";
开发者ID:Vrtak-CZ,项目名称:NJLogParser,代码行数:31,代码来源:index.php

示例7: catch

<?php

/**
 * Test: Nette\Database test boostap.
 *
 * @author     Jakub Vrana
 * @author     Jan Skrasek
 * @package    Nette\Caching
 * @subpackage UnitTests
 */
use Nette\Database;
require __DIR__ . '/../bootstrap.php';
try {
    $connection = new Database\Connection('mysql:host=localhost', 'root');
    Database\Helpers::loadFromFile($connection, __DIR__ . '/nette_test.sql');
} catch (PDOException $e) {
    TestHelpers::skip('Requires corretly configured mysql connection and "nette_test" database.');
}
开发者ID:kravco,项目名称:nette,代码行数:18,代码来源:connect.inc.php

示例8: importFile

 function importFile($filename)
 {
     \Nette\Database\Helpers::loadFromFile($this->connection, $filename);
 }
开发者ID:ondrakoupil,项目名称:testing-utils,代码行数:4,代码来源:NetteDatabaseTestCase.php


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