Location: PHPKode > projects > deltasql > deltasql-1.2.1/dbsync.php
<?php session_start(); ?>
<title>deltasql - Database Synchronization Form</title>
<link rel="stylesheet" type="text/css" href="deltasql.css">

if (!file_exists($configurationfile)) die("<h2><a href=\"install.php\">$installmessage</a></h2>");

$rights = $_SESSION["rights"];
$user = $_SESSION["username"];
$userid = $_SESSION["userid"];
$defaultprojectid = $_GET["id"];
$defaultprojectname = $_GET["name"];

//if ($rights<1) die("<b>Not enough rights to synchronize a database schema.</b>");
<h1>Database Synchronization Form</h1>

<p>1) First, make sure your database schema has a table called TBSYNCHRONIZE. If not, click on the <a href="list_projects.php">
project list</a> and press on the 'Table' link, this will generate a script you have to launch on your database schema.
<p>2) You should run the following query into the database instance you would like
to synchronize, and then fill the form below with the query's results as explained in the italic comments</p>
select * from TBSYNCHRONIZE where versionnr = (select max(versionnr) from TBSYNCHRONIZE);
<p>3) Please enter the synchronization details you retrieved from the query:</p>

<form action="dbsync_update.php" method="post">
 echo "<table>";
 echo "<tr><td><b>Project Name:</b></td><td>";
 echo "<select NAME=\"frmprojectid\">";
 mysql_connect($dbserver, $username, $password);
 @mysql_select_db($database) or die("Unable to select database");
 $query="SELECT * FROM tbproject ORDER BY name";
 if ($defaultprojectid=="") echo "<option VALUE=\"\" SELECTED> ";
 while ($i<$num) { 
   echo "<option ";
   if ($projectid==$defaultprojectid) echo "SELECTED ";
   echo "VALUE=\"$projectid\">$projectname";
 echo "</select>";
 echo "</td><td><i>= value in column projectname</i></td></tr>";
 echo "<tr><td><b>Version Number:</b></td>";
 echo "<td><input type=\"text\" name=\"lastversionnr\" value=\"\"></td><td><i>= value in column versionnr</i></td></tr>";
 echo "<tr><td><b>From:</b></td>";
 echo "<td>";
 echo "<select NAME=\"frombranchid\">";
 $query7="SELECT * FROM tbbranch WHERE visible=1 order by id ASC";
 while ($i<$num7) { 
   echo "<option ";
   if ($branchname=="HEAD") echo "SELECTED ";
   echo "VALUE=\"$branchid\">$branchname";
 echo "</select></td><td><i>= value in column branchname</i></td></tr>";
 echo "<tr><td><b>Update To:</b></td>";
 echo "<td>";
 echo "<select NAME=\"tobranchid\">";
 while ($i<$num7) { 
   echo "<option ";
   if ($branchname=="HEAD") echo "SELECTED ";
   echo "VALUE=\"$branchid\">$branchname";
 echo "</select>";
 echo "</td><td><i>= HEAD if schema has to include all scripts or another branch name if not</i></td></tr>";
 echo "</tr>";
 echo "<tr><td><b>Database Type:</b></td><td>";
 echo "</td><td><i>= value in column dbtype</i></td></tr>";

 // disabled as it creates confusion
 echo "<tr><td><b>Schema name</b></td>";
 echo "<td><input type=\"text\" name=\"frmschemaname\" value=\"\" size=\"70\"></td><td><i>= value in column schema name (optional)</i></td></tr>";
 echo "<tr><td><b>Commit Comment:</b></td>";
 echo "<td><input type=\"text\" name=\"frmcommitcomment\" value=\"\" size=\"70\"></td><td><i>= comment which will be shown on top of generated script (optional)</i></td></tr>";
 if ($rights>1) {
   echo "<td><b>Exclude:</b></td>";
   echo "<td><input name=\"frmexcludeviews\" type=\"checkbox\" value=\"1\"/>Views";
   echo "<input name=\"frmexcludepackages\" type=\"checkbox\" value=\"1\"/>Packages</td>";
   echo "<td>";
   echo "<a href=\"detect_packages_and_views.php\">Detect views and packages</a></td>";
 echo "</td></tr>";
 echo "<tr><td><b>Output Format:</b> </td>";
 echo "<td>";
 echo "<input type=\"radio\" name=\"formatgroup\" value=\"html\" checked> HTML";
 echo "<input type=\"radio\" name=\"formatgroup\" value=\"text\"> Text";
 echo "<input type=\"radio\" name=\"formatgroup\" value=\"xml\"> XML";
 echo "<input type=\"radio\" name=\"formatgroup\" value=\"singlefiles\"> Single files (zipped)";
 echo "</td></tr>";
 echo "</table><br><br>";
<b>4) Please copy and execute in a sql client (like SqlPlus or Toad or PhpMyAdmin) the script you
 will receive after pressing the Submit button! This will update both your database schema and the
  synchronization information in TBSYNCHRONIZE.</b><br>
<input type="Submit">
<a href="index.php">Back to Main Page</a>
Return current item: deltasql