ezComponents ready for prod?

by Harun Yayli on Monday, February 11th, 2008 at 12:47 pm under PHP, Software

I’m following what ezComponents doing for sometime now.
Quite nice framework for whatever you need.
I gave a try to write a mysql schema sync.
Real easy to write. only 4-5 lines of code to sync schemas.
It would have been great if it was actually working. The outout sql ddl is not runnable in some cases (syntax errors). Or the order of the columns are different.
I’m sure they’ll fix it soon but this tells me they are not yet ready for production quality.

See the code below, maybe I’m doing something wrong.


<?php
require_once "ezcomponents/Base/src/base.php";

function __autoload( $className ){
ezcBase::autoload( $className );
}

$sourcedb['host']= isset($_POST['sourcedb']['host'])? $_POST['sourcedb']['host']:”;
$sourcedb['port']= isset($_POST['sourcedb']['port'])? $_POST['sourcedb']['port']:”;
$sourcedb['user']= isset($_POST['sourcedb']['user'])? $_POST['sourcedb']['user']:”;
$sourcedb['pass']= isset($_POST['sourcedb']['pass'])? $_POST['sourcedb']['pass']:”;
$sourcedb['db']= isset($_POST['sourcedb']['db'])? $_POST['sourcedb']['db']:”;
$destdb['host']= isset($_POST['destdb']['host'])? $_POST['destdb']['host']:”;
$destdb['port']= isset($_POST['destdb']['port'])? $_POST['destdb']['port']:”;
$destdb['user']= isset($_POST['destdb']['user'])? $_POST['destdb']['user']:”;
$destdb['pass']= isset($_POST['destdb']['pass'])? $_POST['destdb']['pass']:”;
$destdb['db']= isset($_POST['destdb']['db'])? $_POST['destdb']['db']:”;

$ddl = null;
if (count($_POST)>0){
$sdb = ezcDbFactory::create(”mysql://{$sourcedb['user']}:{$sourcedb['pass']}@{$sourcedb['host']}:{$sourcedb['port']}/{$sourcedb['db']}”);
$souceSchema = ezcDbSchema::createFromDb($sdb);

$ddb = ezcDbFactory::create(”mysql://{$destdb['user']}:{$destdb['pass']}@{$destdb['host']}:{$destdb['port']}/{$destdb['db']}”);
$destSchema = ezcDbSchema::createFromDb($ddb);
$diffSchema = ezcDbSchemaComparator::compareSchemas( $destSchema,$souceSchema );
$ddl = $diffSchema->convertToDDL( $ddb );
}
?>

<html>
<style>
input{
width:120px;
}
</style>
<body>
<h1> Schema Comparator for MySQL</h1>
<p>Compares the source and destination db schemas, gives the DDL to apply to the destination.</p>
<br />
<form action=”#” method=”post”>
<table border=”1″>
<tr><td>

<table>
<tr><td>Source Db Server: </td><td><input type=”text” name=”sourcedb[host]” value=”<?php echo $sourcedb['host'];?/>”/> Port:<input type=”text” name=”sourcedb[port]” value=”<?php echo $sourcedb['port'];?/>”/></td></tr>
<tr><td>Source Db Username: </td><td><input type=”text” name=”sourcedb[user]” value=”<?php echo $sourcedb['user'];?/>”/></td></tr>
<tr><td>Source Db Password: </td><td><input type=”text” name=”sourcedb[pass]” value=”<?php echo $sourcedb['pass'];?/>”/></td></tr>
<tr><td>Source Db : </td><td><input type=”text” name=”sourcedb[db]” value=”<?php echo $sourcedb['db'];?/>”/></td></tr>
</table>
</td><td>
<table>
<tr><td>Destination Db Server: </td><td><input type=”text” name=”destdb[host]” value=”<?php echo $destdb['host'];?/>”/> Port:<input type=”text” name=”destdb[port]” value=”<?php echo $destdb['port'];?/>”/></td></tr>
<tr><td>Destination Db Username: </td><td><input type=”text” name=”destdb[user]” value=”<?php echo $destdb['user'];?/>”/></td></tr>
<tr><td>Destination Db Password: </td><td><input type=”text” name=”destdb[pass]” value=”<?php echo $destdb['pass'];?/>”/></td></tr>
<tr><td>Destination Db : </td><td><input type=”text” name=”destdb[db]” value=”<?php echo $destdb['db'];?/>”/></td></tr>
</table>
</td></tr>
<tr><td colspan=”2″ align=”center”><input type=”submit” value=”Compare”/></td></tr>
</table>
</form>
<pre>
< ?php
if (count($_POST)>0){
if ($ddl!=null && count($ddl)>0){
echo ‘USE ‘.$destdb['db'].”;\n”;
foreach($ddl as $lines){
echo $lines.”;\n”;
}
}
else{
echo ‘– No diff’;
}
}
?>
</pre>
</body>
</html>

Followup:
bug is entered as http://issues.ez.no/IssueView.php?Id=12538&activeItem=1

Recent Entries

2 Responses to “ezComponents ready for prod?”

  1. Derick Says:

    Please submit a bug report about this, including your database schema so that we can have a look at it.

  2. Harun Yayli Says:

    Derick,

    i don’t want to bash you guys but you’re leaving me no chance.
    I’ve just tried to find your bug reporter and finally after 3-4 clicks I’ve found it. It took me a while to look for the create issue button and realized, there is none (at least I saw none)!. I’ve guessed that I should create an account first, which I did.
    And I finally received your email, clicked the link, asked me to login and boom:

    Sorry, the key submitted was not a valid key. Account was not activated.

    Guys, come on! You have bugs in your bug tracker.

Leave a Reply

authimage