[Nitro] [ANN] Nitro + Og 0.22.0

Robert Wagner robbie.wilhelm at gmail.com
Tue Aug 9 13:07:01 EDT 2005


i got something, that works for me:

entity.rb:

   def set_sequence(seq)
      meta :sequence, seq
    end


store/psql:

  def enchant(klass, manager)
    if klass.metadata.sequence
      klass.const_set 'OGSEQ', klass.metadata.sequence.to_s
    else
        if sclass = klass.metadata.superclass
          klass.const_set 'OGSEQ', "#{table(sclass.first)}_oid_seq"
        else
            klass.const_set 'OGSEQ', "#{table(klass)}_oid_seq"
        end
    end

    if klass.metadata.primary_key.flatten.first == :oid
      unless klass.properties.find { |p| p.symbol == :oid }
        klass.property :oid, Fixnum, :sql => 'serial PRIMARY KEY'
      end
    end
    super
  end

-robert

2005/8/9, Robert Wagner <robbie.wilhelm at gmail.com>:
> 2005/8/9, George Moschovitis <george.moschovitis at gmail.com>:
> > Not yet, but thanks for pointing this out, will add it (or you can
> > send a patch ;-))
> thanx - i'll try to find the spot for a patch :) happy holidays.
> --robert
> 
> > Btw, I am on vacations at the moment... so expect some slower response time :)
> >
> > -g.
> >
> > On 8/8/05, Robert Wagner <robbie.wilhelm at gmail.com> wrote:
> > > is it possible to change the sequenz-name (pgsql)?
> > > from like: efa_notes_oid_seq
> > > to efa_notes_id_seq
> > > ?
> > > thanks,
> > >    --robert
> > >
> > > 2005/8/8, Robert Wagner <robbie.wilhelm at gmail.com>:
> > > > argh. found the error. somewhere i had an invalid property type 'Date'
> > > > instead of Time.
> > > > the db.load() error persists.
> > > > --robert
> > > >
> > > >
> > > > 2005/8/8, Robert Wagner <robbie.wilhelm at gmail.com>:
> > > > > hi,
> > > > > i'm trying to og my legacy tables with the new reverse feature:
> > > > >
> > > > > class Person
> > > > >         property :id, Fixnum
> > > > >         property :title, String
> > > > >         property :fname, String
> > > > >         property :lname, String
> > > > > ...
> > > > >         set_table :efa_persons
> > > > >         set_primary_key :id
> > > > >         has_many Note
> > > > >         belongs_to Company, :field=>:company_id
> > > > > end
> > > > >
> > > > > p=Person[1]  # thats me
> > > > >
> > > > > # sql ist right but it
> > > > > # gives me an error:
> > > > >
> > > > > DEBUG: SELECT * FROM efa_persons WHERE id=1
> > > > > /usr/lib/ruby/1.8/yaml.rb:119:in `load': parse error on line 0, col
> > > > > 19: `t/string/unix_ ' (ArgumentError)
> > > > >         from /usr/lib/ruby/1.8/yaml.rb:119:in `load'
> > > > >         from (eval):4:in `og_read'
> > > > >         from /usr/lib/ruby/gems/1.8/gems/og-0.22.0/lib/og/store/sql.rb:881:in
> > > > > `read_one'
> > > > >         from /usr/lib/ruby/gems/1.8/gems/og-0.22.0/lib/og/store/sql.rb:308:in
> > > > > `load'
> > > > >         from /usr/lib/ruby/gems/1.8/gems/og-0.22.0/lib/og/entity.rb:80:in `[]'
> > > > >         from ogtest.rb:31
> > > > >
> > > > > alternative:
> > > > >
> > > > > t=db.load(1, Person)
> > > > >
> > > > > gives
> > > > >
> > > > > ogtest.rb:30: private method `load' called for
> > > > > #<Og::Manager:0xb7ccdc10> (NoMethodError)
> > > > >
> > > > > anybody knows whats wrong?
> > > > >
> > > > > thanks,
> > > > >    robert
> > > > >
> > > > > 2005/8/7, George Moschovitis <george.moschovitis at gmail.com>:
> > > > > > Hello everyone,
> > > > > >
> > > > > > * The much requested Og 'reverse mode' is implemented. Og's
> > > > > > domain specific language and API is extended to allow fine-grained
> > > > > > customization of the schema-to-objects mapping. Og can now handle
> > > > > > most of the legacy schemas you can throw at it. Here is an
> > > > > > example:
> > > > > >
> > > > >
> > > >
> > >
> > > _______________________________________________
> > > Nitro-general mailing list
> > > Nitro-general at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/nitro-general
> > >
> >
> >
> > --
> > http://www.gmosx.com
> > http://www.nitrohq.com
> > http://www.joy.gr
> >
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
> >
>




More information about the Nitro-general mailing list