sequel-activerecord_connection 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fba99c145ebf98ed9c3e26fdc96afc3bc5fa7820e01d466ab10320c72765c8ae
4
- data.tar.gz: ae36bef3a63280cf54f1a92e814c1bf4928dc8050f572694aac4340389115f9b
3
+ metadata.gz: ee4a6a5b6dcfceb9856ca13e48cd47ce2573f9d5f4d8923518854eb0651c1cb9
4
+ data.tar.gz: 18fd0ce3a56b87b102e6534eef4ae478d1a2df10a4aac8ae984fa4069c477493
5
5
  SHA512:
6
- metadata.gz: 073babf3f4e9d60dcb439eb0d9a7b801b9cf23b9be53366382cdd9e18234de66c329d0a975e68fb57d78cbf80f26ddafcd3f1bc90e8282a9a24b90cd1f8c0a43
7
- data.tar.gz: 420a6326c6c0e0b85874b52c89e747a59702280e763d9f6a090dd649b17718771cefaa1d9d72d4244a92bcfbee7ff2c186480ad0005d17685abcd0a595ccb97c
6
+ metadata.gz: dd33df7445d400b75b29782c99f83d1afc8fc93338eeab4fd0196c4281e34fc1df21d12a0e1a8ccd130995527bef95d7b3ca1b9b16f47a33623b750842b68732
7
+ data.tar.gz: c4e26c97e37efd8f8415c7c03799bdde385a478384531948b60837d43bb1f09e7a9feb899b2d080aa20d41f6fb152adfe236aaf0447a1140637696baecd1b1a7
@@ -1,3 +1,9 @@
1
+ ## 1.2.0 (2020-11-15)
2
+
3
+ * Attempt support for [activerecord-sqlserver-adapter](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) (@janko)
4
+
5
+ * Attempt support for [oracle-enhanced](https://github.com/rsim/oracle-enhanced) Active Record adapter (@janko)
6
+
1
7
  ## 1.1.0 (2020-11-08)
2
8
 
3
9
  * Drop support for Ruby 2.2 (@janko)
data/README.md CHANGED
@@ -9,8 +9,10 @@ separate database connection. Or if you're transitioning from ActiveRecord to
9
9
  Sequel, and want the database connection to be shared.
10
10
 
11
11
  It works on ActiveRecord 4.2+ and fully supports PostgresSQL, MySQL and SQLite
12
- adapters, both the native ones and JDBC (JRuby). Other adapters might work too,
13
- but their integration hasn't been tested.
12
+ adapters, both the native ones and JDBC (JRuby). There is attempted suppport
13
+ for [Oracle enhanced] and [SQL Server] Active Record adapters (`oracle` and
14
+ `tinytds` in Sequel). Other adapters might work too, but their integration
15
+ hasn't been tested.
14
16
 
15
17
  ## Installation
16
18
 
@@ -109,8 +111,9 @@ DB.transaction(isolation: :serializable) do
109
111
  end
110
112
  ```
111
113
 
112
- When combining Active Record and Sequel transactions, Sequel transaction hook
113
- functionality will be utilized when possible.
114
+ When registering transaction hooks, they will be registered on Sequel
115
+ transactions when possible, in which case they will behave as described in the
116
+ [Sequel docs][sequel transaction hooks].
114
117
 
115
118
  ```rb
116
119
  # Sequel: An after_commit transaction hook will always get executed if the outer
@@ -223,3 +226,6 @@ Everyone interacting in this project's codebases, issue trackers, chat rooms and
223
226
  [Sequel]: https://github.com/jeremyevans/sequel
224
227
  [Rodauth]: https://github.com/jeremyevans/rodauth
225
228
  [rom-sql]: https://github.com/rom-rb/rom-sql
229
+ [sequel transaction hooks]: http://sequel.jeremyevans.net/rdoc/files/doc/transactions_rdoc.html#label-Transaction+Hooks
230
+ [Oracle enhanced]: https://github.com/rsim/oracle-enhanced
231
+ [SQL Server]: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter
@@ -152,25 +152,6 @@ module Sequel
152
152
  &block
153
153
  )
154
154
  end
155
-
156
- module Utils
157
- def self.set_value(object, name, new_value)
158
- original_value = object.send(name)
159
- object.send(:"#{name}=", new_value)
160
- yield
161
- ensure
162
- object.send(:"#{name}=", original_value)
163
- end
164
-
165
- def self.add_prepared_statements_cache(conn)
166
- return if conn.respond_to?(:prepared_statements)
167
-
168
- class << conn
169
- attr_accessor :prepared_statements
170
- end
171
- conn.prepared_statements = {}
172
- end
173
- end
174
155
  end
175
156
 
176
157
  Database.register_extension(:activerecord_connection, ActiveRecordConnection)
@@ -9,7 +9,11 @@ module Sequel
9
9
 
10
10
  def synchronize(*)
11
11
  super do |conn|
12
- yield conn.connection
12
+ if database_type == :oracle
13
+ yield conn.raw_connection
14
+ else
15
+ yield conn.connection
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,3 +1,5 @@
1
+ require_relative "utils"
2
+
1
3
  module Sequel
2
4
  module ActiveRecordConnection
3
5
  module Mysql2
@@ -0,0 +1,16 @@
1
+ require_relative "utils"
2
+
3
+ module Sequel
4
+ module ActiveRecordConnection
5
+ module Oracle
6
+ def synchronize(*)
7
+ super do |conn|
8
+ # required for prepared statements
9
+ Utils.add_prepared_statements_cache(conn.raw_oci_connection)
10
+
11
+ yield conn.raw_oci_connection
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,5 @@
1
+ require_relative "utils"
2
+
1
3
  module Sequel
2
4
  module ActiveRecordConnection
3
5
  module Postgres
@@ -1,3 +1,5 @@
1
+ require_relative "utils"
2
+
1
3
  module Sequel
2
4
  module ActiveRecordConnection
3
5
  module Sqlite
@@ -0,0 +1,19 @@
1
+ require_relative "utils"
2
+
3
+ module Sequel
4
+ module ActiveRecordConnection
5
+ module Tinytds
6
+ def synchronize(*)
7
+ super do |conn|
8
+ conn.query_options.merge!(cache_rows: false)
9
+
10
+ begin
11
+ yield conn
12
+ ensure
13
+ conn.query_options.merge!(cache_rows: true)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ module Sequel
2
+ module ActiveRecordConnection
3
+ module Utils
4
+ def self.set_value(object, name, new_value)
5
+ original_value = object.send(name)
6
+ object.send(:"#{name}=", new_value)
7
+ yield
8
+ ensure
9
+ object.send(:"#{name}=", original_value)
10
+ end
11
+
12
+ def self.add_prepared_statements_cache(conn)
13
+ return if conn.respond_to?(:prepared_statements)
14
+
15
+ class << conn
16
+ attr_accessor :prepared_statements
17
+ end
18
+ conn.prepared_statements = {}
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "sequel-activerecord_connection"
3
- spec.version = "1.1.0"
3
+ spec.version = "1.2.0"
4
4
  spec.authors = ["Janko Marohnić"]
5
5
  spec.email = ["janko.marohnic@gmail.com"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-activerecord_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-08 00:00:00.000000000 Z
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -113,8 +113,11 @@ files:
113
113
  - lib/sequel/extensions/activerecord_connection.rb
114
114
  - lib/sequel/extensions/activerecord_connection/jdbc.rb
115
115
  - lib/sequel/extensions/activerecord_connection/mysql2.rb
116
+ - lib/sequel/extensions/activerecord_connection/oracle.rb
116
117
  - lib/sequel/extensions/activerecord_connection/postgres.rb
117
118
  - lib/sequel/extensions/activerecord_connection/sqlite.rb
119
+ - lib/sequel/extensions/activerecord_connection/tinytds.rb
120
+ - lib/sequel/extensions/activerecord_connection/utils.rb
118
121
  - sequel-activerecord_connection.gemspec
119
122
  homepage: https://github.com/janko/sequel-activerecord_connection
120
123
  licenses: