Skip to content
SQL Server Adapter for Rails (JRuby JDBC support)
Ruby Other
  1. Ruby 98.2%
  2. Other 1.8%
Branch: 5-0-stable-jdbc
Clone or download
Pull request Compare This branch is 26 commits ahead, 174 commits behind rails-sqlserver:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
Dockerfile Travis fix take 2 Oct 17, 2019
Gemfile Some documentation/gemspec updates to prepare for a release Oct 17, 2019
Guardfile
MIT-LICENSE
RAILS5-TODO.md
README.md
RUNNING_UNIT_TESTS.md
Rakefile
VERSION
activerecord-jdbcsqlserver-adapter.gemspec Some documentation/gemspec updates to prepare for a release Oct 17, 2019
appveyor.yml Use TinyTDS v1.3.0 & vNext SQL Server Docker v1.4 Mar 18, 2017
docker-compose.ci.yml

README.md

ActiveRecord SQL Server Adapter. For SQL Server 2012 And Higher.

Gem Version - Gem Version

The JDBC SQL Server adapter for ActiveRecord v5.0 using SQL Server 2012 or higher.

We currently support JRuby 9.2+. Older versions may work but they are not tested and there is a known date issue with JRuby 9.1.

For older versions see activerecord-jdbcmssql-adapter

Native Data Type Support

The Rails v5 adapter supports ActiveRecord's datetime_with_precision setting. This means that passing :precision to a datetime column is supported. Using a pecision with the :datetime type will signal the adapter to use the datetime2 type under the hood.

Schemas & Users

Depending on your user and schema setup, it may be needed to use a table name prefix of dbo.. So something like this in your initializer file for ActiveRecord or the adapter.

ActiveRecord::Base.table_name_prefix = 'dbo.'

Explain Support (SHOWPLAN)

ActiveRecord's explain features are supported. In SQL Server, this is called the showplan. By default we use the SHOWPLAN_ALL option and format it using a simple table printer. So the following ruby would log the plan table below it.

Car.where(id: 1).explain
EXPLAIN for: SELECT [cars].* FROM [cars] WHERE [cars].[id] = 1
+----------------------------------------------------+--------+--------+--------+----------------------+----------------------+----------------------------------------------------+----------------------------------------------------+--------------+---------------------+----------------------+------------+---------------------+----------------------------------------------------+----------+----------+----------+--------------------+
| StmtText                                           | StmtId | NodeId | Parent | PhysicalOp           | LogicalOp            | Argument                                           | DefinedValues                                      | EstimateRows | EstimateIO          | EstimateCPU          | AvgRowSize | TotalSubtreeCost    | OutputList                                         | Warnings | Type     | Parallel | EstimateExecutions |
+----------------------------------------------------+--------+--------+--------+----------------------+----------------------+----------------------------------------------------+----------------------------------------------------+--------------+---------------------+----------------------+------------+---------------------+----------------------------------------------------+----------+----------+----------+--------------------+
| SELECT [cars].* FROM [cars] WHERE [cars].[id] = 1  |      1 |      1 |      0 | NULL                 | NULL                 | 2                                                  | NULL                                               |          1.0 | NULL                | NULL                 | NULL       | 0.00328309996984899 | NULL                                               | NULL     | SELECT   | false    | NULL               |
|   |--Clustered Index Seek(OBJECT:([activerecord... |      1 |      2 |      1 | Clustered Index Seek | Clustered Index Seek | OBJECT:([activerecord_unittest].[dbo].[cars].[P... | [activerecord_unittest].[dbo].[cars].[id], [act... |          1.0 | 0.00312500004656613 | 0.000158099996042438 |        278 | 0.00328309996984899 | [activerecord_unittest].[dbo].[cars].[id], [act... | NULL     | PLAN_ROW | false    |                1.0 |
+----------------------------------------------------+--------+--------+--------+----------------------+----------------------+----------------------------------------------------+----------------------------------------------------+--------------+---------------------+----------------------+------------+---------------------+----------------------------------------------------+----------+----------+----------+--------------------+

Installation

gem 'activerecord-jdbcsqlserver-adapter'

Contributing

If you would like to contribute a feature or bugfix, thanks! To make sure your fix/feature has a high chance of being added, please read the following guidelines. First, ask on the Gitter, or post a ticket on github issues. Second, make sure there are tests! We will not accept any patch that is not tested. Please read the RUNNING_UNIT_TESTS file for the details of how to run the unit tests.

This is a fork of the activerecord-sqlserver-adapter. If you find a bug in the base code, please submit patches to: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter

If the bug/feature is JRuby or specific to this gem, please submit patches to: http://github.com/jruby/activerecord-jdbcsqlserver-adapter

Credits & Contributions

Many many people have contributed. If you do not see your name here and it should be let us know. Also, many thanks go out to those that have pledged financial contributions.

Contributers

Up-to-date list of contributors: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/contributors

Original Gem:

  • metaskills (Ken Collins)
  • Annaswims (Annaswims)
  • wbond (Will Bond)
  • Thirdshift (Garrett Hart)
  • h-lame (Murray Steele)
  • vegantech
  • cjheath (Clifford Heath)
  • fryguy (Jason Frey)
  • jrafanie (Joe Rafaniello)
  • nerdrew (Andrew Ryan)
  • snowblink (Jonathan Lim)
  • koppen (Jakob Skjerning)
  • ebryn (Erik Bryn)
  • adzap (Adam Meehan)
  • neomindryan (Ryan Findley)
  • jeremydurham (Jeremy Durham)

JDBC version of the gem:

  • rdubya (Rob Widmer)

License

Copyright © 2008-2019. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

You can’t perform that action at this time.