Do you guys have a working port of DrySQL that works with sequel?
On 19 янв, 03:47, dan yoder <[EMAIL PROTECTED]> wrote:
> DrySQL looks like it would be a great start. I'm looking into using
> it! Thanks.
>
> On Jan 14, 2:46 pm, "Mark Van De Vyver" <[EMAIL PROTECTED]> wrote:
>
> > Hi Dan -
>
> > On Jan 15, 2008 7:31 AM, dan yoder <[EMAIL PROTECTED]> wrote:
>
> > > After a little more research, I am pretty sure there is no support for
> > > schema reflection as yet.
>
> > > Getting more detailed column_info is easy enough in principal. For
> > > MySQL:
>
> > > Application.database['show columns from entries'].map do |column|
> > > { :type => column[:Type].match(/^\w+/)[0].intern,
> > > :name => column[:Field].intern }
> > > end
>
> > > # => [{:type=>:int, :name=>:id},
> > > # {:type=>:text, :name=>:name},
> > > # {:type=>:text, :name=>:title},
> > > # {:type=>:text, :name=>:summary},
> > > # {:type=>:timestamp, :name=>:created_on},
> > > # {:type=>:timestamp, :name=>:updated_on},
> > > # {:type=>:text, :name=>:author},
> > > # {:type=>:text, :name=>:content}]
>
> > > This is probably non-standard SQL and would have to be incorporated
> > > into each driver. The types returned would also have to be normalized,
> > > of course (i.e., :int to :integer).
>
> > > No reflection data is presently kept in the model for associations. To
> > > really produce a complete :record_info (or whatever it would be
> > > called), we need to add in the association data. This could be
> > > captured easily just by modifying the one_to_one, one_to_many, etc.,
> > > methods and keeping the metadata around in a class instance variable.
> > > At least, I don't see any complication from doing that.
>
> > > I will work on this but would like to make sure no one else is already
> > > doing so, so we don't duplicate efforts. Any thought / suggestions?
>
> > You might like to look at the DrySQL gem/project.... this may save you
> > some time?
>
> > HTH?
> > Mark
>
> > > Regards,
> > > Dan
>
> > > On Jan 10, 4:07pm, dan yoder <[EMAIL PROTECTED]> wrote:
> > > > Kudos the folks working on this project. It is fantastic work.
>
> > > > It appears that you can get access to the columnar meta-data for a
> > > > model via the schema attribute of a database, but how can you reflect
> > > > on the associations of a model? Is there any plan (or interest) in
> > > > having this metadata be reflected directly from the model. I
> > > > implemented this once for ActiveRecord, but never released it because
> > > > I stopped working with AR. :)
>
> > > > You would use it like this:
>
> > > > Entries.record_info # => [ :title => :string, :author =>
> > > > [ :one_to_one, :author ] ... etc
>
> > > > If someone can point me to where I can reflect on associations, I can
> > > > pull this together. Or maybe I've just missed the right place in the
> > > > API?
>
> > > > Tip of the hat, again. Great work.
>
> > > > Regards,
> > > > Dan
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---