I would like to ask you this question suppose that I''ve 1 record which contains very long contents like Big_Row_Table ------------- Row1|Big_Row| ------------- Row1|very long contents I would like to query only some part of Big row (such as get first 4 characters )of this row by running query commands like this: GetsomePart = Big_Row_Table.find(somecommand) GetsomePart.Big_Row "very" <---this is the result I need any idea? -- 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 don''t wann disappoint, but i think you''ll have to query the whole entry "very long contents" and cut off the tail. GetsomePart.Big_Row[0..3] if anyone knows a better solution (one that offers more performance), let me know. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
MaD wrote:> i don''t wann disappoint, but i think you''ll have to query the whole > entry "very long contents" and cut off the tail. > > GetsomePart.Big_Row[0..3] > > if anyone knows a better solution (one that offers more performance), > let me know.Thx , Mad :D Any other solution? :) -- 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 3 Feb 2009, at 07:48, MaD wrote:> > i don''t wann disappoint, but i think you''ll have to query the whole > entry "very long contents" and cut off the tail. > > GetsomePart.Big_Row[0..3] > > if anyone knows a better solution (one that offers more performance), > let me know.Well I don''t know if it''s a good idea, probably database dependent etc. etc. but Foo.find some_id, :select => ''substring(bar,0, 5) as bar, id, ...'' Database almost certainly still needs to go and load that entire column so I doubt it will make a huge difference. Fred> > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You could have another column in the table, containing the short version. 2009/2/3 Ukrit Himakoon <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > MaD wrote: > > i don''t wann disappoint, but i think you''ll have to query the whole > > entry "very long contents" and cut off the tail. > > > > GetsomePart.Big_Row[0..3] > > > > if anyone knows a better solution (one that offers more performance), > > let me know. > > Thx , Mad :D > Any other solution? :) > -- > 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 3 Feb 2009, at 07:48, MaD wrote: > >> >> i don''t wann disappoint, but i think you''ll have to query the whole >> entry "very long contents" and cut off the tail. >> >> GetsomePart.Big_Row[0..3] >> >> if anyone knows a better solution (one that offers more performance), >> let me know. > > Well I don''t know if it''s a good idea, probably database dependent > etc. etc. but Foo.find some_id, :select => ''substring(bar,0, 5) as > bar, id, ...'' > Database almost certainly still needs to go and load that entire > column so I doubt it will make a huge difference. > > FredWould you please tell more details on this solution? Fred I''m not clearly understand this. -- 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 Feb 4, 7:37 am, Ukrit Himakoon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Would you please tell more details on this solution? Fred I''m not > clearly understand this.There''s not a whole lot to it - use a select clause to control what is fetched by the database. Fred> -- > 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 -~----------~----~----~----~------~----~------~--~---