From: Steve Tuckner Date: 2001-06-27T22:55:52+09:00 Subject: [ruby-talk:16968] RE: Another question This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0FF0F.FA2BA310 Content-Type: text/plain; charset="iso-8859-1" You should check out the Ruby DBI effort (which covers more than just ODBC) and use the drivers there. I have been using the ODBC DBD developed by Christian Werner. See http://www.ruby-projects.org/dbi/ for more info on the DBI/DBD interface. -----Original Message----- From: Will Sobel [mailto:will.sobel@Barra.COM] Sent: Tuesday, June 26, 2001 8:05 PM To: ruby-talk@ruby-lang.org Subject: [ruby-talk:16941] Another question Thanks a lot for getting back to me so fast on my last question. I have been trying to get John W. Small's version of DBI (version 0.1) to work. I have found another problem in both 1.6.3 and 1.7.1 that is present in the dbi.rb module. When you run the attached code as follows you get an exception with -d and without -d it silently ignores the define_finalizer call: % ruby t.rb finalizing2 % ruby -d t.rb Exception `NotImplementedError' at bug.rb:3 - method call on terminated object finalizing2 % The question--can you define a finalizer on self in the initialize method as they do in DBI or is this illegal? Thanks in advance, Will ---BEGIN-CODE--- class Test def initialize ObjectSpace.define_finalizer(self, Proc.new{ puts "finalizing" }) end end t = Test.new ObjectSpace.define_finalizer(t, Proc.new{ puts "finalizing2" }) t = nil GC.start ---END-CODE--- ------_=_NextPart_001_01C0FF0F.FA2BA310 Content-Type: text/html; charset="iso-8859-1" Another question
You should check out the Ruby DBI effort (which covers more than just ODBC) and use the drivers there. I have been using the ODBC DBD developed by Christian Werner. See http://www.ruby-projects.org/dbi/ for more info on the DBI/DBD interface.
-----Original Message-----
From: Will Sobel [mailto:will.sobel@Barra.COM]
Sent: Tuesday, June 26, 2001 8:05 PM
To: ruby-talk@ruby-lang.org
Subject: [ruby-talk:16941] Another question


Thanks a lot for getting back to me so fast on my last question. I have been trying to get John W. Small's version of DBI (version 0.1) to work. I have found another problem in both 1.6.3 and 1.7.1 that is present in the dbi.rb module. When you run the attached code as follows you get an exception with -d and without -d it silently ignores the define_finalizer call:

% ruby t.rb
finalizing2
% ruby -d t.rb
Exception `NotImplementedError' at bug.rb:3 - method call on terminated object
finalizing2
%

The question--can you define a finalizer on self in the initialize method as they do in DBI or is this illegal?

Thanks in advance,
Will


---BEGIN-CODE---
class Test
        def initialize
                ObjectSpace.define_finalizer(self, Proc.new{ puts "finalizing" })
        end
end

t = Test.new
ObjectSpace.define_finalizer(t, Proc.new{ puts "finalizing2" })
t  = nil

GC.start
---END-CODE---

------_=_NextPart_001_01C0FF0F.FA2BA310--