composite_primary_keys 12.0.4 → 12.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +880 -859
  3. data/README.rdoc +180 -180
  4. data/lib/composite_primary_keys.rb +117 -118
  5. data/lib/composite_primary_keys/active_model/attribute_assignment.rb +19 -19
  6. data/lib/composite_primary_keys/associations/association_scope.rb +68 -68
  7. data/lib/composite_primary_keys/associations/join_dependency.rb +103 -103
  8. data/lib/composite_primary_keys/attribute_methods.rb +9 -9
  9. data/lib/composite_primary_keys/attribute_methods/read.rb +30 -30
  10. data/lib/composite_primary_keys/attribute_methods/write.rb +35 -35
  11. data/lib/composite_primary_keys/base.rb +141 -141
  12. data/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb +37 -22
  13. data/lib/composite_primary_keys/connection_adapters/sqlserver/database_statements.rb +44 -41
  14. data/lib/composite_primary_keys/core.rb +48 -48
  15. data/lib/composite_primary_keys/persistence.rb +82 -81
  16. data/lib/composite_primary_keys/reflection.rb +29 -29
  17. data/lib/composite_primary_keys/relation.rb +193 -193
  18. data/lib/composite_primary_keys/relation/batches.rb +1 -1
  19. data/lib/composite_primary_keys/relation/calculations.rb +81 -81
  20. data/lib/composite_primary_keys/relation/finder_methods.rb +235 -235
  21. data/lib/composite_primary_keys/relation/predicate_builder/association_query_value.rb +20 -20
  22. data/lib/composite_primary_keys/relation/query_methods.rb +42 -42
  23. data/lib/composite_primary_keys/relation/where_clause.rb +23 -23
  24. data/lib/composite_primary_keys/version.rb +8 -8
  25. data/test/abstract_unit.rb +114 -114
  26. data/test/connections/databases.ci.yml +22 -19
  27. data/test/fixtures/db_definitions/db2-create-tables.sql +112 -112
  28. data/test/fixtures/db_definitions/db2-drop-tables.sql +16 -16
  29. data/test/fixtures/db_definitions/mysql.sql +180 -180
  30. data/test/fixtures/db_definitions/oracle.drop.sql +41 -41
  31. data/test/fixtures/db_definitions/oracle.sql +199 -199
  32. data/test/fixtures/db_definitions/postgresql.sql +182 -182
  33. data/test/fixtures/db_definitions/sqlite.sql +169 -169
  34. data/test/fixtures/db_definitions/sqlserver.sql +176 -176
  35. data/test/fixtures/department.rb +16 -16
  36. data/test/fixtures/departments.yml +15 -15
  37. data/test/fixtures/employees.yml +27 -27
  38. data/test/fixtures/restaurants_suburbs.yml +10 -10
  39. data/test/fixtures/streets.yml +16 -16
  40. data/test/fixtures/suburbs.yml +14 -14
  41. data/test/fixtures/user.rb +11 -11
  42. data/test/test_associations.rb +358 -358
  43. data/test/test_attributes.rb +60 -60
  44. data/test/test_calculations.rb +42 -42
  45. data/test/test_create.rb +218 -180
  46. data/test/test_delete.rb +182 -179
  47. data/test/test_exists.rb +39 -39
  48. data/test/test_find.rb +164 -157
  49. data/test/test_ids.rb +112 -112
  50. data/test/test_nested_attributes.rb +67 -67
  51. data/test/test_update.rb +96 -96
  52. metadata +2 -3
  53. data/lib/composite_primary_keys/connection_adapters/mysql/database_statements.rb +0 -24
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composite_primary_keys
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.4
4
+ version: 12.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-30 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -71,7 +71,6 @@ files:
71
71
  - lib/composite_primary_keys/composite_relation.rb
72
72
  - lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb
73
73
  - lib/composite_primary_keys/connection_adapters/abstract_adapter.rb
74
- - lib/composite_primary_keys/connection_adapters/mysql/database_statements.rb
75
74
  - lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
76
75
  - lib/composite_primary_keys/connection_adapters/sqlserver/database_statements.rb
77
76
  - lib/composite_primary_keys/core.rb
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveRecord
4
- module ConnectionAdapters
5
- module MySQL
6
- module DatabaseStatements
7
- def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
8
- sql, binds = to_sql_and_binds(arel, binds)
9
- value = exec_insert(sql, name, binds, pk, sequence_name)
10
-
11
- # CPK
12
- if pk.is_a?(Array)
13
- pk.map do |key|
14
- column = column_for(arel.ast.relation.name, key)
15
- column.auto_increment? ? last_inserted_id(value) : nil
16
- end
17
- else
18
- id_value || last_inserted_id(value)
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end