From: Paul D. <pa...@sn...> - 2003-01-20 16:50:01
|
At 13:03 +0100 1/20/03, Michael Neumann wrote: >Paul DuBois wrote: >> I am assuming that DBI.trace can be used to set the global trace >> level for a script, but it appears not to be doing what I expect. >> >> For example, in the DBI distribution, examples/trace_test.rb begins like >> this: >> >> require "dbi" >> require "dbi/trace" >> >> DBI.trace(0) >> >> dbh = DBI.connect('dbi:Mysql:database=test') >> >> >> However, when I run the script, I get trace output from the connect >> call, even though the global level is set to 0. (The DBI docs don't >> specify so, but I assume 0 = "off".) Output is: > >0 = No Tracing at all. > > >> % ruby trace_test.rb >> -> connect for #<DBI::DriverHandle:0x184148> ("database=test", nil, nil, >> nil) >> !! Access denied for user: 'paul@localhost' (Using password: NO) >> <- connect for #<DBI::DriverHandle:0x184148> >> /usr/lib/ruby/site_ruby/1.6/DBD/Mysql/Mysql.rb:66:in `connect': >> Access denied for user: 'paul@localhost' (Using password: NO) >> (DBI::DatabaseError) >> from /usr/lib/ruby/site_ruby/1.6/dbi/dbi.rb:550:in `connect' >> from (eval):8:in `connect' >> from /usr/lib/ruby/site_ruby/1.6/dbi/dbi.rb:367:in `connect' >> from trace_test.rb:6 >> > >I get the following: > >/usr/local/lib/ruby/site_ruby/1.6/DBD/Mysql/Mysql.rb:66:in >`connect': Can't connect to local MySQL server through socket >'/tmp/mysql.sock' (2) (DBI::DatabaseError) > from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:550:in `connect' > from (eval):8:in `connect' > from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:367:in `connect' > from trace_test.rb:6 > > >Which version of AspectR are you using? Try the newest (0.3.5). > > >Regards, > > Michael Hm. I am using AspectR 0.3.5. My versions are: Ruby MySQL module 2.4.3c Ruby DBI 0.0.18 AspectR 0.3.5 I modified the script to be a little simpler (and to connect successfully). require "dbi" require "dbi/trace" DBI.trace(0) dbh = DBI.connect('dbi:Mysql:database=test', 'paul','somepass') dbh.disconnect I'd expect no output at all from the script , but this is what I get: % ruby trace_test.rb -> connect for #<DBI::DriverHandle:0x1842b0> ("database=test", "paul", "somepass", nil) <- connect for #<DBI::DriverHandle:0x1842b0> = #<DBI::DatabaseHandle:0x173dfc> -> disconnect for #<DBI::DatabaseHandle:0x173dfc> () <- disconnect for #<DBI::DatabaseHandle:0x173dfc> = nil If I modify it so that the trace level is 1, 2, or 3, the trace output is identical. Seems odd. I get the same results on Mac OS X and on RedHat 7.0 (other than that the object addresses are different, of course). Anything I can do to figure out what's going on here? Setting the trace level on database or statement handles seems to work correctly, it's just that setting the global level doesn't have any effect. Thanks. |