On Wed, 01 Mar 2006 23:39:42 -0500, John Siracusa wrote:

Hi John

> Ah, I didn't know you were editing Rose::DB::Object modules yet.
> I'll add them to the Oracle branch.

I wasn't intending to work on it. I just wanted to fiddle it to see what
happened with my source code generator.

> Having just taken a casual look at your changes, I think you just
> broke some or all of the other dbs :)  For each Oracle-specific

I'm not surprised. I simply rigged it for Oracle :-).

> thing that you need to do in any "shared" module, you have two
> choices.
>
> You can create a private Rose::DB method to make each decision
> (e.g., column_info_uses_uc_table_name() or something) and then make
> sure that only Rose::DB::Oracle overrides it in such a way that it
> alters the existing behavior.
>
> The second choice is to create an Oracle-specific Metadata::Auto
> subclass:
>
> Rose::DB::Object::Metadata::Auto::Oracle
>
> and put all your Oracle-specific code in there.  That way you can
> be sure you aren't altering any existing behavior for other drivers.

Since the generated code for Oracle is so wrong, I'd have to say the 2nd option
will be a much cleaner result.

For the record, what I've done is:

o Created a test program which when run generates Perl source

o Converted that program into a HTML::Template-style template, with a couple of
loops over table names
<code>
$boilerplate as recommended elsewhere

<tmpl_loop name=package_loop>
package <tmpl_var name=module_name>;

use base 'Base::Object';

__PACKAGE__ -> meta -> table('<tmpl_var name=table_name>');
__PACKAGE__ -> meta -> auto_initialize;

1;

# -----------------------------------------------

</tmpl_loop>
package main;

<tmpl_loop name=module_loop>
print <tmpl_var name=module_name> -> meta -> perl_class_definition
(
        braces => 'bsd',
);

print "\n# ===============================================\n\n";

</tmpl_loop>

</code>

o Created another program which feeds all table names into the template and
generates yet another program (YAP) which, when run, outputs a Perl module for
each table. This is the code which needs correction

o So I have iterative :-) but not recursive :-( source-code generation

o Now the plan is to fabricate and edit Rose::DB::Object::Metadata::Auto::Oracle
until it creates the correct output

--
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html




-------------------------------------------------------
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