monetdb 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MThkM2ZmNjgyZDMwNmMzZmVlYTc3ZTBhYzZmZjhhZGFmOGFlZWFlNg==
4
+ ZWY3ZDg1YzZlMDc5MDk4YTIyNWIwMmZlMjBhNzhmYTFhZGZiYjhhZg==
5
5
  data.tar.gz: !binary |-
6
- MjZiNTIxYTNmMzkyOTQzMjBkNGQxZGY3MWJhMGQ0MjI1MGE5NWRiZg==
6
+ NjJiZWNiZDM2MjA5Zjg2ZmNkNGU1YTllNmU2YjA5MjkwYjNjNWEzMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Njg2ZGY4ZjQxZWVhMmFhYjkxNDQ2NWJlYTM4ZmE1NDExZmIxYTJhNTRhYmQw
10
- ZDUzZDFiY2ViMzRhNTk0MzkxZDI2NmZiOWE3NTM2NWM0ZWEyYTI5MGMxMGRh
11
- MTc3MjcxNDVjNWY5OWNiYjY2OTEzNzA4ZGNjOWY5Nzg4MmUyYjI=
9
+ NmEyNTZjNDE2NWQ5ZjIyOTMyZTNjM2NiOGQ0MWMwMjBkMjFjYTdkZWViZDUx
10
+ ZGVjNzM1OWQ1YjFiNGZkNDVkYzUyYTlkOTZkODNlMDhhNjQyMjk4NTJlMDUx
11
+ YWM1ZGYzMTdiMTlhNThmNGYzMjU0OThlY2MzYzYwZjAwZjFjZWU=
12
12
  data.tar.gz: !binary |-
13
- NGU0NDk0MWFkNTMzYjU0MTllZGNiOWFiMmRlZWVkY2EzM2EzMTQwZDM1MDFj
14
- NTc2NjZmZWExMDU5ODhiZTI5ODVkMGJmNmQ2NjQ5Yjk1NGI1NWZmZTg1NzQy
15
- MTQ1NzI1ZDllYjExZWU3NzZjNGVlZjY4YTRiY2U4Mzg4MGUwY2E=
13
+ ZjY3NTY2ZDMzYzAzMGRhNTU4MTM2YzEwZTg2OWFiZGY1MDU1ZGZjMzUwMWVi
14
+ MTMwNThmMTI1N2FlYWQ2OGNhZjI4ZmQ5MWYzZjNiYTMxMjEzYTk3YWE2NDQx
15
+ ZGNiOTNhN2JmOGUzOTRjODY1NGVhY2EyYzNjZDBjOTc4NzQ3ZTM=
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = MonetDB CHANGELOG
2
2
 
3
+ == Version 0.1.3 (October 8, 2014)
4
+
5
+ * Corrected MonetDB#select_rows (was not fetching entire result set)
6
+
3
7
  == Version 0.1.2 (October 6, 2014)
4
8
 
5
9
  * Simplified MonetDB#select_rows gaining performance receiving the query result set
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- monetdb (0.1.2)
4
+ monetdb (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -1,7 +1,7 @@
1
1
  class MonetDB
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 2
4
+ TINY = 3
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
data/lib/monetdb.rb CHANGED
@@ -188,43 +188,49 @@ class MonetDB
188
188
 
189
189
  start = Time.now
190
190
  @connection.send(data.send(:format_query, qry))
191
- result_set = @connection.receive.split("\n")
192
- log :info, "\n SQL (#{((Time.now - start) * 1000).round(1)}ms) #{qry}"
191
+ response = @connection.receive.split("\n")
193
192
 
194
- if (row = result_set[0]).chr == MSG_INFO
193
+ if (row = response[0]).chr == MSG_INFO
195
194
  raise QueryError, row
196
195
  end
197
196
 
198
- record_set = result_set.select{|x| [MSG_SCHEMA_HEADER, MSG_QUERY].include? x[0]}.compact
199
- data.send :receive_record_set, record_set.join("\n")
200
-
201
- if data.instance_variable_get(:@action) == Q_TABLE
202
- header = data.send :parse_header_table, data.instance_variable_get(:@header)
197
+ headers, rows = response.partition{|x| [MSG_SCHEMA_HEADER, MSG_QUERY].include? x[0]}
198
+ data.send :receive_record_set, headers.join("\n")
199
+ query_header = data.send :parse_header_query, headers.shift
200
+ table_header = data.send :parse_header_table, headers
201
+ rows = rows.join("\n")
202
+
203
+ row_count = rows.split("\t]\n").size
204
+ while row_count < query_header["rows"].to_i
205
+ received = @connection.receive
206
+ row_count += received.scan("\t]\n").size
207
+ rows << received
203
208
  end
209
+ rows = rows.split("\t]\n")
204
210
 
205
- column_types = header["columns_type"]
206
- types = header["columns_name"].collect{|x| column_types[x]}
207
-
208
- result_set.collect do |x|
209
- if x[0] == MSG_TUPLE
210
- row, values = [], x[1..-2].split(",\t")
211
- values.each_with_index do |value, index|
212
- row << begin
213
- unless value.strip == "NULL"
214
- case types[index]
215
- when "bigint", "int"
216
- value.to_i
217
- when "double"
218
- value.to_f
219
- else
220
- value.strip.gsub(/(^"|"$|\\|\")/, "").force_encoding("UTF-8")
221
- end
211
+ log :info, "\n SQL (#{((Time.now - start) * 1000).round(1)}ms) #{qry}"
212
+
213
+ column_types = table_header["columns_type"]
214
+ types = table_header["columns_name"].collect{|x| column_types[x]}
215
+
216
+ rows.collect do |row|
217
+ parsed, values = [], row.gsub(/^\[\s*/, "").split(",\t")
218
+ values.each_with_index do |value, index|
219
+ parsed << begin
220
+ unless value.strip == "NULL"
221
+ case types[index]
222
+ when "bigint", "int"
223
+ value.to_i
224
+ when "double"
225
+ value.to_f
226
+ else
227
+ value.strip.gsub(/(^"|"$|\\|\")/, "").force_encoding("UTF-8")
222
228
  end
223
229
  end
224
230
  end
225
- row
226
231
  end
227
- end.compact
232
+ parsed
233
+ end
228
234
  end
229
235
 
230
236
  # Returns whether a "connection" object exists.
@@ -5,7 +5,7 @@ module Unit
5
5
 
6
6
  describe MonetDB do
7
7
  it "has the current version" do
8
- version = File.read path("VERSION")
8
+ version = File.read(path("VERSION")).strip
9
9
  assert_equal version, MonetDB::VERSION
10
10
  assert File.read(path "CHANGELOG.rdoc").include?("Version #{version}")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monetdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Engel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake