PHP Classes

File: get_database.php

Recommend this page to a friend!
  Classes of Manuel Lemos   Metabase   get_database.php   Download  
File: get_database.php
Role: Auxiliary script
Content type: text/plain
Description: Utility script to reverse engineer installed database schemas to Metabase XML definition
Class: Metabase
PHP Database abstraction layer RDBMS independent
Author: By
Last change: Added the missing include of metabase_lob.php for dumping databases with
LOB fields.
Date: 12 years ago
Size: 1,081 bytes
 

Contents

Class file image Download
#!/usr/local/bin/php -q
<?php
/*
 * get_database.php
 *
 * @(#) $Header: /opt2/ena/metal/metabase/get_database.php,v 1.4 2005/04/29 02:08:29 mlemos Exp $
 *
 */

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

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


    if(
$argc<2)
    {
        echo
"Usage: ".$argv[0]." Connection-string\n";
        echo
"Example: ".$argv[0]." mysql://root@localhost/driver_test?Options/Port=/var/lib/mysql/mysql.sock\n";
        exit;
    }
   
$arguments=array(
     
"Connection"=>$argv[1]
    );
   
$manager=new metabase_manager_class;
    if(
strlen($error=$manager->GetDefinitionFromDatabase($arguments))==0)
    {
       
$error=$manager->DumpDatabase(array(
           
"Output"=>"Dump",
           
"EndOfLine"=>"\n")
        );
    }
    else
        echo
"Error: $error\n";
    if(
$manager->database)
    {
/*
        if(count($manager->warnings)>0)
            echo "WARNING:\n",implode($manager->warnings,"!\n"),"\n";
        echo MetabaseDebugOutput($manager->database);
*/
       
$manager->CloseSetup();
    }
?>