Login   Register  
PHP Classes
elePHPant
Icontem

File: setup_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Manuel Lemos  >  Metabase  >  setup_test.php  >  Download  
File: setup_test.php
Role: Example script
Content type: text/plain
Description: Test database setup script.
Class: Metabase
PHP Database abstraction layer RDBMS independent
Author: By
Last change: Used PHP open tag <?php ?p>.
Date: 3 years ago
Size: 1,043 bytes
 

Contents

Class file image Download
<?php
/*
 * setup_test.php
 *
 * @(#) $Header: /opt2/ena/metal/metabase/setup_test.php,v 1.7 2002/12/11 22:52:24 mlemos Exp $
 *
 */

    
require("metabase_parser.php");
    require(
"metabase_manager.php");
    require(
"metabase_database.php");
    require(
"metabase_interface.php");
    require(
"xml_parser.php");

Function 
Output($message)
{
    echo 
$message,"\n";
}

Function 
Dump($output)
{
    echo 
$output;
}

    
$input_file=($argc<"test.schema" $argv[1]);
    
$variables=array(
        
"create"=>"1"
    
);
    
$arguments=array(
        
"Type"=>"mysql",
        
"User"=>"root",
        
"Debug"=>"Output"
    
);
    
$manager=new metabase_manager_class;
    
$manager->debug="Output";
    
$success=$manager->UpdateDatabase($input_file,$input_file.".before",$arguments,$variables);
    if(
$success)
    {
        echo 
$manager->DumpDatabase(array(
            
"Output"=>"Dump",
            
"EndOfLine"=>"\n"
        
));
    }
    else
        echo 
"Error: ".$manager->error."\n";
    if(
count($manager->warnings)>0)
        echo 
"WARNING:\n",implode($manager->warnings,"!\n"),"\n";
    if(
$manager->database)
        echo 
MetabaseDebugOutput($manager->database);

?>