activerecord-sqlserver-adapter | SQL Server Adapter For Rails | Database library

 by   rails-sqlserver Ruby Version: v6.0.3 License: MIT

kandi X-RAY | activerecord-sqlserver-adapter Summary

kandi X-RAY | activerecord-sqlserver-adapter Summary

activerecord-sqlserver-adapter is a Ruby library typically used in Database, Ruby On Rails applications. activerecord-sqlserver-adapter has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

The SQL Server adapter for ActiveRecord using SQL Server 2012 or higher. Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 7.x version of the adapter is only for the latest 7.x version of Rails. If you need the adapter for SQL Server 2008 or 2005, you are still in the right spot. Just install the latest 3.2.x to 4.1.x version of the adapter that matches your Rails version. We also have stable branches for each major/minor release of ActiveRecord. For older versions, please check their stable branches. We support every data type supported by FreeTDS. All simplified Rails types in migrations will coorespond to a matching SQL Server national (unicode) data type. Always check the initialize_native_database_types (here) for an updated list. The following types (date, datetime2, datetimeoffset, time) all require TDS version 7.3 with TinyTDS. We recommend using FreeTDS 1.0 or higher which default to using TDSVER to 7.3. The adapter also sets TinyTDS's tds_version to this as well if non is specified. The Rails v5 adapter supports ActiveRecord's datetime_with_precision setting. This means that passing :precision to a datetime column is supported. Using a precision with the :datetime type will signal the adapter to use the datetime2 type under the hood. The adapter uses OUTPUT INSERTED so that we can select any data type key, for example UUID tables. However, this poses a problem with tables that use triggers. The solution requires that we use a more complex insert statement which uses a temporary table to select the inserted identity. To use this format you must declare your table exempt from the simple output inserted style with the table name into a concurrent hash. Optionally, you can set the data type of the table's primary key to return. Although it is not necessary, the Ruby convention is to use lowercase method names. If your database schema is in upper or mixed case, we can force all table and column names during the schema reflection process to be lowercase. Add this to your config/initializers file for the adapter. 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.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              activerecord-sqlserver-adapter has a medium active ecosystem.
              It has 954 star(s) with 564 fork(s). There are 57 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 32 open issues and 542 have been closed. On average issues are closed in 195 days. There are 7 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of activerecord-sqlserver-adapter is v6.0.3

            kandi-Quality Quality

              activerecord-sqlserver-adapter has 0 bugs and 91 code smells.

            kandi-Security Security

              activerecord-sqlserver-adapter has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              activerecord-sqlserver-adapter code analysis shows 0 unresolved vulnerabilities.
              There are 3 security hotspots that need review.

            kandi-License License

              activerecord-sqlserver-adapter is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              activerecord-sqlserver-adapter releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed activerecord-sqlserver-adapter and discovered the below as its top functions. This is intended to give you an instant insight into activerecord-sqlserver-adapter implemented functionality, and help decide if they suit your requirements.
            • Sets a SQL server connection .
            Get all kandi verified functions for this library.

            activerecord-sqlserver-adapter Key Features

            No Key Features are available at this moment for activerecord-sqlserver-adapter.

            activerecord-sqlserver-adapter Examples and Code Snippets

            No Code Snippets are available at this moment for activerecord-sqlserver-adapter.

            Community Discussions

            QUESTION

            Update a legacy "ID" column that isn't the primary key with ActiveRecord
            Asked 2018-Sep-18 at 01:46

            I'm using Rails and the activerecord-sqlserver-adapter gem to try and add data to a legacy MS SQL database whose dbo.Condition table has a primary key called ConditionSeq and a foreign key column ID that stores the user ID.

            ...

            ANSWER

            Answered 2018-Sep-18 at 01:46

            I worked through this with some more experienced Ruby devs when I was back at work and we came to the conclusion that this is an unhandled edge case in ActiveRecord (see below for more info).

            My eventual workaround (with comments) is to override the existing method(s) in a concern and only include that concern when we need it:

            Source https://stackoverflow.com/questions/52341754

            QUESTION

            Converting SQL Server Date Format from Rails Query
            Asked 2018-Apr-24 at 21:02

            Trying to complete the following query:

            ...

            ANSWER

            Answered 2018-Apr-24 at 21:02

            Why not make the change to what you are querying against instead?

            Source https://stackoverflow.com/questions/50008158

            QUESTION

            Unable to connect sql server using ruby on rails
            Asked 2018-Apr-17 at 09:38

            I am new to ruby on rails and trying to establish a connection to sql server. I have gone through various articles but still not able to connect to sql server.

            ...

            ANSWER

            Answered 2018-Apr-17 at 09:38

            You installed version 2.3.8 of the activerecord-sqlserver-adapter gem that is almost 8 years old and tried to run it with the latest version of Ruby on Rails. Obviously, both versions are not compatible.

            Furthermore, looking at the gem's Rubygem page - there is no version supporting Ruby on Rails 5.2 yet.

            My advice is to downgrade your application to 5.1 and postpone updating to Rails 5.2 until all gems your application is depending on are supporting 5.2

            You might want to subscript to these issues on GitHub for further updates:

            Source https://stackoverflow.com/questions/49820495

            QUESTION

            Character columns are silently truncated
            Asked 2017-Jul-20 at 13:49

            When using ActiveRecord to store a string into a SqlServer nvchar column, and the length of the string is larger than the maximum length of the column, the string is silently truncated to the column's size. How can I make a warning or error be issued instead of silently truncating the value?

            Code that reproduces the issue

            Database model:

            ...

            ANSWER

            Answered 2017-Jul-20 at 13:49

            In order to cause SqlServer to respond to a text overflow with an error, two things are required:

            • SqlServer's ANSI_WARNINGS connection setting must be ON
            • You must prevent the adapter from truncating the column.
            Setting ANSI_WARNINGS

            Among the effects of the ANSI_WARNINGS setting is to abort an INSERT or UPDATE if a character column is overflowed. There is a setting that controls that effect:

            If an INSERT or UPDATE is tried on a character, Unicode, or binary column in which the length of a new value exceeds the maximum size of the column. If SET ANSI_WARNINGS is ON, the INSERT or UPDATE is canceled as specified by the ISO standard.

            This setting is probably already on, but you can force it on with this monkey-patch:

            Source https://stackoverflow.com/questions/44855859

            QUESTION

            in rails 5 can I connect Microsoft sql server 2008?
            Asked 2017-Jul-20 at 10:40

            Can I connect Microsoft SQLserver2008 in Rails 5? after installing the following gems:

            while running rails s, I am getting this error:

            C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/tiny_tds-2.0.0-x86-mingw32/lib/tiny_tds.rb:26:in require': cannot load such file -- tiny_tds/tiny_tds (LoadError)
            from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/tiny_tds-2.0.0
            -x86-mingw32/lib/tiny_tds.rb:26:in
            rescue in '
            from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/tiny_tds-2.0.0
            -x86-mingw32/lib/tiny_tds.rb:29:in `'

            ...

            ANSWER

            Answered 2017-Jul-20 at 10:18

            In the very beginning I was thinking that your problem was related to the availability of the gem for your current ruby version (something like this issue on GitHub).

            Digging into the documentation of the gem, in order to install on win you should run rake gem:windows first:

            Compiling Gems for Windows

            For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby 2.0, 2.1, 2.2, and 2.3 on Windows. In order to generate these gems, rake-compiler-dock is used. This project provides a Docker image with rvm, cross-compilers and a number of different target versions of Ruby.

            Run the following rake task to compile the gems for Windows. This will check the availability of Docker (and boot2docker on Windows or OS-X) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build:

            $ rake gem:windows

            Source https://stackoverflow.com/questions/45208659

            QUESTION

            ActiveRecord::Base doesn't belong in a hierarchy descending from ActiveRecord when connecting to two sqlserver databases
            Asked 2017-Jun-26 at 17:12

            I use ActiveRecord on a non rails app.I am connecting to two SQLserver databases using this method

            ...

            ANSWER

            Answered 2017-Jun-26 at 17:12

            So this was a weird problem. I had to migrate connection logic into the base classes. For some reason the second call to establish_connection was making AR4 "forget" the first establish_connection. this is weird since this was working on AR3. my models now look like this

            First Base Class

            Source https://stackoverflow.com/questions/44731099

            QUESTION

            Active Record acting weird
            Asked 2017-Jun-09 at 15:54

            Question am I doing something wrong with the following code?

            Controller Test

            ...

            ANSWER

            Answered 2017-Jun-09 at 15:05

            You are calling the attribute on ActiveRecord::Relation whereas you must be calling it on Notations instance

            Source https://stackoverflow.com/questions/44460856

            QUESTION

            ActiveRecord log which query went to which database
            Asked 2017-Mar-21 at 17:12

            In an ActiveRecord application with multiple connections to different databases, nothing in the log indicates which query went to which database. These queries to separate databases:

            ...

            ANSWER

            Answered 2017-Mar-21 at 17:12

            As I know you can't do it with ActiveRecord natively. But you can override log method in AbstractAdapter if you really need it:

            Source https://stackoverflow.com/questions/42769122

            QUESTION

            convert database of ruby on rails app from sql server to mysql
            Asked 2017-Mar-20 at 07:50

            i had clone a ruby on rails app with sql server, with some code like :

            ...

            ANSWER

            Answered 2017-Mar-20 at 07:24

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install activerecord-sqlserver-adapter

            The adapter has no strict gem dependencies outside of ActiveRecord. You will have to pick a connection mode, the default is dblib which uses the TinyTDS gem. Just bundle the gem and the adapter will use it.

            Support

            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.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git

          • CLI

            gh repo clone rails-sqlserver/activerecord-sqlserver-adapter

          • sshUrl

            git@github.com:rails-sqlserver/activerecord-sqlserver-adapter.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with activerecord-sqlserver-adapter

            Consider Popular Database Libraries

            redis

            by redis

            tidb

            by pingcap

            rethinkdb

            by rethinkdb

            cockroach

            by cockroachdb

            ClickHouse

            by ClickHouse

            Try Top Libraries by rails-sqlserver

            tiny_tds

            by rails-sqlserverRuby

            AdventureWorks.Ruby

            by rails-sqlserverRuby

            heroku-buildpack-freetds

            by rails-sqlserverShell

            docker-images

            by rails-sqlserverShell

            ss_app

            by rails-sqlserverRuby