adacosta-labilerecord 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -1
- data/README.rdoc +2 -1
- data/lib/labilerecord.rb +1 -5
- metadata +1 -1
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= labilerecord
|
2
2
|
|
3
|
-
*
|
3
|
+
* http://github.com/adacosta/labilerecord
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -12,6 +12,7 @@
|
|
12
12
|
* Access field types
|
13
13
|
* Access types which ActiveRecord won't (e.g. _int4)
|
14
14
|
* Easy to use on tables, views, and functions
|
15
|
+
* Fast - no ruby type conversion on values from connection adapter.
|
15
16
|
|
16
17
|
== SYNOPSIS:
|
17
18
|
|
data/lib/labilerecord.rb
CHANGED
@@ -18,7 +18,6 @@ module LabileRecord
|
|
18
18
|
end
|
19
19
|
|
20
20
|
class Query < Array
|
21
|
-
# attr_reader :rows
|
22
21
|
attr_reader :result
|
23
22
|
attr_reader :fields
|
24
23
|
attr_reader :string
|
@@ -31,23 +30,20 @@ module LabileRecord
|
|
31
30
|
@result = connection.exec(@string)
|
32
31
|
parse_fields
|
33
32
|
parse_result_data
|
34
|
-
push @rows[0]
|
35
33
|
end
|
36
34
|
|
37
35
|
def parse_result_data
|
38
36
|
columns = @result.fields
|
39
37
|
row_count = @result.num_tuples
|
40
38
|
field_names = @fields.map {|field| field.name}
|
41
|
-
rows = []
|
42
39
|
# iterate rows
|
43
40
|
(0..(row_count-1)).each do |row_index|
|
44
41
|
row = Row.new(field_names)
|
45
42
|
columns.each do |column_name|
|
46
43
|
row << @result[row_index][column_name]
|
47
44
|
end
|
48
|
-
|
45
|
+
push row
|
49
46
|
end
|
50
|
-
@rows = rows
|
51
47
|
end
|
52
48
|
|
53
49
|
def parse_fields
|