On 12/6/06 12:25 AM, Clayton Scott wrote:
> Hmm, guess I spoke a little too quickly. When position looks like this:
> 
> CREATE TABLE position (
>         id serial PRIMARY KEY,
>         name text NOT NULL,
>         stratum_id INTEGER NOT NULL
> );
> 
> ALTER TABLE position ADD CONSTRAINT fk_position_stratum
> FOREIGN KEY (stratum_id) REFERENCES stratum (id) ON DELETE NO ACTION;
> 
> and stratum looks like this:
> CREATE TABLE stratum (id serial PRIMARY KEY, name text);
> 
> I am using a Loader script to generate static modules from the database and
> Position.pm doesn't have a stratum foreign key defined.

Whoops, need to handle the quoted stuff earlier.  Diff follows.  Those
reserved words are sneaky...

-John

---

Index: lib/Rose/DB/Object/Metadata/Auto.pm
===================================================================
--- lib/Rose/DB/Object/Metadata/Auto.pm (revision 1139)
+++ lib/Rose/DB/Object/Metadata/Auto.pm (working copy)
@@ -360,6 +360,8 @@
 
     FK: while(my $fk_info = $sth->fetchrow_hashref)
     {
+      $db->refine_dbi_foreign_key_info($fk_info, $self);
+
       CHECK_TABLE: # Make sure this column is from the right table
       {
         no warnings; # Allow undef coercion to empty string
@@ -383,8 +385,6 @@
 
     FK_INFO: foreach my $fk_info (@fk_info)
     {
-      $db->refine_dbi_foreign_key_info($fk_info, $self);
-
       my $foreign_class =
         $self->class_for(catalog => $fk_info->{'UK_TABLE_CAT'},
                          schema  => $fk_info->{'UK_TABLE_SCHEM'},



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to