When I established the database connection, it's giving me an object of type 
Sequel::ODBC::Database. I tried the monkey patch after calling Sequel.odbc, but 
still got an uninitialized constant error for Sequel::MSSQL. I tried replacing 
Sequel::MSSQL with Sequel::ODBC, but still got the same "Incorrect syntax near 
'1'" error. I'm not sure where else to put the monkey patch - it only takes two 
lines of code to get my error (one creates the database and one queries for the 
count of a table).

I have freetds 0.82 installed, and I installed it using Homebrew (no idea if 
that matters. I did find a web page indicating that MacPorts wouldn't install 
freetds correctly, but don't know of its veracity. I didn't see anything 
warning against using Homebrew though).

I attached the logger, and here's the sql it gave me in the error: SELECT 
COUNT(*) AS "COUNT" FROM "GLB_PEOPLE" LIMIT 1

The LIMIT 1 is definitely the problem - SQL Server doesn't support the LIMIT 
clause (at least in our install of it which is 2005 set for compatibility mode 
matching something even further back, I think). I tried with and without the 
:dbtype => 'mssql' argument when I call Sequel.odbc, but it didn't make a 
difference in this case that I could tell. 

Any more things I should try?

Andy

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Jeremy Evans
Sent: Tuesday, March 08, 2011 10:58 PM
To: sequel-talk
Subject: Re: Seg fault when accessing SQL Server

On Mar 8, 4:27 pm, Andy Tinkham <[email protected]> wrote:
>  I tried in irb to require 'sequel' and then type the workaround code that 
> you gave and it complained about Sequel::MSSQL being an unknown constant.

You have to do it after establishing your database connection, but before 
issuing a query.

> I also tried 'rake gem' in my tiny_tds repo that I cloned. It built the gem 
> but didn't install it (at least gem list didn't list it even after running 
> rake gem). 'gem install tiny_tds' in that directory errors out because 
> DBDATEREC is missing several expected members (dateyear, datemonth, etc.).

Do you have freetds installed?  If so, which version?

> I'll fork a new repo tomorrow and see if I can build - maybe I pulled it when 
> the build was broken or something.
>
> I have no idea how to add a SQL Logger, unfortunately, so can't make much 
> progress on that without some googling or finding other information.

Add a :logger=>Logger.new($stdout) option (make sure you require 'logger').

> I'll work on this more tomorrow or the next day.

Cool.  Please let me know how it turns out.

Thanks,
Jeremy

--
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to