orientdb 0.0.14-jruby → 0.0.15-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/orientdb/sql/common.rb +30 -0
- data/lib/orientdb/sql/ext.rb +4 -0
- data/orientdb.gemspec +2 -3
- data/spec/database_spec.rb +3 -3
- data/spec/sql_spec.rb +15 -0
- metadata +2 -3
- data/lib/orientdb/sql_query.rb +0 -0
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.15
|
data/lib/orientdb/sql/common.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
module OrientDB::SQL
|
2
|
+
|
2
3
|
module UtilsMixin
|
3
4
|
|
4
5
|
def select_single_string(arg)
|
@@ -19,6 +20,10 @@ module OrientDB::SQL
|
|
19
20
|
"[" + value.map { |x| quote(x) }.join(", ") + "]"
|
20
21
|
when Regexp
|
21
22
|
quote_regexp(value)
|
23
|
+
when OrientDB::SQL::LiteralExpression
|
24
|
+
value.to_s
|
25
|
+
else
|
26
|
+
quote value.to_s
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
@@ -170,6 +175,24 @@ module OrientDB::SQL
|
|
170
175
|
|
171
176
|
end
|
172
177
|
|
178
|
+
class LiteralExpression
|
179
|
+
|
180
|
+
def initialize(value)
|
181
|
+
@value = value.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
def to_s
|
185
|
+
@value
|
186
|
+
end
|
187
|
+
|
188
|
+
include Comparable
|
189
|
+
|
190
|
+
def <=>(other)
|
191
|
+
to_s <=> other.to_s
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
173
196
|
class ConditionExpression
|
174
197
|
|
175
198
|
attr_reader :conditions
|
@@ -213,5 +236,12 @@ module OrientDB::SQL
|
|
213
236
|
def to_s
|
214
237
|
"#{type} #{parens_conditions_str} "
|
215
238
|
end
|
239
|
+
|
240
|
+
include Comparable
|
241
|
+
|
242
|
+
def <=>(other)
|
243
|
+
to_s <=> other.to_s
|
244
|
+
end
|
216
245
|
end
|
246
|
+
|
217
247
|
end
|
data/lib/orientdb/sql/ext.rb
CHANGED
data/orientdb.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{orientdb}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.15"
|
9
9
|
s.platform = %q{jruby}
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Adrian Madrid"]
|
13
|
-
s.date = %q{2011-01-
|
13
|
+
s.date = %q{2011-01-26}
|
14
14
|
s.default_executable = %q{orientdb_console}
|
15
15
|
s.description = %q{Simple JRuby wrapper for the OrientDB.}
|
16
16
|
s.email = ["aemadrid@gmail.com"]
|
@@ -51,7 +51,6 @@ Gem::Specification.new do |s|
|
|
51
51
|
"lib/orientdb/sql/insert.rb",
|
52
52
|
"lib/orientdb/sql/query.rb",
|
53
53
|
"lib/orientdb/sql/update.rb",
|
54
|
-
"lib/orientdb/sql_query.rb",
|
55
54
|
"lib/orientdb/storage.rb",
|
56
55
|
"lib/orientdb/user.rb",
|
57
56
|
"lib/orientdb/version.rb",
|
data/spec/database_spec.rb
CHANGED
@@ -9,14 +9,14 @@ describe "OrientDB" do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should create a valid simple table" do
|
12
|
-
exp_class = "#<OrientDB::OClass:person name
|
12
|
+
exp_class = "#<OrientDB::OClass:person name=STRING>"
|
13
13
|
exp_props = ["#<OrientDB::Propery:name type=string indexed=false mandatory=false not_null=false>"]
|
14
14
|
@person_class.to_s.should == exp_class
|
15
15
|
@person_class.properties.map { |x| x.to_s }.should == exp_props
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should create a valid simple descendant table" do
|
19
|
-
exp_class = "#<OrientDB::OClass:customer super=person tab
|
19
|
+
exp_class = "#<OrientDB::OClass:customer super=person tab=FLOAT name=STRING>"
|
20
20
|
exp_props = [
|
21
21
|
"#<OrientDB::Propery:tab type=decimal indexed=false mandatory=false not_null=false>",
|
22
22
|
"#<OrientDB::Propery:name type=string indexed=false mandatory=false not_null=false>"
|
@@ -26,7 +26,7 @@ describe "OrientDB" do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should create a complex table" do
|
29
|
-
exp_class = "#<OrientDB::OClass:invoice number
|
29
|
+
exp_class = "#<OrientDB::OClass:invoice number=INTEGER(idx) customer=LINK sold_on=DATE total=FLOAT lines=LINKLIST>"
|
30
30
|
exp_props = [
|
31
31
|
"#<OrientDB::Propery:number type=int indexed=true mandatory=true not_null=false>",
|
32
32
|
"#<OrientDB::Propery:customer type=link indexed=false mandatory=false not_null=true>",
|
data/spec/sql_spec.rb
CHANGED
@@ -41,6 +41,13 @@ describe "OrientDB" do
|
|
41
41
|
OrientDB::SQL::Query.quote(:@size).should == "@size"
|
42
42
|
OrientDB::SQL::Query.quote(:@type).should == "@type"
|
43
43
|
end
|
44
|
+
|
45
|
+
it "should quote literal_expressions properly" do
|
46
|
+
value = OrientDB::SQL::LiteralExpression.new "@this"
|
47
|
+
OrientDB::SQL::Query.quote(:@this).should == "@this"
|
48
|
+
value = OrientDB::SQL::LiteralExpression.new :@this
|
49
|
+
OrientDB::SQL::Query.quote(:@this).should == "@this"
|
50
|
+
end
|
44
51
|
end
|
45
52
|
|
46
53
|
describe "select_single_string" do
|
@@ -342,6 +349,10 @@ describe "OrientDB" do
|
|
342
349
|
end
|
343
350
|
|
344
351
|
describe "Conditional" do
|
352
|
+
it "should work" do
|
353
|
+
:name.lit.should == OrientDB::SQL::LiteralExpression.new("name")
|
354
|
+
end
|
355
|
+
|
345
356
|
it "#like should work" do
|
346
357
|
:name.like("test%").should == "name LIKE 'test%'"
|
347
358
|
end
|
@@ -524,6 +535,10 @@ describe "OrientDB" do
|
|
524
535
|
end
|
525
536
|
|
526
537
|
describe "Conditional" do
|
538
|
+
it "should work" do
|
539
|
+
'name'.lit.should == OrientDB::SQL::LiteralExpression.new("name")
|
540
|
+
end
|
541
|
+
|
527
542
|
it "#like should work" do
|
528
543
|
'name'.like("test%").should == "name LIKE 'test%'"
|
529
544
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: orientdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.15
|
6
6
|
platform: jruby
|
7
7
|
authors:
|
8
8
|
- Adrian Madrid
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-01-
|
13
|
+
date: 2011-01-26 00:00:00 -07:00
|
14
14
|
default_executable: orientdb_console
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- lib/orientdb/sql/insert.rb
|
78
78
|
- lib/orientdb/sql/query.rb
|
79
79
|
- lib/orientdb/sql/update.rb
|
80
|
-
- lib/orientdb/sql_query.rb
|
81
80
|
- lib/orientdb/storage.rb
|
82
81
|
- lib/orientdb/user.rb
|
83
82
|
- lib/orientdb/version.rb
|
data/lib/orientdb/sql_query.rb
DELETED
File without changes
|