From: Robert Klemme Date: 2006-09-24T19:40:19+09:00 Subject: Re: getting first value of a mysql return ... dc wrote: > hi list - > > cant find any decent mysql/ruby usage examples, any suggestions? even > the dave thomas book has very little... > > i have a sql statement which sometimes returns a single value, and > sometimes it cant find a matching result. > > how do i trap this nothing value? it doesnt seem to be a "nil" : the > return type is always: > MySql::Result That's the usual way DB interfaces handle this. You always get a result - but it may be empty. You can either iterate all result rows and notice that you do not have any result that way. Or you can maybe try #empty? on the result. Kind regards robert