flounder 0.11.4 → 0.11.5
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 +4 -4
- data/HISTORY +1 -0
- data/flounder.gemspec +1 -1
- data/lib/flounder/postgres_utils.rb +19 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a13735f8160f9b23fb2c87b473998bfc4e146e2
|
4
|
+
data.tar.gz: a7e29a24118ad278bcdaecf42c0b47702924ddb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
@
|
46
|
-
|
47
|
-
|
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
|