From dcoleman at chariotsolutions.com Thu Apr 24 13:07:10 2008 From: dcoleman at chariotsolutions.com (Don Coleman) Date: Thu, 24 Apr 2008 13:07:10 -0400 Subject: [ruby-dbi-users] ntext fields with empty string crashing Ruby on OS X Message-ID: <32870f240804241007y7fe7729at881560c35593a78f@mail.gmail.com> Ruby is crashing with a Segmentation fault when selecting a ntext column that contains an empty string. I'm not sure if this is a dbi bug. This happens with SQLServer 2005 on Win2K3 and SQLServer 2005 Express on Win XP. I can consistently reproduce this on different machines running OS X 10.5.2 with the Actual Technologies SQL Server driver and DBI 0.2.0. I can use the Actual SQL Server driver and query the same table in Excel without a problem. I can not reproduce this on Linux with iODBC and FreeTDS. It works fine on Windows with ADO. create table ntext_test ( id int primary key, val ntext); insert into ntext_test values (1, 'Some Data'); insert into ntext_test values (2, null); insert into ntext_test values (3, ''); #!/usr/bin/env ruby require "dbi" begin url = "DBI:ODBC:test" username = "user" password = "secret" dbh = DBI.connect(url, username, password) rows = dbh.select_all("select * from ntext_test where id < 3") puts rows rows = dbh.select_all("select * from ntext_test where id = 3") # Ruby crashes here # /Library/Ruby/Site/1.8/DBD/ODBC/ODBC.rb:237: [BUG] Segmentation fault # ruby 1.8.6 (2007-09-24) [universal-darwin9.0] ensure dbh.disconnect if dbh end From erik at hollensbe.org Thu Apr 24 23:02:34 2008 From: erik at hollensbe.org (Erik Hollensbe) Date: Thu, 24 Apr 2008 20:02:34 -0700 Subject: [ruby-dbi-users] ntext fields with empty string crashing Ruby on OS X In-Reply-To: <32870f240804241007y7fe7729at881560c35593a78f@mail.gmail.com> References: <32870f240804241007y7fe7729at881560c35593a78f@mail.gmail.com> Message-ID: On Apr 24, 2008, at 10:07 AM, Don Coleman wrote: > Ruby is crashing with a Segmentation fault when selecting a ntext > column that contains an empty string. I'm not sure if this is a dbi > bug. Hi Don, My suspicion is that the problem is in the underlying 'odbc' driver that DBI::DBD::ODBC uses, or in ruby itself. This is further evidenced by the fact that the system works fine on other platforms, and that DBI and the DBD in question leverage no C bindings by themselves. I also want to remind you that DBD::ODBC will no longer be supported by me as of 0.4.0, which is our next feature release. I lack the resources to test against this and many other (mostly windows) database systems, and will expect the community to maintain these drivers should support wish to continue. Thanks for your time, -Erik