sqb 1.0.8 → 1.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 62ef6126a194c6379a78a024567b91a2278d57cf
4
- data.tar.gz: 74173493a093a294043c3f672079d64a58caa810
2
+ SHA256:
3
+ metadata.gz: 737a0396c7f6c7bd7eb582b08e786e89b9e2922e58215a8ea3504582d7ab30a2
4
+ data.tar.gz: 23b36444197b567e9dc07379be719e1b368aad5cece69fb03ae0d37b16910fcf
5
5
  SHA512:
6
- metadata.gz: a9493b63fe326d3375ef2f4399ff623083da10e062e8697cf498d7c221793efa2919f601af7ea9ebf39ed282b98b24c72a1f82104a19b4f727c271324a0052d2
7
- data.tar.gz: 1113bf3ae5beb73686c636382578bb7acb503c50bb143273417a353c3de3928ee280d973b3002733c9c5200dd088dce335a0c2566154505618dd1b87add02ea8
6
+ metadata.gz: d693e5a6eab235bfc13056d34fc7738a137e97732c6f4f14665f5fedafd3eeedda258eddfff3a6eecb9387c78397643aac54fd1c257f256fddef15b2ca52fa9f
7
+ data.tar.gz: 22ac438163afe97e76f0a1561bce6a15186dd0c99d405acdb2514484406549ae229a6e6fd41237ba34f5f9a340e43ab15a5dcf527a7080e897ed42348ba7cd37
@@ -0,0 +1,16 @@
1
+ module SQB
2
+ module IndexHint
3
+
4
+ def index_hint(index)
5
+ @index_hints ||= []
6
+ @index_hints << escape(index)
7
+ self
8
+ end
9
+
10
+ def no_index_hint!
11
+ @index_hints = nil
12
+ self
13
+ end
14
+
15
+ end
16
+ end
@@ -7,6 +7,7 @@ require 'sqb/ordering'
7
7
  require 'sqb/grouping'
8
8
  require 'sqb/limiting'
9
9
  require 'sqb/offsetting'
10
+ require 'sqb/index_hint'
10
11
 
11
12
  module SQB
12
13
  class Select < Base
@@ -19,6 +20,7 @@ module SQB
19
20
  include SQB::Grouping
20
21
  include SQB::Limiting
21
22
  include SQB::Offsetting
23
+ include SQB::IndexHint
22
24
 
23
25
  def to_sql
24
26
  [].tap do |query|
@@ -33,6 +35,10 @@ module SQB
33
35
  query << "FROM"
34
36
  query << escape_and_join(@options[:database_name], @table_name)
35
37
 
38
+ if @index_hints && !@index_hints.empty?
39
+ query << 'USE INDEX (' + @index_hints.join(', ') + ')'
40
+ end
41
+
36
42
  if @joins && !@joins.empty?
37
43
  query << @joins.join(' ')
38
44
  end
@@ -1,3 +1,3 @@
1
1
  module SQB
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-14 00:00:00.000000000 Z
11
+ date: 2019-09-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A friendly SQL builder for MySQL.
14
14
  email:
@@ -26,6 +26,7 @@ files:
26
26
  - lib/sqb/escaping.rb
27
27
  - lib/sqb/filtering.rb
28
28
  - lib/sqb/grouping.rb
29
+ - lib/sqb/index_hint.rb
29
30
  - lib/sqb/insert.rb
30
31
  - lib/sqb/joins.rb
31
32
  - lib/sqb/limiting.rb
@@ -58,8 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  - !ruby/object:Gem::Version
59
60
  version: '0'
60
61
  requirements: []
61
- rubyforge_project:
62
- rubygems_version: 2.5.2.3
62
+ rubygems_version: 3.0.6
63
63
  signing_key:
64
64
  specification_version: 4
65
65
  summary: This gem provides a friendly DSL for constructing MySQL queries.