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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +10 -4
- data/lib/sequel/extensions/activerecord_connection.rb +0 -19
- data/lib/sequel/extensions/activerecord_connection/jdbc.rb +5 -1
- data/lib/sequel/extensions/activerecord_connection/mysql2.rb +2 -0
- data/lib/sequel/extensions/activerecord_connection/oracle.rb +16 -0
- data/lib/sequel/extensions/activerecord_connection/postgres.rb +2 -0
- data/lib/sequel/extensions/activerecord_connection/sqlite.rb +2 -0
- data/lib/sequel/extensions/activerecord_connection/tinytds.rb +19 -0
- data/lib/sequel/extensions/activerecord_connection/utils.rb +22 -0
- data/sequel-activerecord_connection.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee4a6a5b6dcfceb9856ca13e48cd47ce2573f9d5f4d8923518854eb0651c1cb9
|
4
|
+
data.tar.gz: 18fd0ce3a56b87b102e6534eef4ae478d1a2df10a4aac8ae984fa4069c477493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd33df7445d400b75b29782c99f83d1afc8fc93338eeab4fd0196c4281e34fc1df21d12a0e1a8ccd130995527bef95d7b3ca1b9b16f47a33623b750842b68732
|
7
|
+
data.tar.gz: c4e26c97e37efd8f8415c7c03799bdde385a478384531948b60837d43bb1f09e7a9feb899b2d080aa20d41f6fb152adfe236aaf0447a1140637696baecd1b1a7
|
data/CHANGELOG.md
CHANGED
@@ -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).
|
13
|
-
|
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
|
113
|
-
|
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)
|
@@ -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
|
@@ -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
|
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.
|
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-
|
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:
|