當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。