loadFile() public static méthode

Import SQL dump from file - extreme fast!
public static loadFile ( $file ) : integer
Résultat integer count of sql commands
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">

<h1>Importing SQL Dump from File | dibi</h1>

<?php 
require __DIR__ . '/../src/loader.php';
dibi::connect(['driver' => 'sqlite3', 'database' => 'data/sample.s3db']);
$count = dibi::loadFile('compress.zlib://data/sample.dump.sql.gz');
echo 'Number of SQL commands:', $count;
Exemple #2
0
<?php

namespace ActiveMapperTests;

require_once __DIR__ . "/../libs/Nette/loader.php";
\Nette\Debug::enable(\Nette\Debug::DEVELOPMENT);
\Nette\Environment::setVariable("tempDir", __DIR__ . "/_temp");
$loader = new \Nette\Loaders\RobotLoader();
$loader->addDirectory(__DIR__ . "/../libs");
$loader->addDirectory(__DIR__ . "/../ActiveMapper");
$loader->addDirectory(__DIR__ . "/../examples/Models");
$loader->register();
\dibi::connect(array('driver' => "sqlite3", 'database' => ":memory:", 'formatDateTime' => "'Y-m-d H:i:s'", 'lazy' => TRUE, 'profiler' => TRUE));
\dibi::loadFile(__DIR__ . "/db.structure.sql");
\dibi::loadFile(__DIR__ . "/db.data.sql");
Exemple #3
0
<?php

// The point of this file is to be ran 1 time to set up all the tables necessary for lolscores to run.
// This script uses .sql files that have to be UPDATED after every structural change to the database.
define('WEBSECURITY', 'ok');
require '../__init.php';
if (isset($_GET["hash"]) && defined('SAFETY_HASH') && $_GET["hash"] == SAFETY_HASH) {
    dibi::loadFile('../sql/lolscores.sql');
    print "DB install is done.";
} else {
    print "Stop hacking pls.";
}