rails-pg-procs 1.0.0
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/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README +15 -0
- data/README.rdoc +18 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/docs/classes/ActiveRecord.html +117 -0
- data/docs/classes/ActiveRecord/ConnectionAdapters.html +113 -0
- data/docs/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter.html +589 -0
- data/docs/classes/ActiveRecord/ConnectionAdapters/ProcedureDefinition.html +110 -0
- data/docs/classes/ActiveRecord/ConnectionAdapters/TriggerDefinition.html +519 -0
- data/docs/classes/ActiveRecord/ConnectionAdapters/TypeDefinition.html +110 -0
- data/docs/classes/ActiveRecord/SchemaDumper.html +371 -0
- data/docs/classes/Inflector.html +164 -0
- data/docs/classes/SchemaProcs.html +211 -0
- data/docs/classes/SqlFormat.html +139 -0
- data/docs/classes/String.html +117 -0
- data/docs/classes/Symbol.html +117 -0
- data/docs/created.rid +1 -0
- data/docs/fr_class_index.html +36 -0
- data/docs/fr_method_index.html +63 -0
- data/docs/index.html +22 -0
- data/docs/rdoc-style.css +208 -0
- data/init.rb +3 -0
- data/install.rb +1 -0
- data/lib/connection_adapters/aggregagtes_definition.rb +1 -0
- data/lib/connection_adapters/connection_adapters.rb +8 -0
- data/lib/connection_adapters/index_definition.rb +24 -0
- data/lib/connection_adapters/postgresql_adapter.rb +256 -0
- data/lib/connection_adapters/procedure_definition.rb +6 -0
- data/lib/connection_adapters/schema_definition.rb +24 -0
- data/lib/connection_adapters/schema_statements.rb +11 -0
- data/lib/connection_adapters/trigger_definition.rb +114 -0
- data/lib/connection_adapters/type_definition.rb +17 -0
- data/lib/connection_adapters/view_definition.rb +34 -0
- data/lib/inflector.rb +10 -0
- data/lib/rails_pg_procs.rb +8 -0
- data/lib/schema_dumper.rb +96 -0
- data/lib/schema_procs.rb +19 -0
- data/lib/sql_format.rb +17 -0
- data/tasks/rails_pg_procs.rake +4 -0
- data/test/connection.rb +16 -0
- data/test/procedure_test.rb +78 -0
- data/test/rails_pg_procs_test.rb +246 -0
- data/test/test_helper.rb +41 -0
- data/test/trigger_test.rb +87 -0
- data/test/type_test.rb +46 -0
- data/test/view_test.rb +36 -0
- data/uninstall.rb +1 -0
- metadata +112 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
<!DOCTYPE html
|
2
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<title>Class: ActiveRecord::ConnectionAdapters::TypeDefinition</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
<script type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function popupCode( url ) {
|
15
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
16
|
+
}
|
17
|
+
|
18
|
+
function toggleCode( id ) {
|
19
|
+
if ( document.getElementById )
|
20
|
+
elem = document.getElementById( id );
|
21
|
+
else if ( document.all )
|
22
|
+
elem = eval( "document.all." + id );
|
23
|
+
else
|
24
|
+
return false;
|
25
|
+
|
26
|
+
elemStyle = elem.style;
|
27
|
+
|
28
|
+
if ( elemStyle.display != "block" ) {
|
29
|
+
elemStyle.display = "block"
|
30
|
+
} else {
|
31
|
+
elemStyle.display = "none"
|
32
|
+
}
|
33
|
+
|
34
|
+
return true;
|
35
|
+
}
|
36
|
+
|
37
|
+
// Make codeblocks hidden by default
|
38
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
39
|
+
|
40
|
+
// ]]>
|
41
|
+
</script>
|
42
|
+
|
43
|
+
</head>
|
44
|
+
<body>
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
<div id="classHeader">
|
49
|
+
<table class="header-table">
|
50
|
+
<tr class="top-aligned-row">
|
51
|
+
<td><strong>Class</strong></td>
|
52
|
+
<td class="class-name-in-header">ActiveRecord::ConnectionAdapters::TypeDefinition</td>
|
53
|
+
</tr>
|
54
|
+
<tr class="top-aligned-row">
|
55
|
+
<td><strong>In:</strong></td>
|
56
|
+
<td>
|
57
|
+
<a href="../../../files/lib/rails_pg_procs_rb.html">
|
58
|
+
lib/rails_pg_procs.rb
|
59
|
+
</a>
|
60
|
+
<br />
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
|
64
|
+
<tr class="top-aligned-row">
|
65
|
+
<td><strong>Parent:</strong></td>
|
66
|
+
<td>
|
67
|
+
Struct.new(:id, :name, :columns);
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
<!-- banner header -->
|
73
|
+
|
74
|
+
<div id="bodyContent">
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<div id="contextContent">
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
<!-- if includes -->
|
89
|
+
|
90
|
+
<div id="section">
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if method_list -->
|
100
|
+
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
<div id="validator-badges">
|
106
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
</body>
|
110
|
+
</html>
|
@@ -0,0 +1,371 @@
|
|
1
|
+
<!DOCTYPE html
|
2
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<title>Class: ActiveRecord::SchemaDumper</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
<script type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function popupCode( url ) {
|
15
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
16
|
+
}
|
17
|
+
|
18
|
+
function toggleCode( id ) {
|
19
|
+
if ( document.getElementById )
|
20
|
+
elem = document.getElementById( id );
|
21
|
+
else if ( document.all )
|
22
|
+
elem = eval( "document.all." + id );
|
23
|
+
else
|
24
|
+
return false;
|
25
|
+
|
26
|
+
elemStyle = elem.style;
|
27
|
+
|
28
|
+
if ( elemStyle.display != "block" ) {
|
29
|
+
elemStyle.display = "block"
|
30
|
+
} else {
|
31
|
+
elemStyle.display = "none"
|
32
|
+
}
|
33
|
+
|
34
|
+
return true;
|
35
|
+
}
|
36
|
+
|
37
|
+
// Make codeblocks hidden by default
|
38
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
39
|
+
|
40
|
+
// ]]>
|
41
|
+
</script>
|
42
|
+
|
43
|
+
</head>
|
44
|
+
<body>
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
<div id="classHeader">
|
49
|
+
<table class="header-table">
|
50
|
+
<tr class="top-aligned-row">
|
51
|
+
<td><strong>Class</strong></td>
|
52
|
+
<td class="class-name-in-header">ActiveRecord::SchemaDumper</td>
|
53
|
+
</tr>
|
54
|
+
<tr class="top-aligned-row">
|
55
|
+
<td><strong>In:</strong></td>
|
56
|
+
<td>
|
57
|
+
<a href="../../files/lib/rails_pg_procs_rb.html">
|
58
|
+
lib/rails_pg_procs.rb
|
59
|
+
</a>
|
60
|
+
<br />
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
|
64
|
+
<tr class="top-aligned-row">
|
65
|
+
<td><strong>Parent:</strong></td>
|
66
|
+
<td>
|
67
|
+
Object
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
<!-- banner header -->
|
73
|
+
|
74
|
+
<div id="bodyContent">
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<div id="contextContent">
|
79
|
+
|
80
|
+
<div id="description">
|
81
|
+
<p>
|
82
|
+
This class is used to dump the database schema for some connection to some
|
83
|
+
output format (i.e., ActiveRecord::Schema).
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000027">get_type</a>
|
96
|
+
<a href="#M000032">indexes</a>
|
97
|
+
<a href="#M000026">postgres?</a>
|
98
|
+
<a href="#M000028">procedures</a>
|
99
|
+
<a href="#M000031">tables</a>
|
100
|
+
<a href="#M000029">triggers</a>
|
101
|
+
<a href="#M000030">types</a>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if includes -->
|
109
|
+
<div id="includes">
|
110
|
+
<h3 class="section-bar">Included Modules</h3>
|
111
|
+
|
112
|
+
<div id="includes-list">
|
113
|
+
<span class="include-name"><a href="../SchemaProcs.html">SchemaProcs</a></span>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div id="section">
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div id="aliases-list">
|
122
|
+
<h3 class="section-bar">External Aliases</h3>
|
123
|
+
|
124
|
+
<div class="name-list">
|
125
|
+
<table summary="aliases">
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">tables</td>
|
128
|
+
<td>-></td>
|
129
|
+
<td class="context-item-value">procless_tables</td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">indexes</td>
|
133
|
+
<td>-></td>
|
134
|
+
<td class="context-item-value">indexes_before_triggers</td>
|
135
|
+
</tr>
|
136
|
+
</table>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<!-- if method_list -->
|
145
|
+
<div id="methods">
|
146
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
147
|
+
|
148
|
+
<div id="method-M000026" class="method-detail">
|
149
|
+
<a name="M000026"></a>
|
150
|
+
|
151
|
+
<div class="method-heading">
|
152
|
+
<a href="#M000026" class="method-signature">
|
153
|
+
<span class="method-name">postgres?</span><span class="method-args">()</span>
|
154
|
+
</a>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
<p>
|
159
|
+
TODO -Implement checks on <a href="SchemaDumper.html">SchemaDumper</a>
|
160
|
+
instance to ensure we do this only when using pg db.
|
161
|
+
</p>
|
162
|
+
<p><a class="source-toggle" href="#"
|
163
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
164
|
+
<div class="method-source-code" id="M000026-source">
|
165
|
+
<pre>
|
166
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 62</span>
|
167
|
+
62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">postgres?</span>
|
168
|
+
63: <span class="ruby-identifier">adapter_name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'PostgreSQL'</span>
|
169
|
+
64: <span class="ruby-keyword kw">end</span>
|
170
|
+
</pre>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
176
|
+
|
177
|
+
<div id="method-M000027" class="method-detail">
|
178
|
+
<a name="M000027"></a>
|
179
|
+
|
180
|
+
<div class="method-heading">
|
181
|
+
<a href="#M000027" class="method-signature">
|
182
|
+
<span class="method-name">get_type</span><span class="method-args">(types)</span>
|
183
|
+
</a>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div class="method-description">
|
187
|
+
<p><a class="source-toggle" href="#"
|
188
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
189
|
+
<div class="method-source-code" id="M000027-source">
|
190
|
+
<pre>
|
191
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 66</span>
|
192
|
+
66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_type</span>(<span class="ruby-identifier">types</span>)
|
193
|
+
67: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">types</span>
|
194
|
+
68: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
|
195
|
+
69: <span class="ruby-identifier">types</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
|
196
|
+
70: <span class="ruby-identifier">get_type</span>(<span class="ruby-identifier">type</span>)
|
197
|
+
71: }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">", "</span>)
|
198
|
+
72: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span> <span class="ruby-operator">&&</span> <span class="ruby-regexp re">/^\d+$/</span>
|
199
|
+
73: <span class="ruby-identifier">type</span> = <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">select_value</span>(<span class="ruby-node">"SELECT typname FROM pg_type WHERE oid = '#{types}'"</span>)
|
200
|
+
74: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">type</span> = <span class="ruby-value str">'nil'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'void'</span>
|
201
|
+
75: <span class="ruby-identifier">get_type</span>(<span class="ruby-identifier">type</span>)
|
202
|
+
76: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
203
|
+
77: <span class="ruby-keyword kw">return</span> <span class="ruby-node">%("#{types}")</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">types</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/[\s\(]/</span>
|
204
|
+
78: <span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">symbolize</span>(<span class="ruby-identifier">types</span>)
|
205
|
+
79: <span class="ruby-keyword kw">end</span>
|
206
|
+
80: <span class="ruby-keyword kw">end</span>
|
207
|
+
</pre>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div id="method-M000032" class="method-detail">
|
213
|
+
<a name="M000032"></a>
|
214
|
+
|
215
|
+
<div class="method-heading">
|
216
|
+
<a href="#M000032" class="method-signature">
|
217
|
+
<span class="method-name">indexes</span><span class="method-args">(table, stream)</span>
|
218
|
+
</a>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div class="method-description">
|
222
|
+
<p><a class="source-toggle" href="#"
|
223
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
224
|
+
<div class="method-source-code" id="M000032-source">
|
225
|
+
<pre>
|
226
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 127</span>
|
227
|
+
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">indexes</span>(<span class="ruby-identifier">table</span>, <span class="ruby-identifier">stream</span>)
|
228
|
+
128: <span class="ruby-identifier">indexes_before_triggers</span>(<span class="ruby-identifier">table</span>, <span class="ruby-identifier">stream</span>)
|
229
|
+
129: <span class="ruby-identifier">triggers</span>(<span class="ruby-identifier">table</span>, <span class="ruby-identifier">stream</span>)
|
230
|
+
130: <span class="ruby-keyword kw">end</span>
|
231
|
+
</pre>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div id="method-M000028" class="method-detail">
|
237
|
+
<a name="M000028"></a>
|
238
|
+
|
239
|
+
<div class="method-heading">
|
240
|
+
<a href="#M000028" class="method-signature">
|
241
|
+
<span class="method-name">procedures</span><span class="method-args">(stream, conditions=nil)</span>
|
242
|
+
</a>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div class="method-description">
|
246
|
+
<p>
|
247
|
+
TODO - Facilitate create_proc(name, [argname, argtype] and
|
248
|
+
create_proc(name, [argmode, argname, argtype] …
|
249
|
+
</p>
|
250
|
+
<p><a class="source-toggle" href="#"
|
251
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
252
|
+
<div class="method-source-code" id="M000028-source">
|
253
|
+
<pre>
|
254
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 83</span>
|
255
|
+
83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">procedures</span>(<span class="ruby-identifier">stream</span>, <span class="ruby-identifier">conditions</span>=<span class="ruby-keyword kw">nil</span>)
|
256
|
+
84: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">procedures</span>(<span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">proc_row</span><span class="ruby-operator">|</span>
|
257
|
+
85: <span class="ruby-identifier">oid</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">owner</span>, <span class="ruby-identifier">lang</span>, <span class="ruby-identifier">is_agg</span>, <span class="ruby-identifier">sec_def</span>, <span class="ruby-identifier">is_strict</span>, <span class="ruby-identifier">ret_set</span>, <span class="ruby-identifier">volatile</span>, <span class="ruby-identifier">nargs</span>, <span class="ruby-identifier">ret_type</span>, <span class="ruby-identifier">arg_types</span>, <span class="ruby-identifier">arg_names</span>, <span class="ruby-identifier">src</span>, <span class="ruby-identifier">bin</span>, <span class="ruby-identifier">acl</span> = <span class="ruby-identifier">proc_row</span>
|
258
|
+
86: <span class="ruby-identifier">is_agg</span> = <span class="ruby-identifier">is_agg</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'t'</span>
|
259
|
+
87: <span class="ruby-identifier">is_strict</span> = <span class="ruby-identifier">is_strict</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'t'</span>
|
260
|
+
88: <span class="ruby-identifier">ret_set</span> = <span class="ruby-identifier">ret_set</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'t'</span>
|
261
|
+
89: <span class="ruby-identifier">arg_names</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">''</span>
|
262
|
+
90: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">get_type</span>(<span class="ruby-identifier">arg_types</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">" "</span>))<span class="ruby-comment cmt">#.zip(arg_names.split(" "))</span>
|
263
|
+
91:
|
264
|
+
92: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">" create_proc(#{Inflector.symbolize(name)}, [#{args}], :return => #{get_type(ret_type)}"</span>
|
265
|
+
93: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">", :resource => ['#{bin}', '#{src}']"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">bin</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'-'</span>
|
266
|
+
94: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">", :set => true"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret_set</span>
|
267
|
+
95: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">", :strict => true"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_strict</span>
|
268
|
+
96: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">", :behavior => '#{behavior(volatile)}'"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">volatile</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'v'</span>
|
269
|
+
97: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">", :lang => '#{lang}')"</span>
|
270
|
+
98: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">" {\n <<-#{Inflector.underscore(name)}_sql\n#{src.chomp}\n #{Inflector.underscore(name)}_sql\n }"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bin</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'-'</span>
|
271
|
+
99: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">"\n"</span>
|
272
|
+
100: }
|
273
|
+
101: <span class="ruby-keyword kw">end</span>
|
274
|
+
</pre>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div id="method-M000031" class="method-detail">
|
280
|
+
<a name="M000031"></a>
|
281
|
+
|
282
|
+
<div class="method-heading">
|
283
|
+
<a href="#M000031" class="method-signature">
|
284
|
+
<span class="method-name">tables</span><span class="method-args">(stream)</span>
|
285
|
+
</a>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div class="method-description">
|
289
|
+
<p><a class="source-toggle" href="#"
|
290
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
291
|
+
<div class="method-source-code" id="M000031-source">
|
292
|
+
<pre>
|
293
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 119</span>
|
294
|
+
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tables</span>(<span class="ruby-identifier">stream</span>)
|
295
|
+
120: <span class="ruby-identifier">types</span>(<span class="ruby-identifier">stream</span>)
|
296
|
+
121: <span class="ruby-identifier">procedures</span>(<span class="ruby-identifier">stream</span>, <span class="ruby-value str">"!= 'sql'"</span>)
|
297
|
+
122: <span class="ruby-identifier">procless_tables</span>(<span class="ruby-identifier">stream</span>)
|
298
|
+
123: <span class="ruby-identifier">procedures</span>(<span class="ruby-identifier">stream</span>, <span class="ruby-value str">"= 'sql'"</span>)
|
299
|
+
124: <span class="ruby-keyword kw">end</span>
|
300
|
+
</pre>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div id="method-M000029" class="method-detail">
|
306
|
+
<a name="M000029"></a>
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<a href="#M000029" class="method-signature">
|
310
|
+
<span class="method-name">triggers</span><span class="method-args">(table_name, stream)</span>
|
311
|
+
</a>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div class="method-description">
|
315
|
+
<p><a class="source-toggle" href="#"
|
316
|
+
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
317
|
+
<div class="method-source-code" id="M000029-source">
|
318
|
+
<pre>
|
319
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 102</span>
|
320
|
+
102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">triggers</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">stream</span>)
|
321
|
+
103: <span class="ruby-identifier">triggers</span> = <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">triggers</span>(<span class="ruby-identifier">table_name</span>)
|
322
|
+
104: <span class="ruby-identifier">triggers</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">trigger</span><span class="ruby-operator">|</span>
|
323
|
+
105: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">trigger</span>.<span class="ruby-identifier">to_rdl</span>
|
324
|
+
106: }
|
325
|
+
107: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">puts</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">triggers</span>.<span class="ruby-identifier">empty?</span>
|
326
|
+
108: <span class="ruby-keyword kw">end</span>
|
327
|
+
</pre>
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div id="method-M000030" class="method-detail">
|
333
|
+
<a name="M000030"></a>
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<a href="#M000030" class="method-signature">
|
337
|
+
<span class="method-name">types</span><span class="method-args">(stream)</span>
|
338
|
+
</a>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
<p><a class="source-toggle" href="#"
|
343
|
+
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
344
|
+
<div class="method-source-code" id="M000030-source">
|
345
|
+
<pre>
|
346
|
+
<span class="ruby-comment cmt"># File lib/rails_pg_procs.rb, line 110</span>
|
347
|
+
110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">types</span>(<span class="ruby-identifier">stream</span>)
|
348
|
+
111: <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">types</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
|
349
|
+
112: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">" create_type(#{Inflector.symbolize(type.name)}, "</span>
|
350
|
+
113: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"#{ type.columns.collect{|column, type| "[#{Inflector.symbolize(column)}, #{get_type(type)}]"}.join(", ") }"</span>
|
351
|
+
114: <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">")"</span>
|
352
|
+
115: }
|
353
|
+
116: <span class="ruby-keyword kw">end</span>
|
354
|
+
</pre>
|
355
|
+
</div>
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
|
360
|
+
</div>
|
361
|
+
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
<div id="validator-badges">
|
367
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</body>
|
371
|
+
</html>
|