Ok, noticed one more thing.  The mssql table hints such as WITH
(NOLOCK) should go after the table.

So, it should be:
"SELECT TOP 1 * FROM master..sysprocesses WITH (NOLOCK) WHERE blocked !
= 0"

Instead of:
"SELECT TOP 1 * WITH (NOLOCK) FROM master..sysprocesses WHERE blocked !
= 0"

I just re-ordered the FROM part in the select_sql method.  Here is a
patch that gets odbc and the new odbc-mssql adapter working for me.

----------------------------

Index: lib/sequel/adapters/odbc-mssql.rb
===================================================================
--- lib/sequel/adapters/odbc-mssql.rb   (revision 564)
+++ lib/sequel/adapters/odbc-mssql.rb   (working copy)
@@ -48,15 +48,15 @@
             sql = "SELECT #{top} #{select_columns}"
           end

+          if opts[:from]
+            sql << " FROM #{source_list(opts[:from])}"
+          end
+
           # ADD WITH to SELECT string for NOLOCK
           if with = opts[:with]
             sql << " WITH #{with}"
           end

-          if opts[:from]
-            sql << " FROM #{source_list(opts[:from])}"
-          end
-
           if join = opts[:join]
             sql << join
           end
Index: lib/sequel/adapters/odbc.rb
===================================================================
--- lib/sequel/adapters/odbc.rb (revision 564)
+++ lib/sequel/adapters/odbc.rb (working copy)
@@ -2,7 +2,7 @@
   require File.join(File.dirname(__FILE__), '../../sequel')
 end

-# require 'odbc'
+require 'odbc'

 module Sequel
   module ODBC
@@ -50,7 +50,7 @@

       def fetch_rows(sql, &block)
         @db.synchronize do
-          s = @db.execute select_sql(sql)
+          s = @db.execute sql
           begin
             @columns = s.columns(true).map {|c| c.name.to_sym}
             rows = s.fetch_all


--~--~---------~--~----~------------~-------~--~----~
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