directiverecord 0.1.31 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9efd9975c4ca2c83cb43138711e0700470e3b43
4
- data.tar.gz: fdd9f3e1885b7c357bf63659c685d8a0f1b3f970
3
+ metadata.gz: fb7dc46ac479a9de38a158e0e98e6d0b1d01d187
4
+ data.tar.gz: ad4da8692eb11cbd14d1de27059bdda64cb77e62
5
5
  SHA512:
6
- metadata.gz: 0631e86b65c613be8a629d11483ead27423658d9c93e063d78c9586ceac6bc0e23365210311bdb5291399cfa1aa543efb1ae8f470b2814b75e5886c7c23ac0e3
7
- data.tar.gz: 57624b34287d89498c51b4d98f8672597c72adc0c97e5edad0c49f003f3f89090a160922892dc2a8b9787a8c28523e4c3caa643c5867e9c453043a297042ca11
6
+ metadata.gz: d206d14e6d042182e73b699b74fffb482e0141b87475a3aad4304b8c3b0c78404b9acfb7f408aed805e79ebb7d7e263bce01aa21056641a307a71ce3e18f87ad
7
+ data.tar.gz: 59392eda1abed8b78dee862ccbfec2a4ed8d50076a01a1ee7a75ad0488ad0e43ed825757c03d4a28389ad964144dc50ecb936f8ae08e989a76a80196c081c986
@@ -1,5 +1,10 @@
1
1
  = DirectiveRecord CHANGELOG
2
2
 
3
+ == Version 0.1.32 (October 23, 2015)
4
+
5
+ * Added #qry_value and #qry_values
6
+ * Improved detecting quotations (see http://stackoverflow.com/questions/171480/regex-grabbing-values-between-quotation-marks)
7
+
3
8
  == Version 0.1.31 (August 26, 2015)
4
9
 
5
10
  * Improved the :group_by, :having and :order_by option correction
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.31
1
+ 0.1.32
@@ -9,6 +9,14 @@ module ActiveRecord
9
9
  extract_connection(args).select_rows to_qry(*args)
10
10
  end
11
11
 
12
+ def self.qry_value(*args)
13
+ extract_connection(args).select_value to_qry(*args)
14
+ end
15
+
16
+ def self.qry_values(*args)
17
+ extract_connection(args).select_values to_qry(*args)
18
+ end
19
+
12
20
  def self.to_trend_qry(q1, q2, join_column_count, options)
13
21
  DirectiveRecord::Query.new(self).to_trend_sql(q1, q2, join_column_count, options)
14
22
  end
@@ -13,5 +13,13 @@ module ActiveRecord
13
13
  klass.qry qry_options(*args)
14
14
  end
15
15
 
16
+ def qry_value(*args)
17
+ klass.qry_value qry_options(*args)
18
+ end
19
+
20
+ def qry_values(*args)
21
+ klass.qry_values qry_options(*args)
22
+ end
23
+
16
24
  end
17
25
  end
@@ -257,7 +257,7 @@ SQL
257
257
 
258
258
  where, having = (options[:where] || []).partition do |statement|
259
259
  !options[:aggregated].keys.include?(statement.strip.match(regexp).to_s) &&
260
- statement.gsub(/((?<![\\])['"])((?:.(?!(?<![\\])\1))*.?)\1/, " ")
260
+ statement.gsub(/(["'])(?:(?=(\\?))\2.)*?\1/, " ")
261
261
  .split(/\b(and|or)\b/i).reject{|sql| %w(and or).include? sql.downcase}
262
262
  .collect{|sql| sql = sql.strip; (sql[0] == "(" && sql[-1] == ")" ? sql[1..-1] : sql)}
263
263
  .all? do |sql|
@@ -373,7 +373,7 @@ SQL
373
373
  [:select, :where, :group_by, :having, :order_by].inject([]) do |paths, key|
374
374
  if value = options[key]
375
375
  value = value.join " " if value.is_a?(Array)
376
- paths.concat value.gsub(/((?<![\\])['"])((?:.(?!(?<![\\])\1))*.?)\1/, " ").gsub(/sub:[a-zA-Z_]+\.[a-zA-Z_\.]+/, " ").scan(/[a-zA-Z_]+\.[a-zA-Z_\.]+/).collect{|x| x.split(".")[0..-2].join "."}
376
+ paths.concat value.gsub(/(["'])(?:(?=(\\?))\2.)*?\1/, " ").gsub(/sub:[a-zA-Z_]+\.[a-zA-Z_\.]+/, " ").scan(/[a-zA-Z_]+\.[a-zA-Z_\.]+/).collect{|x| x.split(".")[0..-2].join "."}
377
377
  else
378
378
  paths
379
379
  end
@@ -1,7 +1,7 @@
1
1
  module DirectiveRecord
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 31
4
+ TINY = 32
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
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.31
4
+ version: 0.1.32
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-08-26 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  requirements: []
208
208
  rubyforge_project:
209
- rubygems_version: 2.4.3
209
+ rubygems_version: 2.4.6
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: A layer on top of ActiveRecord for using paths within queries without thinking