conceptql 0.0.8 → 0.0.9

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: 1553225376a8cfa089b1451b278e39414e304459
4
- data.tar.gz: 39c0e0ffd0482fc30f63c1ee4096d47206e6ec9e
3
+ metadata.gz: 5750de5f196ce44a4f679c8c28613bd7476824a1
4
+ data.tar.gz: 66c448563f934f4a64e5a030e343eceef5a691aa
5
5
  SHA512:
6
- metadata.gz: befaf475a31844c47f6635875b7e705450eb54f8e63cacbcc0ddd4849f6ddf9cfbcae4dcc67a57a18ad657d73ce0fe8674791dcfedd36ea4287b724c0edd102e
7
- data.tar.gz: 7341272d22a347cc48a06d722f0400b95a7fda8e4d9ee8317deb52be85f5b62d3626e2ca316b7a279ae6a6f2358fdfd47676134e11acfefd502f35a7a9eb2136
6
+ metadata.gz: 286d1046bab811f33f2a83d0066cc608a2d205c46beb188bc3cd9227db36a4cad2b23bbc0ee968ddb49ba34394800bd2d312661787d77bb8467f6bb80a13d09e
7
+ data.tar.gz: b6978826328af7dd3d1cc3af40447a20ccd3afe83074c0ecbce3528f56dbc6cb48621131e784444194a050f10549dc523dccd0a9228a453892facb9faa099bb1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 0.0.9 - 2014-09-03
5
+
6
+ ### Added
7
+ - Support for MSSQL (SQL Server).
8
+
9
+ ### Deprecated
10
+ - Nothing.
11
+
12
+ ### Removed
13
+ - Nothing.
14
+
15
+ ### Fixed
16
+ - Removed debug output from Node#namify
17
+
18
+
4
19
  ## 0.0.8 - 2014-08-28
5
20
 
6
21
  ### Added
@@ -12,7 +12,7 @@ module ConceptQL
12
12
  db.from(:person)
13
13
  .select_append(Sequel.cast_string('person').as(:criterion_type))
14
14
  .select_append(Sequel.expr(:person_id).as(:criterion_id))
15
- .select_append(Sequel.lit('date ?', start_date(db)).as(:start_date), Sequel.lit('date ?', end_date(db)).as(:end_date)).from_self
15
+ .select_append(start_date(db).as(:start_date), end_date(db).as(:end_date)).from_self
16
16
  end
17
17
 
18
18
  def types
@@ -33,7 +33,8 @@ module ConceptQL
33
33
  def date_from(db, str)
34
34
  return db.from(:visit_occurrence).select { min(:start_date) } if str.upcase == 'START'
35
35
  return db.from(:visit_occurrence).select { max(:end_date) } if str.upcase == 'END'
36
- return str
36
+ return Sequel.lit('CONVERT(DATETIME, ?)', str) if db.database_type == :mssql
37
+ return Sequel.lit('date ?', str)
37
38
  end
38
39
  end
39
40
  end
@@ -133,10 +133,13 @@ module ConceptQL
133
133
  end
134
134
  strings = strings.zip(['-'] * (symbols.length - 1)).flatten.compact
135
135
  concatted_strings = Sequel.join(strings)
136
- unless query.db.database_type == :oracle
137
- Sequel.cast(concatted_strings, Date)
138
- else
136
+ case query.db.database_type
137
+ when :oracle
139
138
  Sequel.function(:to_date, concatted_strings, 'YYYY-MM-DD')
139
+ when :mssql
140
+ Sequel.lit('CONVERT(DATETIME, ?)', concatted_strings)
141
+ else
142
+ Sequel.cast(concatted_strings, Date)
140
143
  end
141
144
  end
142
145
 
@@ -154,7 +157,7 @@ module ConceptQL
154
157
 
155
158
  def namify(name)
156
159
  digest = Zlib.crc32 name
157
- ('_' + digest.to_s).tap {|s| puts s}.to_sym
160
+ ('_' + digest.to_s).to_sym
158
161
  end
159
162
  end
160
163
  end
@@ -1,3 +1,3 @@
1
1
  module ConceptQL
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -22,11 +22,11 @@ describe ConceptQL::Nodes::DateRange do
22
22
  end
23
23
 
24
24
  it 'handles START as day before first recorded visit_occurrence' do
25
- ConceptQL::Nodes::DateRange.new(start: 'START', end: '2010-03-20').query(Sequel.mock).sql.must_equal("SELECT * FROM (SELECT *, CAST('person' AS varchar(255)) AS criterion_type, person_id AS criterion_id, date (SELECT min(start_date) FROM visit_occurrence) AS start_date, date '2010-03-20' AS end_date FROM person) AS t1")
25
+ ConceptQL::Nodes::DateRange.new(start: 'START', end: '2010-03-20').query(Sequel.mock).sql.must_equal("SELECT * FROM (SELECT *, CAST('person' AS varchar(255)) AS criterion_type, person_id AS criterion_id, (SELECT min(start_date) FROM visit_occurrence) AS start_date, date '2010-03-20' AS end_date FROM person) AS t1")
26
26
  end
27
27
 
28
28
  it 'handles END as 2010-12-31' do
29
- ConceptQL::Nodes::DateRange.new(start: '2004-12-13', end: 'END').query(Sequel.mock).sql.must_equal("SELECT * FROM (SELECT *, CAST('person' AS varchar(255)) AS criterion_type, person_id AS criterion_id, date '2004-12-13' AS start_date, date (SELECT max(end_date) FROM visit_occurrence) AS end_date FROM person) AS t1")
29
+ ConceptQL::Nodes::DateRange.new(start: '2004-12-13', end: 'END').query(Sequel.mock).sql.must_equal("SELECT * FROM (SELECT *, CAST('person' AS varchar(255)) AS criterion_type, person_id AS criterion_id, date '2004-12-13' AS start_date, (SELECT max(end_date) FROM visit_occurrence) AS end_date FROM person) AS t1")
30
30
  end
31
31
  end
32
32
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conceptql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Duryea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport