seaquel 0.1

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.
@@ -0,0 +1,53 @@
1
+
2
+ require 'spec_helper'
3
+
4
+ describe Seaquel::AST::Column do
5
+ include Seaquel
6
+
7
+ it 'allows comparison ">"' do
8
+ select.where(column('foo').gt(1)).generates <<-SQL
9
+ SELECT * WHERE "foo">1
10
+ SQL
11
+ end
12
+ it 'allows comparison ">="' do
13
+ select.where(column('foo').gteq(1)).generates <<-SQL
14
+ SELECT * WHERE "foo">=1
15
+ SQL
16
+ end
17
+ it 'allows comparison "<"' do
18
+ select.where(column('foo').lt(1)).generates <<-SQL
19
+ SELECT * WHERE "foo"<1
20
+ SQL
21
+ end
22
+ it 'allows comparison "<="' do
23
+ select.where(column('foo').lteq(1)).generates <<-SQL
24
+ SELECT * WHERE "foo"<=1
25
+ SQL
26
+ end
27
+ it 'allows comparison "!="' do
28
+ select.where(column('foo').noteq(1)).generates <<-SQL
29
+ SELECT * WHERE "foo"!=1
30
+ SQL
31
+ end
32
+ it 'allows comparison "IS"' do
33
+ select.where(column('foo').is(1)).generates <<-SQL
34
+ SELECT * WHERE "foo" IS 1
35
+ SQL
36
+ end
37
+ it 'allows comparison "IS NOT"' do
38
+ select.where(column('foo').isnot(1)).generates <<-SQL
39
+ SELECT * WHERE "foo" IS NOT 1
40
+ SQL
41
+ end
42
+
43
+ it 'allows ASC modifier for use in ORDER BY' do
44
+ select.order_by(column('foo').asc).generates <<-SQL
45
+ SELECT * ORDER BY "foo" ASC
46
+ SQL
47
+ end
48
+ it 'allows DESC modifier for use in ORDER BY' do
49
+ select.order_by(column('foo').desc).generates <<-SQL
50
+ SELECT * ORDER BY "foo" DESC
51
+ SQL
52
+ end
53
+ end
@@ -0,0 +1,42 @@
1
+
2
+ require 'spec_helper'
3
+
4
+ describe Seaquel::AST::Immediate do
5
+ include Seaquel
6
+
7
+ it 'allows comparison ">"' do
8
+ select.where(immediate(2).gt(1)).generates <<-SQL
9
+ SELECT * WHERE 2>1
10
+ SQL
11
+ end
12
+ it 'allows comparison ">="' do
13
+ select.where(immediate(2).gteq(1)).generates <<-SQL
14
+ SELECT * WHERE 2>=1
15
+ SQL
16
+ end
17
+ it 'allows comparison "<"' do
18
+ select.where(immediate(2).lt(1)).generates <<-SQL
19
+ SELECT * WHERE 2<1
20
+ SQL
21
+ end
22
+ it 'allows comparison "<="' do
23
+ select.where(immediate(2).lteq(1)).generates <<-SQL
24
+ SELECT * WHERE 2<=1
25
+ SQL
26
+ end
27
+ it 'allows comparison "!="' do
28
+ select.where(immediate(2).noteq(1)).generates <<-SQL
29
+ SELECT * WHERE 2!=1
30
+ SQL
31
+ end
32
+ it 'allows comparison "IS"' do
33
+ select.where(immediate(2).is(1)).generates <<-SQL
34
+ SELECT * WHERE 2 IS 1
35
+ SQL
36
+ end
37
+ it 'allows comparison "IS NOT"' do
38
+ select.where(immediate(2).isnot(1)).generates <<-SQL
39
+ SELECT * WHERE 2 IS NOT 1
40
+ SQL
41
+ end
42
+ end
@@ -0,0 +1,14 @@
1
+
2
+ require 'seaquel'
3
+ require 'ae'
4
+
5
+ RSpec.configure do |config|
6
+ end
7
+
8
+ module GeneratesHelper
9
+ def generates sql
10
+ self.to_sql.assert == sql.strip
11
+ end
12
+ end
13
+
14
+ Seaquel::AST::Node.send(:include, GeneratesHelper)
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: seaquel
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Kaspar Schiess
8
+ - Florian Hanke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-02-18 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: " Generates SQL from Ruby code. \n"
15
+ email: kaspar.schiess@technologyastronauts.ch
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - FEATURES
21
+ - LICENSE
22
+ - README
23
+ - lib/seaquel.rb
24
+ - lib/seaquel/ast.rb
25
+ - lib/seaquel/ast/alias.rb
26
+ - lib/seaquel/ast/assign.rb
27
+ - lib/seaquel/ast/bin_op.rb
28
+ - lib/seaquel/ast/binding.rb
29
+ - lib/seaquel/ast/column.rb
30
+ - lib/seaquel/ast/column_list.rb
31
+ - lib/seaquel/ast/expression.rb
32
+ - lib/seaquel/ast/funcall.rb
33
+ - lib/seaquel/ast/immediate.rb
34
+ - lib/seaquel/ast/join_op.rb
35
+ - lib/seaquel/ast/list.rb
36
+ - lib/seaquel/ast/literal.rb
37
+ - lib/seaquel/ast/node.rb
38
+ - lib/seaquel/ast/order.rb
39
+ - lib/seaquel/ast/table.rb
40
+ - lib/seaquel/ast/table_alias.rb
41
+ - lib/seaquel/bit.rb
42
+ - lib/seaquel/expression_converter.rb
43
+ - lib/seaquel/generator.rb
44
+ - lib/seaquel/module.rb
45
+ - lib/seaquel/quoter.rb
46
+ - lib/seaquel/statement.rb
47
+ - lib/seaquel/statement/join.rb
48
+ - lib/seaquel/statement_gatherer.rb
49
+ - qed/applique/ae.rb
50
+ - qed/applique/sql.rb
51
+ - qed/generation.md
52
+ - spec/functional/delete_spec.rb
53
+ - spec/functional/insert_spec.rb
54
+ - spec/functional/select_spec.rb
55
+ - spec/functional/update_spec.rb
56
+ - spec/lib/ast/column_spec.rb
57
+ - spec/lib/ast/immediate_spec.rb
58
+ - spec/spec_helper.rb
59
+ homepage: https://bitbucket.org/technologyastronauts/seaquel
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: A DSL for SQL.
83
+ test_files:
84
+ - qed/applique/ae.rb
85
+ - qed/applique/sql.rb
86
+ - qed/generation.md
87
+ - spec/functional/delete_spec.rb
88
+ - spec/functional/insert_spec.rb
89
+ - spec/functional/select_spec.rb
90
+ - spec/functional/update_spec.rb
91
+ - spec/lib/ast/column_spec.rb
92
+ - spec/lib/ast/immediate_spec.rb
93
+ - spec/spec_helper.rb
94
+ has_rdoc: