adacosta-labilerecord 0.0.3 → 0.0.4
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 +6 -4
- data/lib/labilerecord.rb +4 -3
- metadata +2 -2
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
* Simple data access for dynamic data sets through postgres with ruby
|
8
8
|
|
9
|
-
== FEATURES
|
9
|
+
== FEATURES:
|
10
10
|
|
11
11
|
* Access data by row[x].column
|
12
12
|
* Access field types
|
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
== SYNOPSIS:
|
17
17
|
|
18
|
+
require 'rubygems'
|
18
19
|
require 'labilerecord'
|
19
20
|
|
20
21
|
LabileRecord::Base.connection = {:dbname => 'postgres', :user => user,
|
@@ -24,11 +25,12 @@
|
|
24
25
|
# execute the query
|
25
26
|
databases.exec!
|
26
27
|
# inspect rows
|
27
|
-
puts databases.
|
28
|
+
puts databases.inspect
|
28
29
|
# inspect fields (columns)
|
29
30
|
puts databases.fields.inspect
|
30
31
|
# inspect specific row and column of data set
|
31
|
-
|
32
|
+
# datname - being a column returned by the query
|
33
|
+
puts datases[0].datname
|
32
34
|
|
33
35
|
== REQUIREMENTS:
|
34
36
|
|
@@ -36,7 +38,7 @@
|
|
36
38
|
|
37
39
|
== INSTALL:
|
38
40
|
|
39
|
-
gem sources -a http://gems.github.com
|
41
|
+
sudo gem sources -a http://gems.github.com
|
40
42
|
sudo gem install adacosta-labilerecord
|
41
43
|
|
42
44
|
== LICENSE:
|
data/lib/labilerecord.rb
CHANGED
@@ -17,8 +17,8 @@ module LabileRecord
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
class Query <
|
21
|
-
attr_reader :rows
|
20
|
+
class Query < Array
|
21
|
+
# attr_reader :rows
|
22
22
|
attr_reader :result
|
23
23
|
attr_reader :fields
|
24
24
|
attr_reader :string
|
@@ -31,6 +31,7 @@ module LabileRecord
|
|
31
31
|
@result = connection.exec(@string)
|
32
32
|
parse_fields
|
33
33
|
parse_result_data
|
34
|
+
push @rows[0]
|
34
35
|
end
|
35
36
|
|
36
37
|
def parse_result_data
|
@@ -62,7 +63,7 @@ module LabileRecord
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def connection
|
65
|
-
|
66
|
+
LabileRecord::Base.connection
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adacosta-labilerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Da Costa
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|