Activerecord-sqlserver-adapter gem download




















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.

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. We currently conform to an unpublished and non-standard AbstractAdapter interface to configure connections made to the database.

This can be used to identify the connection in SQL Server's activity monitor. By default it will use the appname from your database. Below shows how you might use the database. This method takes the name of the stored procedure which can be a string or symbol and any number of variables to pass to the procedure. Arguments will automatically be quoted per the connection's standards as normal. For example:. The 3. In SQL Server, this is called the showplan.

So the following ruby would log the plan table below it. You can configure a few options to your needs. First is the max column width for the logged table.

The default value is 50 characters. You can change it like so. Another configuration is the showplan option. Some might find the XML format more useful. If you have Nokogiri installed, we will format the XML string. I will gladly accept pathches that make the XML printer more useful! If you find that explain breaks your app, simple disable it. Do not open a github issue unless you have a patch.

Please consult the Rails guides for more info. The adapter has no strict gem dependencies outside of ActiveRecord. This can be used to identify the connection in SQL Server's activity monitor. By default it will use the appname from your database. Below shows how you might use the database. This method takes the name of the stored procedure which can be a string or symbol and any number of variables to pass to the procedure. Arguments will automatically be quoted per the connection's standards as normal.

For example:. The 3. In SQL Server, this is called the showplan. So the following ruby would log the plan table below it. You can configure a few options to your needs.

First is the max column width for the logged table. The default value is 50 characters. You can change it like so. Another configuration is the showplan option. Some might find the XML format more useful. If you have Nokogiri installed, we will format the XML string.

I will gladly accept pathches that make the XML printer more useful! If you find that explain breaks your app, simple disable it.

Do not open a github issue unless you have a patch. Please consult the Rails guides for more info. When creating a new Rails application you can specify that you want to use the SQL Server adapter using the database option:.

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. If you would like to contribute a feature or bugfix, thanks! 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. 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.

Skip to content. Star Branches Tags. Could not load branches.



0コメント

  • 1000 / 1000