sqlstmt 0.1.11 → 0.1.12

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. data/lib/sqlstmt/query.rb +1 -1
  2. data/test/select.dt.rb +6 -0
  3. metadata +2 -2
data/lib/sqlstmt/query.rb CHANGED
@@ -77,7 +77,7 @@ private
77
77
  if @joins.empty?
78
78
  ''
79
79
  else
80
- " #{@joins.join(' ')}"
80
+ " #{@joins.uniq.join(' ')}"
81
81
  end
82
82
  end
83
83
 
data/test/select.dt.rb CHANGED
@@ -21,6 +21,12 @@ class TestSelect < DohTest::TestGroup
21
21
  assert_equal('SELECT blah FROM source s LEFT JOIN other o USING (blah_id)', Select.new.table('source s').left_join_using('other o', 'blah_id').field('blah').no_where.to_s)
22
22
  assert_equal('SELECT blah,blee FROM source', Select.new.table('source').field('blah','blee').no_where.to_s)
23
23
  end
24
+
25
+ def test_duplicate_joins
26
+ sqlb = Select.new.table('source s').field('frog').no_where
27
+ 4.times { sqlb.join('other o', 's.blah_id = o.blah_id') }
28
+ assert_equal('SELECT frog FROM source s JOIN other o ON s.blah_id = o.blah_id', sqlb.to_s)
29
+ end
24
30
  end
25
31
 
26
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlstmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-22 00:00:00.000000000 Z
13
+ date: 2013-05-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dohutil