activerecord-jdbcas400-adapter 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6199e97dfd1e313557b52d4e660110f7700fa4b4
4
- data.tar.gz: 886e6efe31d46508b42218613f0635233138a27e
3
+ metadata.gz: aa4ffdd7241e533ca058a550299fd74f7540045b
4
+ data.tar.gz: 8054ecb61e7a29c63172fdc4a70c88fd015511d6
5
5
  SHA512:
6
- metadata.gz: 4b703180d160b4b3672010cd040befe3853d2812c6cc9d0af9e135a8b5a84480e0e275171efc6025fafcdda951bb0a5d86c990c41d72f91aaef891b2fd226ca8
7
- data.tar.gz: 74ba90d96b88d3b7a421ecb0dc4dc3ab4debdc9dc33a84bc0fcd3954870068c13023e55d3a0e11925c7edc228f829e9acf40f3f01e8d18bbeb32771dafd791d6
6
+ metadata.gz: ab3ca543c1912dcc6faeb0314cbd29e28ce987abcfd129a0fd8a34952e11b76ee01d233fae61487e445eace73b521a86fcd778b4c7a8b2511f0de324f8cf8685
7
+ data.tar.gz: fe598ce868542fab9e3d016040c882163eacb12fc6b6ef57e3d2c3bc9e57801b54a532cc410182ab73db8fa916239334810e69bad8e27b28356e7d52cbca8a03
data/README.md CHANGED
@@ -63,6 +63,24 @@ To use native DB2 connection (directly on IBM i JVM only), you can add this to d
63
63
  ```
64
64
  This connection doesn't require credentials.
65
65
 
66
+ ### Transaction isolation : no commit
67
+ If your database supports setting the isolation level for a transaction, you can set it like so:
68
+
69
+ ```ruby
70
+ Post.transaction(isolation: :no_commit) do
71
+ #...
72
+ end
73
+ ```
74
+
75
+ Valid isolation levels are:
76
+ ```
77
+ :read_uncommitted
78
+ :read_committed
79
+ :repeatable_read
80
+ :serializable
81
+ :no_commit
82
+ ```
83
+
66
84
  ## Experimental features
67
85
  ### Current library
68
86
  To allow migrations with system naming, a configuration is added to adapter:
@@ -73,7 +73,7 @@ module ArJdbc
73
73
  def rename_column(table_name, column_name, new_column_name)
74
74
  column = columns(table_name, column_name).find { |column| column.name == column_name.to_s}
75
75
  add_column(table_name, new_column_name, column.type, column.instance_values)
76
- execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(new_column_name)} = #{quote_column_name(column_name)}")
76
+ execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(new_column_name)} = #{quote_column_name(column_name)} WITH NC")
77
77
  remove_column(table_name, column_name)
78
78
  end
79
79
 
@@ -93,24 +93,13 @@ module ArJdbc
93
93
  end
94
94
 
95
95
  # Disable transactions when they are not supported
96
- def begin_db_transaction
97
- super unless config[:transaction_isolation] == 'none'
98
- end
99
-
100
- def commit_db_transaction
101
- super unless config[:transaction_isolation] == 'none'
102
- end
103
-
104
- def rollback_db_transaction
105
- super unless config[:transaction_isolation] == 'none'
96
+ def transaction_isolation_levels
97
+ super.merge({ no_commit: 'NO COMMIT' })
106
98
  end
107
99
 
108
100
  def begin_isolated_db_transaction(isolation)
109
- super unless config[:transaction_isolation] == 'none'
110
- end
111
-
112
- def create_savepoint(name = current_savepoint_name(true))
113
- super unless config[:transaction_isolation] == 'none'
101
+ begin_db_transaction
102
+ execute "SET TRANSACTION ISOLATION LEVEL #{transaction_isolation_levels.fetch(isolation)}"
114
103
  end
115
104
 
116
105
  private
data/test/test_adapter.rb CHANGED
@@ -51,4 +51,8 @@ class TestAdapter < Test::Unit::TestCase
51
51
  end
52
52
  end
53
53
 
54
+ def test_transaction_isolation_levels
55
+ assert_equal(connection.transaction_isolation_levels.fetch(:no_commit), 'NO COMMIT')
56
+ end
57
+
54
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbcas400-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger, Ola Bini, Pierrick Rouxel and JRuby contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-jdbc-adapter
@@ -16,12 +16,12 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.7
19
+ version: 1.3.9
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - '>='
23
23
  - !ruby/object:Gem::Version
24
- version: 1.3.7
24
+ version: 1.3.9
25
25
  prerelease: false
26
26
  type: :runtime
27
27
  - !ruby/object:Gem::Dependency