File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,34 @@ def initialize(spec)
67
67
68
68
@connections = [ ]
69
69
@checked_out = [ ]
70
+ @automatic_reconnect = true
71
+ @tables = { }
72
+
73
+ @columns = Hash . new do |h , table_name |
74
+ h [ table_name ] = with_connection do |conn |
75
+
76
+ # Fetch a list of columns
77
+ conn . columns ( table_name , "#{ table_name } Columns" ) . tap do |columns |
78
+
79
+ # set primary key information
80
+ columns . each do |column |
81
+ column . primary = column . name == primary_keys [ table_name ]
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ @columns_hash = Hash . new do |h , table_name |
88
+ h [ table_name ] = Hash [ columns [ table_name ] . map { |col |
89
+ [ col . name , col ]
90
+ } ]
91
+ end
92
+
93
+ @primary_keys = Hash . new do |h , table_name |
94
+ h [ table_name ] = with_connection do |conn |
95
+ table_exists? ( table_name ) ? conn . primary_key ( table_name ) : 'id'
96
+ end
97
+ end
70
98
end
71
99
72
100
def clear_stale_cached_connections!
@@ -101,4 +129,4 @@ def checkout_and_verify(c)
101
129
end
102
130
103
131
end
104
- end
132
+ end
You can’t perform that action at this time.
0 commit comments