flounder 0.11.4 → 0.11.5

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
  SHA1:
3
- metadata.gz: b1e40f2f96562740062a78b94e3fe1aaefda394c
4
- data.tar.gz: 6142038a425251078a47f4f0aea1dc4a2a383551
3
+ metadata.gz: 3a13735f8160f9b23fb2c87b473998bfc4e146e2
4
+ data.tar.gz: a7e29a24118ad278bcdaecf42c0b47702924ddb6
5
5
  SHA512:
6
- metadata.gz: 3bceb92cf55b7e0cfe1c7ace211e0283f66a08be18f30ad841e923ac00f929f7089817098c30bf2fcbf10e87f2b322548d2fb726de8fd710299c997c46df3127
7
- data.tar.gz: 56dffcedde3366684040a6aff7c29e84efe81ec1418a5c3580a7f76d8303a519b8aa34b69606c72cbafc1bfc2d35ca6e828e179b8c2d4a8cd6366b6bacd5c78c
6
+ metadata.gz: 39706dd19768ace33133e5f30520edcd87c455fd031fa5c012f76b44a7224f546e3b4f077413a1e12fe31410355c906481e67be1d97d42cd30ff139e89653984
7
+ data.tar.gz: 9db75632b66282a30b7106a58e1a8b7759b5e70fd86892d0031ac8759a41434bcfb40e51ebdbbe8240c5b86ce2185d2bc83be0ed30ca56a849e43217fbebee2d
data/HISTORY CHANGED
@@ -5,6 +5,7 @@
5
5
  + #hoist is the opposite of #anchor - it reverts to the original entity.
6
6
  + native treatment of hstore - returns you a hashie::mash.
7
7
  + Fixes a bug where limit would leak the SelectManager.
8
+ + Also deals with the situation where hstore doesn't exist.
8
9
 
9
10
  # 0.10
10
11
  + Datamapper interop is improved (also in #order_by)
data/flounder.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "flounder"
5
- s.version = '0.11.4'
5
+ s.version = '0.11.5'
6
6
  s.summary = "Flounder is a way to write SQL simply in Ruby. It deals with everything BUT object relational mapping. "
7
7
  s.email = "kaspar.schiess@technologyastronauts.ch"
8
8
  s.homepage = "https://bitbucket.org/technologyastronauts/oss_flounder"
@@ -17,6 +17,11 @@ module Flounder
17
17
 
18
18
  def typecast type_oid, value
19
19
  return nil unless value
20
+
21
+ # hstore extension
22
+ if oid_hstore && type_oid == oid_hstore
23
+ return PgHstore.load(value)
24
+ end
20
25
 
21
26
  # assert: value is not nil
22
27
  case type_oid
@@ -33,22 +38,30 @@ module Flounder
33
38
  when OID_BOOLEAN
34
39
  value == 't'
35
40
  when OID_TEXT
36
- value.to_s
37
- when oid_hstore
38
- PgHstore.load(value)
41
+ value.to_s
39
42
  else
40
43
  value
41
44
  end
42
45
  end
43
46
 
44
47
  def oid_hstore
45
- @oid_hstore ||= begin
46
- result = exec("SELECT oid FROM pg_type WHERE typname='hstore'")
47
- result.first.values.first.to_i
48
+ unless @oid_hstore_initialized
49
+ @oid_hstore_initialized = true
50
+
51
+ @oid_hstore = begin
52
+ result = exec("SELECT oid FROM pg_type WHERE typname='hstore'")
53
+ row = result.first
54
+
55
+ row && row.values.first.to_i
56
+ end
48
57
  end
58
+
59
+ @oid_hstore
49
60
  end
50
61
 
51
62
  def type_oid_to_sym oid
63
+ return :hash if oid_hstore && oid==oid_hstore
64
+
52
65
  case oid
53
66
  when OID_TIMESTAMP
54
67
  :datetime
@@ -64,8 +77,6 @@ module Flounder
64
77
  :string
65
78
  when OID_BOOLEAN
66
79
  :boolean
67
- when oid_hstore
68
- :hash
69
80
  else
70
81
  nil
71
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaspar Schiess