Example #1
0
// Set $db_create to 0 to NOT create the database.
$db_create = 1;
// Communication protocol tu use. For pgsql, you can use 'unix' instead of
// 'tcp' to use Unix Domain Sockets instead of TCP/IP.
$db_protocol = "tcp";
/**************************
* DBMS specific options
***************************/
//****ORACLE*****
// Home directory path where Oracle is installed if it is running in the local machine.
// Default value: value of the environment variable ORACLE_HOME
$oci8_home = "";
/**************************
* End of database settings
***************************/
include_once "MDB.php";
MDB::loadFile("Manager");
$schema_file = "mrbs.schema.xml";
$variables = array("database_name" => $db_database, "database_create" => $db_create);
$dsn = array("phptype" => $dbsys, "username" => $db_login, "password" => $db_password, "hostspec" => $db_host, "protocol" => $db_protocol, "port" => $db_port);
$options = array("HOME" => $oci8_home, "optimize" => 'portability');
$manager = new MDB_manager();
$manager->connect($dsn, $options);
$success = $manager->updateDatabase($schema_file, $schema_file . ".before", $variables);
if (MDB::isError($success)) {
    echo "Error: " . $success->getMessage() . "<BR>";
    echo "Error: " . $success->getUserInfo() . "<BR>";
}
if (count($manager->warnings) > 0) {
    echo "WARNING:<BR>", implode($manager->getWarnings(), "!\n"), "\n";
}
Example #2
0
 *
 */
define('LIB_MDB', '');
require_once LIB_MDB . 'MDB.php';
MDB::loadFile('Manager');
$mdb_schema_file = 'mdb-schema.xml';
$dbName = 'copixwebapp';
// set the array of "variables" in the  $schema_file
$variables = array();
// set the array of "options" for the DBMS
// Note: it's possible to set options with
$options = array('UseTransactions' => true, 'DefaultTableType' => 'INNODB', 'persistent' => false, 'debug' => 5);
// set the array of information for the connexion to the DBMS
// Note: DSN format = DBMS_type://user_name:password@hostserver.DB_name
$dbinfo = array('phptype' => 'mysql', 'username' => 'root', 'hostspec' => 'localhost', 'password' => 'pierre');
$manager = new MDB_manager();
$manager->connect($dbinfo, $options);
$success = $manager->updateDataBase($mdb_schema_file, '', $variables);
if (MDB::isError($success)) {
    echo 'Error: ' . $success->getMessage() . '\\n<br>';
    echo $success->toString() . " \n<br>";
}
if (count($manager->warnings) > 0) {
    echo 'Warning: \\n' . implode($manager->getWarnings(), '!\\n') . '\\n';
}
$manager->disconnect();
$dbLink = mysql_pconnect('localhost', 'root', 'pierre');
// @todo: ici il faudrait en fait récupérer le nom de la BDD figurant dans
//        le schéma !
$dbResult = mysql_select_db($dbName, $dbLink);
/*