adacosta-labilerecord 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -2
- data/README.rdoc +1 -1
- data/lib/labilerecord.rb +13 -3
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
== 0.0.
|
1
|
+
== 0.0.9 2009-05-07
|
2
2
|
|
3
3
|
* 1 major enhancement:
|
4
4
|
* Initial release
|
@@ -16,4 +16,7 @@
|
|
16
16
|
* Increment revision; minor bug fix
|
17
17
|
* 8 :
|
18
18
|
* Added Query.to_insert_sql to transform dataset into
|
19
|
-
an insert statement ... handy for data copies.
|
19
|
+
an insert statement ... handy for data copies.
|
20
|
+
* 9 :
|
21
|
+
* Attempt to load alternate postgresql adapter
|
22
|
+
* Fix readme example typo
|
data/README.rdoc
CHANGED
data/lib/labilerecord.rb
CHANGED
@@ -2,8 +2,18 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module LabileRecord
|
5
|
-
VERSION = '0.0.
|
6
|
-
|
5
|
+
VERSION = '0.0.9'
|
6
|
+
# TODO: refactor into a clean method
|
7
|
+
# try to load a postgres adapter
|
8
|
+
begin
|
9
|
+
require 'pg'
|
10
|
+
rescue LoadError
|
11
|
+
begin
|
12
|
+
require 'postgres'
|
13
|
+
rescue LoadError
|
14
|
+
raise LoadError, 'no postgres adapters available to load; ensure rubygems or a postgres connection adapter path is required'
|
15
|
+
end
|
16
|
+
end
|
7
17
|
|
8
18
|
class Base
|
9
19
|
class << self
|
@@ -63,7 +73,7 @@ module LabileRecord
|
|
63
73
|
end
|
64
74
|
|
65
75
|
def to_insert_sql(table_name=nil)
|
66
|
-
# return: [INSERT INTO table_name] (column_list)
|
76
|
+
# return: [INSERT INTO table_name] (column_list) VALUES(value_list);
|
67
77
|
sql = ""
|
68
78
|
each do |row|
|
69
79
|
non_nil_column_names = []
|