what is Driver & what is Adapter ? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6 Oct 2008, at 11:52, Pokkai Dokkai wrote:> > what is Driver & what is Adapter ?Assuming you are talking about database drivers and rails'' connection adapters: A driver is something that allows you to talk to the database. Drivers don''t however all have the same semantics. Similar things may have different names, the underlying database may be different in the way certain tasks are accomplished or how certain SQL statements are written. The connection adapters that are part of Rails smooth over these differences. Fred> > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 6 Oct 2008, at 11:52, Pokkai Dokkai wrote: > >> >> what is Driver & what is Adapter ? > > Assuming you are talking about database drivers and rails'' connection > adapters:thats correct> A driver is something that allows you to talk to the database. Drivers > don''t however all have the same semantics. Similar things may have > different names, the underlying database may be different in the way > certain tasks are accomplished or how certain SQL statements are > written.so from ruby to every database , ruby needed a separate Driver .> The connection adapters that are part of Rails smooth over > these differences.what does mean ? what is the main job to this Adapter is it used to convert database return result(which is in string Object) to Model Object ? thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think that every adapter includes a driver. So a MySQL adapter for Rails includes driver information or utilizes a pre-existing driver for Ruby. The adapter then uses the raw data brought back from the database through an SQL statement that''s been generated and makes an ActiveRecord object specific to the query and populates that object with the raw data. Frederick, am I right in this? On Oct 6, 11:02 am, Pokkai Dokkai <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Frederick Cheung wrote: > > On 6 Oct 2008, at 11:52, Pokkai Dokkai wrote: > > >> what is Driver & what is Adapter ? > > > Assuming you are talking about database drivers and rails'' connection > > adapters: > > thats correct > > > A driver is something that allows you to talk to the database. Drivers > > don''t however all have the same semantics. Similar things may have > > different names, the underlying database may be different in the way > > certain tasks are accomplished or how certain SQL statements are > > written. > > so from ruby to every database , ruby needed a separate Driver . > > > The connection adapters that are part of Rails smooth over > > these differences. > > what does mean ? > what is the main job to this Adapter > is it used to convert database return result(which is in string Object) > to Model Object ? > > thanks > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6 Oct 2008, at 16:19, Srdjan Pejic wrote:> > I think that every adapter includes a driver. So a MySQL adapter for > Rails includes driver information or utilizes a pre-existing driver > for Ruby.The Rails team do not develop any of the database drivers.> The adapter then uses the raw data brought back from the > database through an SQL statement that''s been generated and makes an > ActiveRecord object specific to the query and populates that object > with the raw data. > > Frederick, am I right in this? >Not quite. The adapters happen at a lower level. For example, I have a select query and I want to make it have this limit and that offset. That''s database dependant and is handled by the adapter. Quoting rules, mapping of ruby types onto database column types are also database dependant and are handled by the adaptor. The adapter also handles stuff like "given this select query, give me an array of hashes representing the result set", or "do this insert and tell me what was the primary key that was generated" and things like that (building of the ActiveRecord objects in not part of the adapter code). If you really want a detailed answer, just crack open something like mysql_adapter.rb and see what''s in there. Fred> On Oct 6, 11:02 am, Pokkai Dokkai <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> Frederick Cheung wrote: >>> On 6 Oct 2008, at 11:52, Pokkai Dokkai wrote: >> >>>> what is Driver & what is Adapter ? >> >>> Assuming you are talking about database drivers and rails'' >>> connection >>> adapters: >> >> thats correct >> >>> A driver is something that allows you to talk to the database. >>> Drivers >>> don''t however all have the same semantics. Similar things may have >>> different names, the underlying database may be different in the way >>> certain tasks are accomplished or how certain SQL statements are >>> written. >> >> so from ruby to every database , ruby needed a separate Driver . >> >>> The connection adapters that are part of Rails smooth over >>> these differences. >> >> what does mean ? >> what is the main job to this Adapter >> is it used to convert database return result(which is in string >> Object) >> to Model Object ? >> >> thanks >> >> -- >> Posted viahttp://www.ruby-forum.com/. > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---