Interestingly, that's exactly what I did in the first versions of auto_coder.
One of the problems with this approach is that we don't have an easy way to define broader project properties -- we're too focused on the database design.
Moreover, we must write different scripts for different databases; with XML we can write a single source and generate different scripts.
Another advantage of XML is the avaibility of modules like XML::Simple, which translates a XML source into a Perl data structure like this:
$VAR1 = {
'table' => [
{
'descriptor' => 'name',
'caption' => 'contact',
'name' => 'contact',
'field' => [
{
'notnull' => '1',
'caption' => 'first name',
'name' => 'name',
'type' => 'varchar',
'size' => '40'
},
{
'visible' => '1',
'caption' => 'organization',
'name' => 'organization',
'type' => 'varchar',
'size' => '40'
},
# ...and so on.
In other words, extending SQL with comments *was* my first approach, but it had its shortcomings. |