fluent-query-sql 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +26 -0
- data/LICENSE.txt +20 -0
- data/README.md +33 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/fluent-query-sql.gemspec +74 -0
- data/lib/fluent-query/drivers/shared/tokens/sql.rb +128 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/delete.rb +58 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/from.rb +103 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/groupby.rb +117 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/having.rb +100 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/insert.rb +60 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/join.rb +98 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/orderby.rb +148 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/select.rb +147 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/set.rb +94 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/truncate.rb +59 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/union.rb +65 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/update.rb +58 -0
- data/lib/fluent-query/drivers/shared/tokens/sql/where.rb +100 -0
- data/lib/fluent-query/drivers/sql.rb +559 -0
- data/lib/fluent-query/queries/sql.rb +54 -0
- metadata +135 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "fluent-query/query"
|
3
|
+
|
4
|
+
module FluentQuery
|
5
|
+
module Queries
|
6
|
+
|
7
|
+
##
|
8
|
+
# Represents SQL query.
|
9
|
+
# It ensures calls occupied by Ruby. (For example 'select()'.)
|
10
|
+
#
|
11
|
+
|
12
|
+
class SQL < FluentQuery::Query
|
13
|
+
|
14
|
+
NONALPHA_REPLACER = /[^a-zA-Z0-9]/
|
15
|
+
|
16
|
+
##
|
17
|
+
# Catches missing methods calls. Converts them to tokens.
|
18
|
+
# In token names starting with '_' skips non-alfanumeric characters.
|
19
|
+
#
|
20
|
+
|
21
|
+
def method_missing(sym, *args, &block)
|
22
|
+
# If name starts with underscore, strips non-alfa numeric characters out
|
23
|
+
sym = sym.to_s
|
24
|
+
|
25
|
+
if sym[0].ord == 95 # "_"
|
26
|
+
sym.gsub!(self.class::NONALPHA_REPLACER, "")
|
27
|
+
end
|
28
|
+
|
29
|
+
return super(sym.to_sym, *args, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Ensures processor call of parent classes which isn't
|
34
|
+
# handled well from unknown reason via extending and
|
35
|
+
# falls to method_missing(...).
|
36
|
+
#
|
37
|
+
|
38
|
+
def processor
|
39
|
+
super()
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Ensures 'select()' call occupied by Ruby.
|
44
|
+
#
|
45
|
+
|
46
|
+
def select(*args)
|
47
|
+
self.push_token(:select, args)
|
48
|
+
return self
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-query-sql
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.9.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Martin Koz\xC3\xA1k"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-07-14 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hash-utils
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.18.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: abstract
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: fluent-query
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.9.0
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: bundler
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.0.13
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: jeweler
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 1.6.0
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *id005
|
70
|
+
description:
|
71
|
+
email: martinkozak@martinkozak.net
|
72
|
+
executables: []
|
73
|
+
|
74
|
+
extensions: []
|
75
|
+
|
76
|
+
extra_rdoc_files:
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
79
|
+
files:
|
80
|
+
- .document
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- VERSION
|
87
|
+
- fluent-query-sql.gemspec
|
88
|
+
- lib/fluent-query/drivers/shared/tokens/sql.rb
|
89
|
+
- lib/fluent-query/drivers/shared/tokens/sql/delete.rb
|
90
|
+
- lib/fluent-query/drivers/shared/tokens/sql/from.rb
|
91
|
+
- lib/fluent-query/drivers/shared/tokens/sql/groupby.rb
|
92
|
+
- lib/fluent-query/drivers/shared/tokens/sql/having.rb
|
93
|
+
- lib/fluent-query/drivers/shared/tokens/sql/insert.rb
|
94
|
+
- lib/fluent-query/drivers/shared/tokens/sql/join.rb
|
95
|
+
- lib/fluent-query/drivers/shared/tokens/sql/orderby.rb
|
96
|
+
- lib/fluent-query/drivers/shared/tokens/sql/select.rb
|
97
|
+
- lib/fluent-query/drivers/shared/tokens/sql/set.rb
|
98
|
+
- lib/fluent-query/drivers/shared/tokens/sql/truncate.rb
|
99
|
+
- lib/fluent-query/drivers/shared/tokens/sql/union.rb
|
100
|
+
- lib/fluent-query/drivers/shared/tokens/sql/update.rb
|
101
|
+
- lib/fluent-query/drivers/shared/tokens/sql/where.rb
|
102
|
+
- lib/fluent-query/drivers/sql.rb
|
103
|
+
- lib/fluent-query/queries/sql.rb
|
104
|
+
homepage: http://github.com/martinkozak/fluent-query-sql
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 765682937217739851
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: "0"
|
127
|
+
requirements: []
|
128
|
+
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 1.8.5
|
131
|
+
signing_key:
|
132
|
+
specification_version: 3
|
133
|
+
summary: Generic SQL support for the Fluent Query. Fluent Query is cool way how to write SQL queries in Ruby. Contains base libraries used by specific SQL driver.
|
134
|
+
test_files: []
|
135
|
+
|