Problem compiling extension on Solaris

Steven Ketcham wrote:

BTW, after I became rubyized, I found myself not needing
solutions that were based in C/C++, and for this particular
case, changed my design to use symbols.

Could you elaborate on this a little more?

If you’re just using an enumerated type to differentiate between
different mutually exclusive options and don’t care what their numeric
values are – as appears to be the case in your example – Ruby symbols
(a.k.a. “interned” strings or atoms) are a nice alternative:

 class TransferSummary
   def doSummary
     # site list
     doSql (getSiteListSQL(), :SiteList)

     # transfer error count
     doSql (getTransferErrorCountSQL(), :TransferErrorCount)

     # baud rate average
     doSql (getTransferBaudRateAverageSQL(), :BaudRateAverage)

     # transfer count
     doSql (getTransferCountSQL(), :TransferCount)
   end

   def doSql(sqlStmt, whichFunction)
     database = DatabaseFunctions.new
     database.doSql( sqlStmt ) do |dataset|
       row.each_with_name do |siteKey, value|
         case whichFunction
           when :SiteList
             transferSummaryCountHolder =
               TransCountHolder.new(siteKey, value)
             @countsContainer[:SiteKey] = transferSummaryCountHolder

           when :TransferErrorCount
             @countsContainer[siteKey].errors = value

           when :BaudRateAverage
             @countsContainer[siteKey].baudAverage = value

           when :TransferCount
             @countsContainer[siteKey].tranfersCounted = value
         end
       end
     end
     database.finish
   end
 end

Hope this helps,

Lyle

···

5/31/2003 2:26:03 PM, Jim Freeze jim@freeze.org wrote:

I think Lyle answered this for me.

···

On Sunday, 1 June 2003 at 5:12:27 +0900, Steven Ketcham wrote:

5/31/2003 2:26:03 PM, Jim Freeze jim@freeze.org wrote:

BTW, after I became rubyized, I found myself not needing
solutions that were based in C/C++, and for this particular
case, changed my design to use symbols.

Could you elaborate on this a little more?


Jim Freeze

You couldn’t even prove the White House staff sane beyond a reasonable
doubt.
– Ed Meese, on the Hinckley verdict