データベースのダンプ (Previous) (Next) データベースの更新

View this page in Last updated: Sun, 05 Oct 2008
English | French | German | Hungarian | Japanese | Spanish | Plain HTML

データベースの作成

データベースの作成 -- MDB2 XML からのデータベースの復元

データベースの作成

スキーマファイルからデータベースを作成するのは簡単で、 次のようにするだけです。


<?php
require_once 'MDB2/Schema.php';

$options = array(
    'log_line_break' => '<br>',
    'idxname_format' => '%s',
    'debug' => true,
    'quote_identifier' => true,
    'force_defaults' => false,
    'portability' => false
);
$dsn 'mysql://root:@localhost/MDB2Example';

$schema =& MDB2_Schema::factory($dsn$options);

if (PEAR::isError($schema)) {
    $error $schema->getMessage();
} else {
    // 最初はクエリを無効にして実行し、すべてがうまくいくようにします
    $disable_query true;

    $definition $schema->parseDatabaseDefinitionFile('example.xml');
    if (PEAR::isError($definition)) {
      $error $definition->getMessage();
    } else {
      $op $schema->createDatabase($definition, array(), $disable_query);

      if (PEAR::isError($op)) {
        $error $op->getMessage();
      }
    }
}

if (isset($error)) {
    var_dump($error);
}

$schema->disconnect();
?>

データベースのダンプ (Previous) (Next) データベースの更新

Download Documentation Last updated: Sun, 05 Oct 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.