You might remember my mistake with the definition of a field that 
differed between the "create table..." statement for the database and 
the RDBO-class. I think it is always error prone to have two such 
definitions around.
So woudn't it be great if it was possible to maintain only the class 
definition and have a 'create_sql_from_class' method that gave the 
sql to create a new table according to the actual class definition.
Some sort of a 'foreach' mechanism would be handy to do this for the 
whole database and perhaps a second method to appy the sql to an 
empty database.

What I would like is the counterpart to make_modules(). Then one 
could start with a hand-made database, do a make_modules, fine-tune 
the created modules/classes without keeping the original SQL-
statements in sync. After a change one would issue a drop table (or 
even drop database) and do a make_table() or make_database() and be 
ready.
Well there are also indexes and the data but that shouldn't be too 
much of a problem (index creation has very simple syntax and the data 
can be dumped before the drop and then reimported).

I see three main advantages:
1. Maintainability (see above) The info about the structure of the 
table is in only one place, the DRY-principle (don't repeat 
yourself).
2. Database independence. The created SQL would consider the features 
and SQL-dialects of the given RDBM and it should be possible to say 
'create the table in this MySQL database' (or give me the SQL to do 
it myself).
3. Easy deployment. It would be enough to give away a bunch of Perl 
modules and ask the end user which database system he wants to use 
and the installation script would do it -- without keeping around an 
SQL-script for every supported RDBM.

What do you think?

Cheers,
Michael



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to