[Ironruby-core] Ironruby on Rails with SQL Azure

Will Green will at hotgazpacho.org
Thu Sep 2 12:03:16 EDT 2010


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 <lists at 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 at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100902/3b803cdf/attachment-0001.html>


More information about the Ironruby-core mailing list