monetdb 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.rdoc +4 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/monetdb.rb +36 -17
- data/lib/monetdb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MThkM2ZmNjgyZDMwNmMzZmVlYTc3ZTBhYzZmZjhhZGFmOGFlZWFlNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjZiNTIxYTNmMzkyOTQzMjBkNGQxZGY3MWJhMGQ0MjI1MGE5NWRiZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Njg2ZGY4ZjQxZWVhMmFhYjkxNDQ2NWJlYTM4ZmE1NDExZmIxYTJhNTRhYmQw
|
10
|
+
ZDUzZDFiY2ViMzRhNTk0MzkxZDI2NmZiOWE3NTM2NWM0ZWEyYTI5MGMxMGRh
|
11
|
+
MTc3MjcxNDVjNWY5OWNiYjY2OTEzNzA4ZGNjOWY5Nzg4MmUyYjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGU0NDk0MWFkNTMzYjU0MTllZGNiOWFiMmRlZWVkY2EzM2EzMTQwZDM1MDFj
|
14
|
+
NTc2NjZmZWExMDU5ODhiZTI5ODVkMGJmNmQ2NjQ5Yjk1NGI1NWZmZTg1NzQy
|
15
|
+
MTQ1NzI1ZDllYjExZWU3NzZjNGVlZjY4YTRiY2U4Mzg4MGUwY2E=
|
data/CHANGELOG.rdoc
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/monetdb.rb
CHANGED
@@ -183,29 +183,48 @@ class MonetDB
|
|
183
183
|
#
|
184
184
|
# Returns an array of arrays with casted values.
|
185
185
|
def select_rows(qry)
|
186
|
+
return if @connection.nil?
|
187
|
+
data = MonetDB::Data.new @connection
|
188
|
+
|
186
189
|
start = Time.now
|
187
|
-
data
|
190
|
+
@connection.send(data.send(:format_query, qry))
|
191
|
+
result_set = @connection.receive.split("\n")
|
188
192
|
log :info, "\n [1m[35mSQL (#{((Time.now - start) * 1000).round(1)}ms)[0m #{qry}[0m"
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
193
|
+
|
194
|
+
if (row = result_set[0]).chr == MSG_INFO
|
195
|
+
raise QueryError, row
|
196
|
+
end
|
197
|
+
|
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)
|
203
|
+
end
|
204
|
+
|
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
|
203
222
|
end
|
204
223
|
end
|
205
224
|
end
|
225
|
+
row
|
206
226
|
end
|
207
|
-
|
208
|
-
end
|
227
|
+
end.compact
|
209
228
|
end
|
210
229
|
|
211
230
|
# Returns whether a "connection" object exists.
|
data/lib/monetdb/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|