pgdog 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pgdog.rb +12 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beb3501bafd5043df9608c736c8d9506576e0a15bf2dba629cf261e60453205d
4
- data.tar.gz: 6cfd1241c4f9c1d7052e30844103f2a9d2e212cf25b1c2837cb652ecc2eb4c5e
3
+ metadata.gz: 19fd33ec4a1f17d24527f0c7b8bdb85b32a7bbacbd8371ca328b7b36b9fd7ce5
4
+ data.tar.gz: 6a516645601309bc73cea474328f4f3b8eebd1d0b23e6938199da842eb59d0aa
5
5
  SHA512:
6
- metadata.gz: ff36dd430548ddef6bc3ca62034546751ca423b3c52eb4117a3a1198f7b87e8490cbb0bae78a232726d2408b9bf0e2fbcc0945bacfbae244393b11bdc162c2a6
7
- data.tar.gz: 91985d77df68e8ff6afd286f00a0eccf7ada653f456f8eaecfbf34f7abbd8079e4fbd13ae0c2b3b61bb8c6edea407a8f6aad20ce68f6fe4631d6b487e98ab175
6
+ metadata.gz: 2fac30df58c4e40247aa60145e0a3aaa5e61f1e0f3529a5573c593c6c58cbdbac0b949b562b1a5ca9dc07e698953ba95e5e86e61016ff52f4ede4a1ec76c22ed
7
+ data.tar.gz: 9ae56e2701326d4c2341a55fb9df3f1c865d41eb702127c9a379dd08bef31deee6ddc7d5539f654efc270b77ab5dd9c804dc2ac7dcc2bc5ae413eb8d3b9b8026
data/lib/pgdog.rb CHANGED
@@ -21,7 +21,7 @@ class PgDog
21
21
  # manually using SET.
22
22
  def self.with_sharding_key(key)
23
23
  # Basic SQL injection protection.
24
- key.to_s.sub "'", "''"
24
+ key = key.to_s.sub "'", "''"
25
25
 
26
26
  PgDog.check_transaction
27
27
  ActiveRecord::Base.transaction do
@@ -37,7 +37,7 @@ class PgDog
37
37
  # and the PgDog query parser won't be used.
38
38
  def self.shards
39
39
  PgDog.check_transaction
40
- shards = ActiveRecord::Base.connection.execute "SHOW \"pgdog.shards\""
40
+ shards = self.connection.execute "SHOW \"pgdog.shards\""
41
41
  return shards[0]["shards"].to_i
42
42
  end
43
43
 
@@ -70,3 +70,13 @@ end
70
70
  # Error raised if a transaction is already started.
71
71
  class PgDogError < StandardError
72
72
  end
73
+
74
+ # class ActiveRecord::Schema
75
+ # def self.install_sharded_primary_key(table)
76
+ # shards = PgDog.shards
77
+ # table = table.to_s.sub "'", "''"
78
+ # shards.times do |shard|
79
+ # PgDog.connection.execute "/* pgdog_shard: #{shard} */ SELECT pgdog.install_next_id('public', '#{table}', 'id', #{shards}, #{shard})"
80
+ # end
81
+ # end
82
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lev Kokotov