Call this method to create an XML schema string from an existing database.
If the data parameter is set to TRUE, AXMLS will include the data from the database
in the schema.
public ExtractSchema ( boolean $data = FALSE ) : string | ||
$data | boolean | Include data in schema dump |
return | string | Generated XML schema |
if ($dbc) { $existing_db = $db->SelectDB($dbname); } } else { $dbc = false; } // Quick hack to ensure MySQL behaves itself (#2323) $db->Execute("SET sql_mode := ''"); $current_version = $dp_version_major . '.' . $dp_version_minor; $current_version .= isset($dp_version_patch) ? '.' . $dp_version_patch : ''; $current_version .= isset($dp_version_prepatch) ? '-' . $dp_version_prepatch : ''; if ($dobackup) { if ($dbc) { require_once DP_BASE_DIR . '/lib/adodb/adodb-xmlschema.inc.php'; $schema = new adoSchema($db); $sql = $schema->ExtractSchema(true); header('Content-Disposition: attachment; filename="dPdbBackup' . date('Ymd') . date('His') . '.xml"'); header('Content-Type: text/xml'); echo $sql; exit; } else { $backupMsg = 'ERROR: No Database Connection available! - Backup not performed!'; } } ?> <html> <head> <title>dotProject Installer</title> <meta name="Description" content="dotProject Installer"> <link rel="stylesheet" type="text/css" href="../style/default/main.css"> </head>
<?php error_reporting(E_ALL); die('Enable me by commenting this out by editing ' . basename(__FILE__) . ' at line ' . __LINE__); require_once '../vendor/adodb/adodb-php/adodb.inc.php'; require_once '../vendor/adodb/adodb-php/adodb-xmlschema03.inc.php'; $conf = @parse_ini_file('../flyspray.conf.php', true) or die('Cannot open config file.'); /* Start by creating a normal ADODB connection. */ $db = ADONewConnection($conf['database']['dbtype']); $db->Connect($conf['database']['dbhost'], $conf['database']['dbuser'], $conf['database']['dbpass'], $conf['database']['dbname']) or die('Cannot connect to DB.'); $db->debug = true; /* Use the database connection to create a new adoSchema object. */ $schema = new adoSchema($db); $withdata = false; $stripprefix = true; $data = $schema->ExtractSchema($withdata, ' ', $conf['database']['dbprefix'], $stripprefix); file_put_contents('flyspray-schema.xml', $data);
<?php error_reporting(E_ALL); require_once '../adodb/adodb.inc.php'; require_once '../adodb/adodb-xmlschema03.inc.php'; $conf = @parse_ini_file('../flyspray.conf.php', true) or die('Cannot open config file.'); /* Start by creating a normal ADODB connection. */ $db = ADONewConnection($conf['database']['dbtype']); $db->Connect($conf['database']['dbhost'], $conf['database']['dbuser'], $conf['database']['dbpass'], $conf['database']['dbname']) or die('Cannot connect to DB.'); $db->debug = true; /* Use the database connection to create a new adoSchema object. */ $schema = new adoSchema($db); $data = $schema->ExtractSchema(); $data = str_replace('flyspray_', '', $data); file_put_contents('flyspray-schema.xml', $data);
<?php require '../adodb/adodb5/adodb.inc.php'; require '../adodb/adodb5/adodb-xmlschema.inc.php'; $_server = "IMAGESERVER,1433"; $_dbServer = "3170-090204"; $_dbServer = "disney-live"; $_dbUsername = "******"; $_dbPassword = "******"; $dsn = "Driver={SQL Server};Server=" . $_server . ";Database=" . $_dbServer . ";"; $db =& NewADOConnection('odbc_mssql'); $db->Connect($dsn, $_dbUsername, $_dbPassword); $dict = NewDataDictionary($db); $schema = new adoSchema($db); $ext = $schema->ExtractSchema(true); //print_r($ext); die;