Should probably change the RegExp to match after the dash (10.x.x.x), and
use that as the version, rather than, e.g., 2008, 2005, 2000, etc.

--
Will Green
http://hotgazpacho.org/


On Thu, Sep 2, 2010 at 7:54 AM, Ameer Deen <li...@ruby-forum.com> wrote:

> Got it. There's a small issue with sqlserver_adapter.rb and the way
> Micrsoft Azure advertises it's version.
>
> There is a database_year function that tries to determine the version of
> SQL Server from the output of the following query:
>
> "SELECT @@version"
>
> For Non Azure SQL Server databases, the output is similar to the
> following:
>
> "Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86)   ..<blah
> blah>"
>
> the database_year funtion grabs the SQL Server version from the 4 digits
> following the word "Microsoft SQL Server":
>
>
>      DATABASE_VERSION_REGEXP     = /Microsoft SQL Server\s+(\d{4})/
>
>      def database_year
>        DATABASE_VERSION_REGEXP.match(database_version)[1].to_i
>      end
>
> In Azure, however, the query returns a different string:
>
> "Microsoft SQL Azure (RTM) - 10.25.9386.0   ..<blah blah>"
>
> That database_year function, as a result returns a nil string and
> breaks. As a test, I just changed the function to:
>
>      def database_year
>        2008
>      end
>
> and I was able to connect my rails application to SQL Azure. There just
> needs to be a smarter way to ascertain the SQL Server version. Possible
> match up the 10.XX version number with the SQL Server 2005/2008 etc
> versions.
>
>
> Thanks very much for the help.
>
> Ameer
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core@rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to