On Wednesday, April 2, 2014 4:57:00 PM UTC-7, Nathan Walker wrote:
>
> I'm not certain that it'll be possible to solve this problem - for the 
> most part I'm posting this so that if any other unlucky soul has to deal 
> with this particular database there'll be a direction to go for the 
> workaround.
>
> I'm trying to connect my favorite SQL gem to a MSSQL / PDW instance. 
> (Parallel Data Warehouse, it seems to be a MS-branded distributed SQL 
> Server version)
>
> The key point here is that PDW doesn't seem to support the SERVERPROPERTY 
> command, which makes Sequel very angry and me very sad. It throws an 
> exception from within lib/sequel/adapters/shared/mssql.rb:166 (as one would 
> expect), and I can't really do anything. I hacked my way around it by 
> monkey-patching the server_version method to always return 10000000 - it 
> appears to be a SQL Server 2008 version - and then everything else seems to 
> work.
>
> "SELECT @@VERSION" returns: 
> Microsoft SQL Server 2008 R2 (RTM) - 10.0.3595.0 (X64) Jul 27 2012 
> 20:35:00 Copyright (c) Microsoft Corporation Parallel Data Warehouse 
> (64-bit) on Windows NT 6.0 <X64> (Build 6002: Service Pack 2)
>
> In my research it doesn't look like all SQL Server instances support the 
> @@VERSION either - so couldn't just switch the query. I'd be happy to try 
> other commands against the server but it belongs to our IT group so I don't 
> have much info to share about the instance specifically. For all I know 
> they've somehow disabled SERVERPROPERTY on this specific instance.
>
> In any case: Sequel is awesome and works with PDW with a *little* bit of 
> tweaking.
>

Instead of hacking the adapter, you may be able to do:

Sequel::MSSQL::DatabaseMethods.send(remove_const, :SERVER_VERSION_SQL)
Sequel::MSSQL::DatabaseMethods::SERVER_VERSION_SQL = 'SELECT @@VERSION'

One simple way to support this would to add a :server_version Database 
option, and have it use that if given instead of doing a database query. 
 Alternatively, we could have it fallback to using @@VERSION if 
SERVERPROPERTY raises an error, but I like that approach less.  I'm open to 
other ideas if anyone has any.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to