directiverecord 0.1.10 → 0.1.11
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 +8 -8
- data/CHANGELOG.rdoc +5 -0
- data/VERSION +1 -1
- data/lib/directive_record/gem_ext/active_record/relation.rb +1 -1
- data/lib/directive_record/query/sql.rb +1 -0
- data/lib/directive_record/version.rb +1 -1
- data/test/unit/gem_ext/active_record/test_relation.rb +1 -1
- data/test/unit/query/test_mysql.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTcxNmYzYThjODg4OGZmZGVhZWIwMjQzZmQ2ZGExY2I2YWI1YWI3NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTdmNzI2MjM4ZTI4NzA3NDBmZGI2NTAwMGI1OGZhNDAwNDJjNzBiNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjhiNmRhMzU0ZWRkOWQ1ODVhMWExNzE1MzY3ZGMwYWMzZTkwMmI0MDlmYjA2
|
10
|
+
OGM5NzcwYWM1NjE5ZTBiMzcxZDQxYzA3NGZlZWYxZDA4M2RmYjU1OWI0ZTE5
|
11
|
+
YzEzMDQyYTEwMjkwNGFiYzg0MjBkYTQyNjU2ZmM2NGM4ZmE0YWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmM4OTgxZDc3NzJjZTY0ZjhiNjQwYjhiNDZhYTc4OWU5ZDgyNzY5ZmI0MGY5
|
14
|
+
MTBjZDg2NTYxOWYyZTk3MzM5NDUxYjQyMjRmZTQxMDFmZDg4NGM1OTk0MzIy
|
15
|
+
NmExMTA4MmZlN2EzMGQwYjllZGFiYzc0M2JlYzI1OWMzMDJjNzc=
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= DirectiveRecord CHANGELOG
|
2
2
|
|
3
|
+
== Version 0.1.11 (March 6, 2015)
|
4
|
+
|
5
|
+
* Counting ‘DISTINCT id’ instead of ‘*’ in ActiveRecord::Relation#count(:all) override
|
6
|
+
* Leaving sub selects alone
|
7
|
+
|
3
8
|
== Version 0.1.10 (March 5, 2015)
|
4
9
|
|
5
10
|
* Overridden ActiveRecord::Relation#count(:all) to hook in DirectiveRecord query mechanism
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
@@ -296,6 +296,7 @@ SQL
|
|
296
296
|
end
|
297
297
|
|
298
298
|
def prepend_base_alias(sql, aliases = {})
|
299
|
+
return sql if sql.include?("SELECT")
|
299
300
|
columns = base.columns_hash.keys
|
300
301
|
sql.gsub(/("[^"]*"|'[^']*'|`[^`]*`|[a-zA-Z_#{aggregate_delimiter}]+(\.[a-zA-Z_\*]+)*)/) do
|
301
302
|
columns.include?($1) ? "#{base_alias}.#{$1}" : begin
|
@@ -47,7 +47,7 @@ module Unit
|
|
47
47
|
describe "when not loaded" do
|
48
48
|
it "uses qry to count the records" do
|
49
49
|
@relation.expects(:loaded?).returns(false)
|
50
|
-
@relation.expects(:qry).with("COUNT(
|
50
|
+
@relation.expects(:qry).with("COUNT(DISTINCT id)").returns([[1982]])
|
51
51
|
assert_equal 1982, @relation.count(:all)
|
52
52
|
end
|
53
53
|
end
|
@@ -17,7 +17,17 @@ module Unit
|
|
17
17
|
FROM offices `o`
|
18
18
|
}
|
19
19
|
),
|
20
|
-
Office.to_qry("id, city")
|
20
|
+
Office.to_qry("id", "city")
|
21
|
+
)
|
22
|
+
|
23
|
+
assert_equal(
|
24
|
+
strip(
|
25
|
+
%Q{
|
26
|
+
SELECT `o`.id, `o`.city, (SELECT o1.id FROM offices o1)
|
27
|
+
FROM offices `o`
|
28
|
+
}
|
29
|
+
),
|
30
|
+
Office.to_qry("id", "city", "(SELECT o1.id FROM offices o1)")
|
21
31
|
)
|
22
32
|
|
23
33
|
assert_equal(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: directiverecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Engel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|