flounder 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/flounder.gemspec +1 -1
- data/lib/flounder/query/base.rb +6 -1
- data/qed/updates.md +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc0f113f0d254c49373affa1869e3f8fc03a3fb
|
4
|
+
data.tar.gz: 8ff7ed39500492b2f965ff7e1d7c1acc2a7f2473
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e855f62812d513ae1ca5bfb0d04d0a313c5f9d0f7c42d076de31625a60b344dd32a05e8f9cfb674346e6db7c964ea157c0f2c50f91f5dce333226612191a23
|
7
|
+
data.tar.gz: bc99c6125d8e890eb89f1db3ab1ad326e50f0a2d13950a4efed4089f4c209773e3d79dc2513862c33a82788d130c9484c60cc7b7a09832efd55a10a91c55b829
|
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.
|
5
|
+
s.version = '0.14.0'
|
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"
|
data/lib/flounder/query/base.rb
CHANGED
@@ -215,7 +215,12 @@ module Flounder::Query
|
|
215
215
|
value = PgHstore.dump(value, true)
|
216
216
|
end
|
217
217
|
|
218
|
-
|
218
|
+
# If this is update by subselect, don't create a binding.
|
219
|
+
placeholder = if value.kind_of?(Flounder::Query::Base)
|
220
|
+
Flounder.literal("(#{value.manager.to_sql})")
|
221
|
+
else
|
222
|
+
add_binding(value)
|
223
|
+
end
|
219
224
|
|
220
225
|
case field
|
221
226
|
when Symbol, String
|
data/qed/updates.md
CHANGED
@@ -65,3 +65,11 @@ Updating multiple rows is possible.
|
|
65
65
|
|
66
66
|
updated.map(&:name).assert == ['Update Multiple Rows']*7
|
67
67
|
~~~
|
68
|
+
|
69
|
+
Also, updating by using a subquery is possible.
|
70
|
+
|
71
|
+
~~~ruby
|
72
|
+
first_author = users.project(:id).limit(1)
|
73
|
+
users.update(approver_id: first_author).where(:approver_id => nil).
|
74
|
+
assert generates_sql("UPDATE \"users\" SET \"approver_id\" = (SELECT \"users\".\"id\" FROM \"users\" LIMIT 1) WHERE \"users\".\"approver_id\" IS NULL RETURNING *")
|
75
|
+
~~~
|
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.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaspar Schiess
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arel
|