native-query 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +8 -9
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/native-query/join.rb +9 -7
- data/lib/native-query/query.rb +30 -17
- data/native-query.gemspec +10 -10
- metadata +19 -19
data/Gemfile
CHANGED
@@ -7,8 +7,8 @@ source "http://rubygems.org"
|
|
7
7
|
# Add dependencies to develop your gem here.
|
8
8
|
# Include everything needed to run rake, tests, features, etc.
|
9
9
|
group :development do
|
10
|
-
gem "bundler", "
|
11
|
-
gem "
|
10
|
+
gem "bundler", ">= 1.0.13"
|
11
|
+
gem "jeweler2", ">= 2.0.0"
|
12
12
|
end
|
13
13
|
|
14
14
|
|
data/Gemfile.lock
CHANGED
@@ -2,24 +2,23 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
abstract (1.0.0)
|
5
|
-
fluent-query (0.9.
|
5
|
+
fluent-query (0.9.1)
|
6
6
|
abstract (>= 1.0.0)
|
7
7
|
hash-utils (>= 0.18.0)
|
8
8
|
hashie (>= 1.0.0)
|
9
9
|
git (1.2.5)
|
10
|
-
hash-utils (0.
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
hash-utils (1.0.0)
|
11
|
+
ruby-version
|
12
|
+
hashie (1.2.0)
|
13
|
+
jeweler2 (2.0.9)
|
14
14
|
git (>= 1.2.5)
|
15
|
-
|
16
|
-
rake (0.9.2)
|
15
|
+
ruby-version (0.3.1)
|
17
16
|
|
18
17
|
PLATFORMS
|
19
18
|
ruby
|
20
19
|
|
21
20
|
DEPENDENCIES
|
22
|
-
bundler (
|
21
|
+
bundler (>= 1.0.13)
|
23
22
|
fluent-query (>= 0.9.1)
|
24
23
|
hash-utils (>= 0.18.0)
|
25
|
-
|
24
|
+
jeweler2 (>= 2.0.0)
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010 -
|
1
|
+
Copyright (c) 2010 - 2012 Martin Kozák (martinkozak@martinkozak.net)
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -12,14 +12,14 @@ rescue Bundler::BundlerError => e
|
|
12
12
|
end
|
13
13
|
|
14
14
|
require 'rake'
|
15
|
-
require '
|
15
|
+
require 'jeweler2'
|
16
16
|
|
17
17
|
Jeweler::Tasks.new do |gem|
|
18
18
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
19
19
|
gem.name = "native-query"
|
20
20
|
gem.homepage = "http://github.com/martinkozak/native-query"
|
21
21
|
gem.license = "MIT"
|
22
|
-
gem.summary = 'Cool way how to speak with database server. It\'s ellegant
|
22
|
+
gem.summary = 'Cool way how to speak with database server. It\'s ellegant DSL; the SQL query helper which works by similar way as Arel or another ORM selecting logic. But it\'s derived from Dibi database layer in its ideas, so it\'s much more simple and (of sure) much more KISS, readable and straightforward.'
|
23
23
|
gem.email = "martinkozak@martinkozak.net"
|
24
24
|
gem.authors = ["Martin Kozák"]
|
25
25
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/lib/native-query/join.rb
CHANGED
@@ -149,7 +149,7 @@ module NativeQuery
|
|
149
149
|
#
|
150
150
|
|
151
151
|
def backward(*args)
|
152
|
-
[:backward, args]
|
152
|
+
@direct = [:backward, args]
|
153
153
|
end
|
154
154
|
|
155
155
|
##
|
@@ -215,10 +215,12 @@ module NativeQuery
|
|
215
215
|
|
216
216
|
protected
|
217
217
|
def _fix_where
|
218
|
-
NativeQuery::Query::fix_conditions(@where) do |
|
219
|
-
args
|
220
|
-
|
221
|
-
|
218
|
+
NativeQuery::Query::fix_conditions(@where) do |arg|
|
219
|
+
#p args
|
220
|
+
#args.each do |i|
|
221
|
+
# __fix_field(i)
|
222
|
+
#end
|
223
|
+
__fix_field(arg)
|
222
224
|
end
|
223
225
|
end
|
224
226
|
|
@@ -281,12 +283,12 @@ module NativeQuery
|
|
281
283
|
private
|
282
284
|
def __direct
|
283
285
|
|
284
|
-
if (@direct.first == :backward) and (@direct.second.array?)
|
286
|
+
if @direct.array? and (@direct.first == :backward) and (@direct.second.array?)
|
285
287
|
backward = true
|
286
288
|
direct = @direct.second
|
287
289
|
else
|
288
290
|
backward = false
|
289
|
-
direct =
|
291
|
+
direct = [ ]
|
290
292
|
end
|
291
293
|
|
292
294
|
##
|
data/lib/native-query/query.rb
CHANGED
@@ -383,10 +383,8 @@ module NativeQuery
|
|
383
383
|
|
384
384
|
protected
|
385
385
|
def _fix_where
|
386
|
-
Query::fix_conditions(@where) do |
|
387
|
-
|
388
|
-
__fix_field(i)
|
389
|
-
end
|
386
|
+
Query::fix_conditions(@where) do |arg|
|
387
|
+
__fix_field(arg)
|
390
388
|
end
|
391
389
|
end
|
392
390
|
|
@@ -396,10 +394,10 @@ module NativeQuery
|
|
396
394
|
|
397
395
|
protected
|
398
396
|
def _fix_having
|
399
|
-
Query::fix_conditions(@having) do |
|
400
|
-
args.each do |i|
|
401
|
-
__fix_field(
|
402
|
-
end
|
397
|
+
Query::fix_conditions(@having) do |arg|
|
398
|
+
#args.each do |i|
|
399
|
+
__fix_field(arg)
|
400
|
+
#end
|
403
401
|
end
|
404
402
|
end
|
405
403
|
|
@@ -410,19 +408,34 @@ module NativeQuery
|
|
410
408
|
|
411
409
|
def self.fix_conditions(where, &block)
|
412
410
|
where.map do |specification|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
411
|
+
|
412
|
+
if specification.array?
|
413
|
+
_new = specification.map do |item|
|
414
|
+
item.map_keys do |k|
|
415
|
+
if k.symbol?
|
416
|
+
block.call(k)
|
417
|
+
else
|
418
|
+
k
|
419
|
+
end
|
420
|
+
end
|
420
421
|
end
|
421
422
|
else
|
422
|
-
|
423
|
+
_new = specification
|
423
424
|
end
|
425
|
+
|
426
|
+
#if specification.hash?
|
427
|
+
# _new = specification.map_keys do |k|
|
428
|
+
# if k.symbol?
|
429
|
+
# block.call(k)
|
430
|
+
# else
|
431
|
+
# k
|
432
|
+
# end
|
433
|
+
# end
|
434
|
+
#else
|
435
|
+
# _new = specification
|
436
|
+
#end
|
424
437
|
|
425
|
-
|
438
|
+
_new # returns
|
426
439
|
end
|
427
440
|
end
|
428
441
|
|
data/native-query.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "native-query"
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Koz\u{e1}k"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-03-11"
|
13
13
|
s.email = "martinkozak@martinkozak.net"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -34,8 +34,8 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.homepage = "http://github.com/martinkozak/native-query"
|
35
35
|
s.licenses = ["MIT"]
|
36
36
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = "1.8.
|
38
|
-
s.summary = "Cool way how to speak with database server. It's ellegant
|
37
|
+
s.rubygems_version = "1.8.17"
|
38
|
+
s.summary = "Cool way how to speak with database server. It's ellegant DSL; the SQL query helper which works by similar way as Arel or another ORM selecting logic. But it's derived from Dibi database layer in its ideas, so it's much more simple and (of sure) much more KISS, readable and straightforward."
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
41
41
|
s.specification_version = 3
|
@@ -43,19 +43,19 @@ Gem::Specification.new do |s|
|
|
43
43
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
44
|
s.add_runtime_dependency(%q<fluent-query>, [">= 0.9.1"])
|
45
45
|
s.add_runtime_dependency(%q<hash-utils>, [">= 0.18.0"])
|
46
|
-
s.add_development_dependency(%q<bundler>, ["
|
47
|
-
s.add_development_dependency(%q<
|
46
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.13"])
|
47
|
+
s.add_development_dependency(%q<jeweler2>, [">= 2.0.0"])
|
48
48
|
else
|
49
49
|
s.add_dependency(%q<fluent-query>, [">= 0.9.1"])
|
50
50
|
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
51
|
-
s.add_dependency(%q<bundler>, ["
|
52
|
-
s.add_dependency(%q<
|
51
|
+
s.add_dependency(%q<bundler>, [">= 1.0.13"])
|
52
|
+
s.add_dependency(%q<jeweler2>, [">= 2.0.0"])
|
53
53
|
end
|
54
54
|
else
|
55
55
|
s.add_dependency(%q<fluent-query>, [">= 0.9.1"])
|
56
56
|
s.add_dependency(%q<hash-utils>, [">= 0.18.0"])
|
57
|
-
s.add_dependency(%q<bundler>, ["
|
58
|
-
s.add_dependency(%q<
|
57
|
+
s.add_dependency(%q<bundler>, [">= 1.0.13"])
|
58
|
+
s.add_dependency(%q<jeweler2>, [">= 2.0.0"])
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: native-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluent-query
|
16
|
-
requirement: &
|
16
|
+
requirement: &13489740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *13489740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hash-utils
|
27
|
-
requirement: &
|
27
|
+
requirement: &13489220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,29 +32,29 @@ dependencies:
|
|
32
32
|
version: 0.18.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *13489220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &13488340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.0.13
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *13488340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
48
|
+
name: jeweler2
|
49
|
+
requirement: &13487220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *13487220
|
58
58
|
description:
|
59
59
|
email: martinkozak@martinkozak.net
|
60
60
|
executables: []
|
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
segments:
|
94
94
|
- 0
|
95
|
-
hash: -
|
95
|
+
hash: -4245115407505943033
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
@@ -101,11 +101,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.8.
|
104
|
+
rubygems_version: 1.8.17
|
105
105
|
signing_key:
|
106
106
|
specification_version: 3
|
107
|
-
summary: Cool way how to speak with database server. It's ellegant
|
108
|
-
|
109
|
-
|
107
|
+
summary: Cool way how to speak with database server. It's ellegant DSL; the SQL query
|
108
|
+
helper which works by similar way as Arel or another ORM selecting logic. But it's
|
109
|
+
derived from Dibi database layer in its ideas, so it's much more simple and (of
|
110
110
|
sure) much more KISS, readable and straightforward.
|
111
111
|
test_files: []
|