kemen-ruby-odbc 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MANIFEST ADDED
@@ -0,0 +1,23 @@
1
+ COPYING
2
+ ChangeLog
3
+ GPL
4
+ MANIFEST
5
+ README
6
+ ruby-odbc.gemspec
7
+ ext/extconf.rb
8
+ ext/odbc.c
9
+ ext/init.c
10
+ ext/utf8/extconf.rb
11
+ ext/utf8/odbc.c
12
+ ext/utf8/init.c
13
+ lib/cqgen.rb
14
+ doc/odbc.html
15
+ test/test.rb
16
+ test/00connect.rb
17
+ test/10create_table.rb
18
+ test/20insert.rb
19
+ test/30select.rb
20
+ test/40update.rb
21
+ test/50drop_table.rb
22
+ test/70close.rb
23
+ test/utf8/test.rb
data/README ADDED
@@ -0,0 +1,110 @@
1
+ # $Id: README,v 1.41 2011/01/15 08:03:22 chw Exp chw $
2
+
3
+ ruby-odbc-0.99994
4
+
5
+ This is an ODBC binding for Ruby. So far it has been tested with
6
+
7
+ - Ruby 1.[6-9], MySQL 3.22/MyODBC (local), unixODBC 2.1.0
8
+ on Linux 2.2-x86 and 2.6-x86_64
9
+
10
+ - Ruby 1.6.4, MySQL 3.22/MyODBC (local), libiodbc 2.50
11
+ on Linux 2.2-x86
12
+
13
+ - Ruby 1.[6-8], MySQL 3.22/MyODBC (remote), MS Jet Engine, MSVC++ 6.0
14
+ on Windows NT4SP6
15
+
16
+ - Ruby 1.6.[3-5], MySQL 3.22/MyODBC (remote), MS Jet Engine, cygwin,
17
+ on Windows NT4SP6 and 2000
18
+
19
+ - Ruby 1.8.*, SQLite/ODBC >= 0.67, libiodbc 3.52.4 on Fedora Core 3 x86
20
+
21
+ Michael Neumann <neumann@s-direktnet.de> and
22
+ Will Merrell <wmerrell@catalystcorp.com> reported successful compilation
23
+ with Cygwin on Win32.
24
+
25
+ Requirements:
26
+
27
+ - Ruby 1.6.[3-8] or Ruby >= 1.7
28
+ - unixODBC 2.x or libiodbc 3.52 on UN*X
29
+
30
+ Installation:
31
+
32
+ $ ruby -Cext extconf.rb [--enable-dlopen|--disable-dlopen]
33
+ $ make -C ext
34
+ # make -C ext install
35
+
36
+ --enable/disble-dlopen turns on/off special initialization
37
+ code to make ruby-odbc agnostic to unixODBC/iODBC driver
38
+ manager shared library names when GCC is used for compile.
39
+ In cases where unixODBC or iODBC is installed in non-standard
40
+ locations, use the option --with-odbc-dir=<non-standard-location>
41
+ when running extconf.rb
42
+
43
+ Installation of utf8 version:
44
+
45
+ $ ruby -Cext/utf8 extconf.rb [--enable-dlopen|--disable-dlopen]
46
+ $ make -C ext/utf8
47
+ # make -C ext/utf8 install
48
+
49
+ Installation MSVC:
50
+
51
+ C:..>ruby -Cext extconf.rb
52
+ C:..>cd ext
53
+ C:..>nmake
54
+ C:..>nmake install
55
+ C:..>ruby -Cutf8 extconf.rb
56
+ C:..>cd utf8
57
+ C:..>nmake
58
+ C:..>nmake install
59
+
60
+ Testing:
61
+
62
+ $ ruby -Ctest test.rb DSN [uid] [pwd]
63
+ or
64
+ $ ruby -KU -Ctest/utf8 test.rb DSN [uid] [pwd]
65
+
66
+ Usage:
67
+
68
+ Refer to doc/odbc.html
69
+
70
+ The difference between utf8 and non-utf8 versions are:
71
+
72
+ - non-utf8 version uses normal SQL.* ANSI functions
73
+ - utf8 version uses SQL.*W UNICODE functions and
74
+ requires/returns all strings in UTF8 format
75
+
76
+ Thus, depending on the -K option of ruby one could use
77
+ that code snippet:
78
+
79
+ ...
80
+ if $KCODE == "UTF8" then
81
+ require 'odbc_utf8'
82
+ else
83
+ require 'odbc'
84
+ fi
85
+
86
+ It is also possible to load both non-utf8 and utf8 version
87
+ into ruby:
88
+
89
+ ...
90
+ # non-utf8 version
91
+ require 'odbc'
92
+ # utf8 version
93
+ require 'odbc_utf8'
94
+
95
+ Whichever is loaded first, gets the module name 'ODBC'.
96
+ The second loaded module will be named 'ODBC_UTF8' (for
97
+ 'odbc_utf8') or 'ODBC_NONE' (for 'odbc'). That should
98
+ allow to use both versions simultaneously in special
99
+ situations.
100
+
101
+ TODO:
102
+
103
+ - heavier testing
104
+ - improve documentation
105
+
106
+ Author:
107
+
108
+ Christian Werner
109
+ mailto:chw@ch-werner.de
110
+ http://www.ch-werner.de/rubyodbc
data/doc/odbc.html ADDED
@@ -0,0 +1,1340 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
+ "http://www.w3.org/TR/html4/strict.dtd">
3
+ <html lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
+ <meta http-equiv="Content-Style-Type" content="text/css">
7
+ <meta name="Keywords" lang="en" content="ODBC Binding for Ruby">
8
+ <link rev="made" href="mailto:chw@ch-werner.de">
9
+ <style type="text/css">
10
+ <!--
11
+ body {
12
+ background-color: white;
13
+ color: black;
14
+ }
15
+ address { text-align: right }
16
+ div.lastmodifed { text-align: right }
17
+ div.language { text-align: right }
18
+ pre {
19
+ white-space: pre;
20
+ background-color: antiquewhite;
21
+ border: inset thin;
22
+ }
23
+ -->
24
+ </style>
25
+ <title>Ruby ODBC Reference</title>
26
+ </head>
27
+ <body>
28
+ <h1><a name="reference">Ruby ODBC Reference</a></h1>
29
+ <div class = "lastmodifed">
30
+ Last update: Thu, 16 September 2010
31
+ </div>
32
+ <hr>
33
+ <div>
34
+ <h2><a name="ODBC">ODBC</a></h2>
35
+ <p>
36
+ The module to encapsulate the Ruby ODBC binding.
37
+ </p>
38
+ <h3>module functions:</h3>
39
+ <dl>
40
+ <dt><a name="ODBC::datasources"><code>datasources</code></a>
41
+ <dd>Returns an array of <a href="#ODBC::DSN">ODBC::DSN</a>s, i.e. all
42
+ known data source names.
43
+ <dt><a name="ODBC::drivers"><code>drivers</code></a>
44
+ <dd>Returns an array of <a href="#ODBC::Driver">ODBC::Driver</a>s,
45
+ i.e. all known ODBC drivers.
46
+ <dt><a name="ODBC::error"><code>error</code></a>
47
+ <dd>Returns the last error messages (String array) or nil.
48
+ The layout of the warning/error messages
49
+ is described <a href="#ODBC::Error">here</a>.
50
+ Retrieving this message as well as subsequent succeeding ODBC
51
+ method invocations do not clear the message. Use the
52
+ <a href="#OBDC::clear_error"><code>clear_error</code></a> method
53
+ for that purpose.
54
+ <dt><a name="ODBC::info"><code>info</code></a>
55
+ <dd>Returns the last driver/driver manager warning messages
56
+ (String array) or nil.
57
+ The layout of the warning/error messages
58
+ is described <a href="#ODBC::Error">here</a>.
59
+ Retrieving this message as well as subsequent succeeding ODBC
60
+ method invocations do not clear the message. Use the
61
+ <a href="#OBDC::clear_error"><code>clear_error</code></a> method
62
+ for that purpose.
63
+ <dt><a name="ODBC::clear_error"><code>clear_error</code></a>
64
+ <dd>Resets the last driver/driver manager error and warning messages
65
+ to nil.
66
+ <dt><a name="ODBC::raise"><code>raise(<var>value</var>)</code></a>
67
+ <dd>Raises an <a href="#ODBC::Error">ODBC::Error</a> exception with
68
+ String error message <var>value</var>.
69
+ <dt><a name="ODBC::newenv"><code>newenv</code></a>
70
+ <dd>Returns a new <a href="#ODBC::Environment">ODBC::Environment</a>.
71
+ <dt><a name="ODBC::connection_pooling">
72
+ <code>connection_pooling[=<var>value</var>]</code></a>
73
+ <dd>Gets or sets the process-wide connection pooling attribute.
74
+ <dt><a name="ODBC::to_time1">
75
+ <code>to_time(<var>timestamp</var>)</code></a>
76
+ <dt><a name="ODBC::to_time2"><code>to_time(<var>date</var>,[<var>time</var>])</code></a>
77
+ <dt><a name="ODBC::to_time3"><code>to_time(<var>time</var>,[<var>date</var>])</code></a>
78
+ <dd>Creates a <code>Time</code> object from the specified arguments,
79
+ which must be <a href="#ODBC::Date">ODBC::Date</a>,
80
+ <a href="#ODBC::Time">ODBC::Time</a>, or
81
+ <a href="#ODBC::TimeStamp">ODBC::TimeStamp</a> objects.
82
+ <dt><a name="ODBC::to_date1">
83
+ <code>to_date(<var>timestamp</var>)</code></a>
84
+ <dt><a name="ODBC::to_date2"><code>to_date(<var>date</var>)</code></a>
85
+ <dd>Creates a <code>Date</code> object from the specified arguments,
86
+ which must be <a href="#ODBC::Date">ODBC::Date</a>, or
87
+ <a href="#ODBC::TimeStamp">ODBC::TimeStamp</a> objects.
88
+ <dt><a name="ODBC::connect"><code>connect(<var>dsn</var>,[<var>user</var>,<var>passwd</var>])
89
+ [{|<var>dbc</var>| <var>block</var>}]</code></a>
90
+ <dd>If no block is specified, a connection to the given data source
91
+ is established and a <a href="#ODBC::Database">ODBC::Database</a>
92
+ object is returned, identifying that connection. Otherwise,
93
+ the block is executed with the database object. When the block
94
+ is finished, the connection is automatically released.
95
+ Options are:
96
+ <dl>
97
+ <dd><var>dsn</var>: Data source name (String or
98
+ <a href="#ODBC::DSN">ODBC::DSN</a>)
99
+ <dd><var>user</var>: Login user name (String)
100
+ <dd><var>passwd</var>: Login password (String)
101
+ </dl>
102
+ </dl>
103
+ <h3>constants:</h3>
104
+ <p>
105
+ The boolean constant <var>UTF8</var> reports the character encoding
106
+ of the module. If it is <code>true</code>, the UTF-8 variant of
107
+ the module is in use, and string data is automatically converted
108
+ to/from Unicode.
109
+ </p>
110
+ <p>
111
+ Some constants of the ODBC API are defined in order to set connection
112
+ options, to deal with SQL data types, and to obtain database meta data.
113
+ </p>
114
+ <dl>
115
+ <dt>Cursor behaviour:
116
+ <dd><var>SQL_CURSOR_FORWARD_ONLY</var>,
117
+ <var>SQL_CURSOR_KEYSET_DRIVEN</var>,
118
+ <var>SQL_CURSOR_DYNAMIC</var>,
119
+ <var>SQL_CURSOR_STATIC</var>
120
+ <dt>Concurrency (transactions):
121
+ <dd><var>SQL_CONCUR_READ_ONLY</var>,
122
+ <var>SQL_CONCUR_LOCK</var>,
123
+ <var>SQL_CONCUR_ROWVER</var>,
124
+ <var>SQL_CONCUR_VALUES</var>
125
+ <dt>Fetch direction:
126
+ <dd><var>SQL_FETCH_NEXT</var>,
127
+ <var>SQL_FETCH_FIRST</var>,
128
+ <var>SQL_FETCH_LAST</var>,
129
+ <var>SQL_FETCH_PRIOR</var>,
130
+ <var>SQL_FETCH_ABSOLUTE</var>,
131
+ <var>SQL_FETCH_RELATIVE</var>
132
+ <dt>Data types:
133
+ <dd><var>SQL_UNKNOWN_TYPE</var>,
134
+ <var>SQL_CHAR</var>,
135
+ <var>SQL_NUMERIC</var>,
136
+ <var>SQL_DECIMAL</var>,
137
+ <var>SQL_INTEGER</var>,
138
+ <var>SQL_SMALLINT</var>,
139
+ <var>SQL_FLOAT</var>,
140
+ <var>SQL_REAL</var>,
141
+ <var>SQL_DOUBLE</var>,
142
+ <var>SQL_VARCHAR</var>,
143
+ <var>SQL_DATETIME</var>,
144
+ <var>SQL_DATE</var>,
145
+ <var>SQL_TYPE_DATE</var>,
146
+ <var>SQL_TIME</var>,
147
+ <var>SQL_TYPE_TIME</var>,
148
+ <var>SQL_TIMESTAMP</var>,
149
+ <var>SQL_TYPE_TIMESTAMP</var>,
150
+ <var>SQL_LONGVARCHAR</var>,
151
+ <var>SQL_BINARY</var>,
152
+ <var>SQL_VARBINARY</var>,
153
+ <var>SQL_LONGVARBINARY</var>,
154
+ <var>SQL_BIGINT</var>,
155
+ <var>SQL_TINYINT</var>,
156
+ <var>SQL_BIT</var>,
157
+ <var>SQL_GUID</var>
158
+ <dt>Parameter related:
159
+ <dd><var>SQL_PARAM_TYPE_UNKNOWN</var>,
160
+ <var>SQL_PARAM_INPUT</var>,
161
+ <var>SQL_PARAM_OUTPUT</var>,
162
+ <var>SQL_PARAM_INPUT_OUTPUT</var>,
163
+ <var>SQL_DEFAULT_PARAM</var>
164
+ <var>SQL_RETURN_VALUE</var>
165
+ <dt>Procedure related:
166
+ <dd><var>SQL_RESULT_COL</var>,
167
+ <var>SQL_PT_UNKNOWN</var>,
168
+ <var>SQL_PT_PROCEDURE</var>,
169
+ <var>SQL_PT_FUNCTION</var>
170
+ <dt>Environment attributes:
171
+ <dd><var>SQL_CP_OFF</var>,
172
+ <var>SQL_CP_ONE_PER_DRIVER</var>,
173
+ <var>SQL_CP_ONE_PER_HENV</var>,
174
+ <var>SQL_CP_DEFAULT</var>,
175
+ <var>SQL_CP_STRICT_MATCH</var>,
176
+ <var>SQL_CP_RELAXED_MATCH</var>,
177
+ <var>SQL_CP_MATCH_DEFAULT</var>,
178
+ <var>SQL_OV_ODBC2</var>,
179
+ <var>SQL_OV_ODBC3</var>
180
+ <dt>Info types for
181
+ <a href=#get_info><code>ODBC::Database.get_info</code></a>
182
+ yielding integer results:
183
+ <dd><var>SQL_ACTIVE_ENVIRONMENTS</var>,
184
+ <var>SQL_ACTIVE_CONNECTIONS</var>,
185
+ <var>SQL_ACTIVE_STATEMENTS</var>,
186
+ <var>SQL_ASYNC_MODE</var>,
187
+ <var>SQL_CATALOG_LOCATION</var>,
188
+ <var>SQL_CONCAT_NULL_BEHAVIOR</var>,
189
+ <var>SQL_CORRELATION_NAME</var>,
190
+ <var>SQL_CURSOR_COMMIT_BEHAVIOR</var>,
191
+ <var>SQL_CURSOR_ROLLBACK_BEHAVIOR</var>,
192
+ <var>SQL_CURSOR_SENSITIVITY</var>,
193
+ <var>SQL_DDL_INDEX</var>,
194
+ <var>SQL_DEFAULT_TXN_ISOLATION</var>,
195
+ <var>SQL_DRIVER_HDBC</var>,
196
+ <var>SQL_DRIVER_HENV</var>,
197
+ <var>SQL_DRIVER_HDESC</var>,
198
+ <var>SQL_DRIVER_HLIB</var>,
199
+ <var>SQL_DRIVER_HSTMT</var>,
200
+ <var>SQL_FILE_USAGE</var>,
201
+ <var>SQL_GROUP_BY</var>,
202
+ <var>SQL_IDENTIFIER_CASE</var>,
203
+ <var>SQL_MAX_ASYNC_CONCURRENT_STATEMENTS</var>,
204
+ <var>SQL_MAX_BINARY_LITERAL_LEN</var>,
205
+ <var>SQL_MAX_CATALOG_NAME_LEN</var>,
206
+ <var>SQL_MAX_CHAR_LITERAL_LEN</var>,
207
+ <var>SQL_MAX_COLUMN_NAME_LEN</var>,
208
+ <var>SQL_MAX_COLUMNS_IN_GROUP_BY</var>,
209
+ <var>SQL_MAX_COLUMNS_IN_INDEX</var>,
210
+ <var>SQL_MAX_COLUMNS_IN_ORDER_BY</var>,
211
+ <var>SQL_MAX_COLUMNS_IN_SELECT</var>,
212
+ <var>SQL_MAX_COLUMNS_IN_TABLE</var>,
213
+ <var>SQL_MAX_CONCURRENT_ACTIVITIES</var>,
214
+ <var>SQL_MAX_CURSOR_NAME_LEN</var>,
215
+ <var>SQL_MAX_DRIVER_CONNECTIONS</var>,
216
+ <var>SQL_MAX_IDENTIFIER_LEN</var>,
217
+ <var>SQL_MAX_INDEX_SIZE</var>,
218
+ <var>SQL_MAX_OWNER_NAME_LEN</var>,
219
+ <var>SQL_MAX_PROCEDURE_NAME_LEN</var>,
220
+ <var>SQL_MAX_QUALIFIER_NAME_LEN</var>,
221
+ <var>SQL_MAX_ROW_SIZE</var>,
222
+ <var>SQL_MAX_SCHEMA_NAME_LEN</var>,
223
+ <var>SQL_MAX_STATEMENT_LEN</var>,
224
+ <var>SQL_MAX_TABLE_NAME_LEN</var>,
225
+ <var>SQL_MAX_TABLES_IN_SELECT</var>,
226
+ <var>SQL_MAX_USER_NAME_LEN</var>,
227
+ <var>SQL_NON_NULLABLE_COLUMNS</var>,
228
+ <var>SQL_NULL_COLLATION</var>,
229
+ <var>SQL_ODBC_API_CONFORMANCE</var>,
230
+ <var>SQL_ODBC_INTERFACE_CONFORMANCE</var>,
231
+ <var>SQL_ODBC_SAG_CLI_CONFORMANCE</var>,
232
+ <var>SQL_ODBC_SQL_CONFORMANCE</var>,
233
+ <var>SQL_PARAM_ARRAY_ROW_COUNTS</var>,
234
+ <var>SQL_PARAM_ARRAY_SELECTS</var>,
235
+ <var>SQL_QUALIFIER_LOCATION</var>,
236
+ <var>SQL_QUOTED_IDENTIFIER_CASE</var>,
237
+ <var>SQL_SQL_CONFORMANCE</var>,
238
+ <var>SQL_TXN_CAPABLE</var>
239
+ <dt>Info types for
240
+ <a href=#get_info><code>ODBC::Database.get_info</code></a>
241
+ yielding bitmasks (integer results):
242
+ <dd><var>SQL_AGGREGATE_FUNCTIONS</var>,
243
+ <var>SQL_ALTER_DOMAIN</var>,
244
+ <var>SQL_ALTER_TABLE</var>,
245
+ <var>SQL_BATCH_ROW_COUNT</var>,
246
+ <var>SQL_BATCH_SUPPORT</var>,
247
+ <var>SQL_BOOKMARK_PERSISTENCE</var>,
248
+ <var>SQL_CATALOG_USAGE</var>,
249
+ <var>SQL_CONVERT_BINARY</var>,
250
+ <var>SQL_CONVERT_BIT</var>,
251
+ <var>SQL_CONVERT_CHAR</var>,
252
+ <var>SQL_CONVERT_GUID</var>,
253
+ <var>SQL_CONVERT_DATE</var>,
254
+ <var>SQL_CONVERT_DECIMAL</var>,
255
+ <var>SQL_CONVERT_DOUBLE</var>,
256
+ <var>SQL_CONVERT_FLOAT</var>,
257
+ <var>SQL_CONVERT_FUNCTIONS</var>,
258
+ <var>SQL_CONVERT_INTEGER</var>,
259
+ <var>SQL_CONVERT_INTERVAL_YEAR_MONTH</var>,
260
+ <var>SQL_CONVERT_INTERVAL_DAY_TIME</var>,
261
+ <var>SQL_CONVERT_LONGVARBINARY</var>,
262
+ <var>SQL_CONVERT_LONGVARCHAR</var>,
263
+ <var>SQL_CONVERT_NUMERIC</var>,
264
+ <var>SQL_CONVERT_REAL</var>,
265
+ <var>SQL_CONVERT_SMALLINT</var>,
266
+ <var>SQL_CONVERT_TIME</var>,
267
+ <var>SQL_CONVERT_TIMESTAMP</var>,
268
+ <var>SQL_CONVERT_TINYINT</var>,
269
+ <var>SQL_CONVERT_VARBINARY</var>,
270
+ <var>SQL_CONVERT_VARCHAR</var>,
271
+ <var>SQL_CONVERT_WCHAR</var>,
272
+ <var>SQL_CONVERT_WLONGVARCHAR</var>,
273
+ <var>SQL_CONVERT_WVARCHAR</var>,
274
+ <var>SQL_CREATE_ASSERTION</var>,
275
+ <var>SQL_CREATE_CHARACTER_SET</var>,
276
+ <var>SQL_CREATE_COLLATION</var>,
277
+ <var>SQL_CREATE_DOMAIN</var>,
278
+ <var>SQL_CREATE_SCHEMA</var>,
279
+ <var>SQL_CREATE_TABLE</var>,
280
+ <var>SQL_CREATE_TRANSLATION</var>,
281
+ <var>SQL_CREATE_VIEW</var>,
282
+ <var>SQL_DATETIME_LITERALS</var>,
283
+ <var>SQL_DROP_ASSERTION</var>,
284
+ <var>SQL_DROP_CHARACTER_SET</var>,
285
+ <var>SQL_DROP_COLLATION</var>,
286
+ <var>SQL_DROP_DOMAIN</var>,
287
+ <var>SQL_DROP_SCHEMA</var>,
288
+ <var>SQL_DROP_TABLE</var>,
289
+ <var>SQL_DROP_TRANSLATION</var>,
290
+ <var>SQL_DROP_VIEW</var>,
291
+ <var>SQL_DTC_TRANSITION_COST</var>,
292
+ <var>SQL_DYNAMIC_CURSOR_ATTRIBUTES1</var>,
293
+ <var>SQL_DYNAMIC_CURSOR_ATTRIBUTES2</var>,
294
+ <var>SQL_FETCH_DIRECTION</var>,
295
+ <var>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1</var>,
296
+ <var>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2</var>,
297
+ <var>SQL_GETDATA_EXTENSIONS</var>,
298
+ <var>SQL_KEYSET_CURSOR_ATTRIBUTES1</var>,
299
+ <var>SQL_KEYSET_CURSOR_ATTRIBUTES2</var>,
300
+ <var>SQL_INDEX_KEYWORDS</var>,
301
+ <var>SQL_INFO_SCHEMA_VIEWS</var>,
302
+ <var>SQL_INSERT_STATEMENT</var>,
303
+ <var>SQL_LOCK_TYPES</var>,
304
+ <var>SQL_NUMERIC_FUNCTIONS</var>,
305
+ <var>SQL_OJ_CAPABILITIES</var>,
306
+ <var>SQL_OWNER_USAGE</var>,
307
+ <var>SQL_POS_OPERATIONS</var>,
308
+ <var>SQL_POSITIONED_STATEMENTS</var>,
309
+ <var>SQL_QUALIFIER_USAGE</var>,
310
+ <var>SQL_SCHEMA_USAGE</var>,
311
+ <var>SQL_SCROLL_CONCURRENCY</var>,
312
+ <var>SQL_SCROLL_OPTIONS</var>,
313
+ <var>SQL_SQL92_DATETIME_FUNCTIONS</var>,
314
+ <var>SQL_SQL92_FOREIGN_KEY_DELETE_RULE</var>,
315
+ <var>SQL_SQL92_FOREIGN_KEY_UPDATE_RULE</var>,
316
+ <var>SQL_SQL92_GRANT</var>,
317
+ <var>SQL_SQL92_NUMERIC_VALUE_FUNCTIONS</var>,
318
+ <var>SQL_SQL92_PREDICATES</var>,
319
+ <var>SQL_SQL92_RELATIONAL_JOIN_OPERATORS</var>,
320
+ <var>SQL_SQL92_REVOKE</var>,
321
+ <var>SQL_SQL92_ROW_VALUE_CONSTRUCTOR</var>,
322
+ <var>SQL_SQL92_STRING_FUNCTIONS</var>,
323
+ <var>SQL_SQL92_VALUE_EXPRESSIONS</var>,
324
+ <var>SQL_STANDARD_CLI_CONFORMANCE</var>,
325
+ <var>SQL_STATIC_CURSOR_ATTRIBUTES1</var>,
326
+ <var>SQL_STATIC_CURSOR_ATTRIBUTES2</var>,
327
+ <var>SQL_STATIC_SENSITIVITY</var>,
328
+ <var>SQL_STRING_FUNCTIONS</var>,
329
+ <var>SQL_SUBQUERIES</var>,
330
+ <var>SQL_SYSTEM_FUNCTIONS</var>,
331
+ <var>SQL_TIMEDATE_ADD_INTERVALS</var>,
332
+ <var>SQL_TIMEDATE_DIFF_INTERVALS</var>,
333
+ <var>SQL_TIMEDATE_FUNCTIONS</var>,
334
+ <var>SQL_TXN_ISOLATION_OPTION</var>,
335
+ <var>SQL_UNION</var>
336
+ <dt>Info types for
337
+ <a href=#get_info><code>ODBC::Database.get_info</code></a>
338
+ yielding strings:
339
+ <dd><var>SQL_ACCESSIBLE_PROCEDURES</var>,
340
+ <var>SQL_ACCESSIBLE_TABLES</var>,
341
+ <var>SQL_CATALOG_NAME</var>,
342
+ <var>SQL_CATALOG_NAME_SEPARATOR</var>,
343
+ <var>SQL_CATALOG_TERM</var>,
344
+ <var>SQL_COLLATION_SEQ</var>,
345
+ <var>SQL_COLUMN_ALIAS</var>,
346
+ <var>SQL_DATA_SOURCE_NAME</var>,
347
+ <var>SQL_DATA_SOURCE_READ_ONLY</var>,
348
+ <var>SQL_DATABASE_NAME</var>,
349
+ <var>SQL_DBMS_NAME</var>,
350
+ <var>SQL_DBMS_VER</var>,
351
+ <var>SQL_DESCRIBE_PARAMETER</var>,
352
+ <var>SQL_DM_VER</var>,
353
+ <var>SQL_DRIVER_NAME</var>,
354
+ <var>SQL_DRIVER_ODBC_VER</var>,
355
+ <var>SQL_DRIVER_VER</var>,
356
+ <var>SQL_EXPRESSIONS_IN_ORDERBY</var>,
357
+ <var>SQL_IDENTIFIER_QUOTE_CHAR</var>,
358
+ <var>SQL_INTEGRITY</var>,
359
+ <var>SQL_KEYWORDS</var>,
360
+ <var>SQL_LIKE_ESCAPE_CLAUSE</var>,
361
+ <var>SQL_MAX_ROW_SIZE_INCLUDES_LONG</var>,
362
+ <var>SQL_MULT_RESULT_SETS</var>,
363
+ <var>SQL_MULTIPLE_ACTIVE_TXN</var>,
364
+ <var>SQL_NEED_LONG_DATA_LEN</var>,
365
+ <var>SQL_ODBC_SQL_OPT_IEF</var>,
366
+ <var>SQL_ODBC_VER</var>,
367
+ <var>SQL_ORDER_BY_COLUMNS_IN_SELECT</var>,
368
+ <var>SQL_OUTER_JOINS</var>,
369
+ <var>SQL_OWNER_TERM</var>,
370
+ <var>SQL_PROCEDURE_TERM</var>,
371
+ <var>SQL_PROCEDURES</var>,
372
+ <var>SQL_QUALIFIER_NAME_SEPARATOR</var>,
373
+ <var>SQL_QUALIFIER_TERM</var>,
374
+ <var>SQL_ROW_UPDATES</var>,
375
+ <var>SQL_SCHEMA_TERM</var>,
376
+ <var>SQL_SEARCH_PATTERN_ESCAPE</var>,
377
+ <var>SQL_SERVER_NAME</var>,
378
+ <var>SQL_SPECIAL_CHARACTERS</var>,
379
+ <var>SQL_TABLE_TERM</var>,
380
+ <var>SQL_USER_NAME</var>,
381
+ <var>SQL_XOPEN_CLI_YEAR</var>
382
+ <dt>Options for
383
+ <a href="#dbc_get_option"><code>ODBC::Database.get_option</code></a>,
384
+ <a href="#dbc_set_option"><code>ODBC::Database.set_option</code></a>,
385
+ <a href="#stmt_get_option"><code>ODBC::Statement.get_option</code></a>,
386
+ and
387
+ <a href="#stmt_set_option"><code>ODBC::Statement.set_option</code></a>
388
+ yielding integers:
389
+ <dd><var>SQL_AUTOCOMMIT</var>,
390
+ <var>SQL_CONCURRENCY</var>,
391
+ <var>SQL_QUERY_TIMEOUT</var>,
392
+ <var>SQL_MAX_ROWS</var>,
393
+ <var>SQL_MAX_LENGTH</var>,
394
+ <var>SQL_NOSCAN</var>,
395
+ <var>SQL_ROWSET_SIZE</var>,
396
+ <var>SQL_CURSOR_TYPE</var>
397
+ </dl>
398
+ </div>
399
+ <hr>
400
+ <div>
401
+ <h2><a name="ODBC::Object">ODBC::Object</a></h2>
402
+ <p>
403
+ The class to represent the root of all other ODBC related objects.
404
+ </p>
405
+ <h3>super class:</h3>
406
+ <code>Object</code>
407
+ <h3>methods:</h3>
408
+ <dl>
409
+ <dt><a name="ODBC::Object.error"><code>error</code></a>
410
+ <dd>Returns the last error message (String) or nil. For further
411
+ information see <a href="#ODBC::error">ODBC::error</a>.
412
+ <dt><a name="ODBC::Object.info"><code>info</code></a>
413
+ <dd>Returns the last driver/driver manager warning messages
414
+ (String array) or nil.
415
+ For further information see
416
+ <a href="#ODBC::error">ODBC::error</a>.
417
+ <dt><a name="ODBC::Object.clear_error"><code>clear_error</code></a>
418
+ <dd>Resets the last driver/driver manager error and warning messages
419
+ to nil.
420
+ <dt><a name="ODBC::Object.raise"><code>raise(<var>value</var>)</code>
421
+ </a>
422
+ <dd>Raises an <a href="#ODBC::Error">ODBC::Error</a> exception with
423
+ String error message <var>value</var>.
424
+ </dl>
425
+ <h3>singleton methods:</h3>
426
+ <dl>
427
+ <dt><a name="ODBC::Object.error2"><code>error</code></a>
428
+ <dd>Returns the last error message (String array) or nil.
429
+ For further information see
430
+ <a href="#ODBC::error">ODBC::error</a>.
431
+ <dt><a name="ODBC::Object.info2"><code>info</code></a>
432
+ <dd>Returns the last driver/driver manager warning messages
433
+ (String array) or nil.
434
+ For further information see
435
+ <a href="#ODBC::error">ODBC::error</a>.
436
+ <dt><a name="ODBC::Object.clear_error2"><code>clear_error</code></a>
437
+ <dd>Resets the last driver/driver manager error and warning messages
438
+ to nil.
439
+ <dt><a name="ODBC::Object.raise2"><code>raise(<var>value</var>)</code>
440
+ </a>
441
+ <dd>Raises an <a href="#ODBC::Error">ODBC::Error</a> exception with
442
+ String error message <var>value</var>.
443
+ </dl>
444
+ </div>
445
+ <hr>
446
+ <div>
447
+ <h2><a name="ODBC::Environment">ODBC::Environment</a></h2>
448
+ <p>
449
+ The class to represent the environment for
450
+ <a href="#ODBC::Database">ODBC::Database</a>s.
451
+ </p>
452
+ <h3>super class:</h3>
453
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
454
+ <h3>methods:</h3>
455
+ <dl>
456
+ <dt><a name="ODBC::Environment.connect"><code>connect(<var>dsn</var>,[<var>user</var>,<var>passwd</var>])</code></a>
457
+ <dd>Connects to an ODBC data source and returns a
458
+ <a href="#ODBC::Database">ODBC::Database</a> object.
459
+ Options are:
460
+ <dl>
461
+ <dd><var>dsn</var>: Data source name (String or
462
+ <a href="#ODBC::DSN">ODBC::DSN</a>)
463
+ <dd><var>user</var>: Login user name (String)
464
+ <dd><var>passwd</var>: Login password (String)
465
+ </dl>
466
+ <dt><a name="ODBC::Environment.environment"><code>environment</code>
467
+ </a>
468
+ <dd>Returns the <a href="#ODBC::Environment">ODBC::Environment</a>
469
+ of the object.
470
+ <dt> <a name="commit"><code>commit</code></a>
471
+ <dd>Commits the current transaction.
472
+ <dt> <a name="rollback"><code>rollback</code></a>
473
+ <dd>Rollbacks the current transaction.
474
+ <dt><a name="ODBC::Environment.transaction">
475
+ <code>transaction {|<var>env</var>| <var>block</var>}</code></a>
476
+ <dd>First commits the current transaction, then executes the given
477
+ block where the paramater is the object itself (an environment or
478
+ a database connection). If the block raises an exception, the
479
+ transaction is rolled back, otherwise committed.
480
+ <dt><a name="ODBC::Environment.connection_pooling">
481
+ <code>connection_pooling[=<var>value</var>]</code></a>
482
+ <dd>Gets or sets the connection pooling attribute of the environment.
483
+ <dt><a name="ODBC::Environment.cp_match">
484
+ <code>cp_match[=<var>value</var>]</code></a>
485
+ <dd>Gets or sets the connection pooling match attribute of the
486
+ environment.
487
+ <dt><a name="ODBC::Environment.odbc_version">
488
+ <code>odbc_version[=<var>value</var>]</code></a>
489
+ <dd>Gets or sets the ODBC version attribute of the environment.
490
+ </dl>
491
+ <h3>singleton methods:</h3>
492
+ <dl>
493
+ <dt><a name="ODBC::Environment.new"><code>new</code></a>
494
+ <dd>Returns a new <a href="#ODBC::Environment">ODBC::Environment</a>
495
+ object.
496
+ </dl>
497
+ </div>
498
+ <hr>
499
+ <div>
500
+ <h2><a name="ODBC::Database">ODBC::Database</a></h2>
501
+ <p>
502
+ The class to represent a connection to an ODBC data source.
503
+ </p>
504
+ <p>
505
+ When underlying ODBC SQL functions report an error,
506
+ an <a href="#ODBC::Error">ODBC::Error</a>
507
+ exception with a corresponding error message from the ODBC
508
+ driver manager and/or driver is raised.
509
+ </p>
510
+ <h3>super class:</h3>
511
+ <code><a href="#ODBC::Environment">ODBC::Environment</a></code>
512
+ <h3>methods:</h3>
513
+ <dl>
514
+ <dt><a name="connected?"><code>connected?</code></a>
515
+ <dd>Returns <code>true</code> when the object is in connected
516
+ state, false otherwise.
517
+ <dt><a name="drvconnect"><code>drvconnect(<var>drv</var>)</code></a>
518
+ <dd>Connect to a data source specified by <var>drv</var>
519
+ (<a href="#ODBC::Driver">ODBC::Driver</a>).
520
+ <dt><a name="disconnect">
521
+ <code>disconnect(<var>no_drop=false</var>)</code></a>
522
+ <dd>Disconnects from the data source, all active statements for the
523
+ connection are dropped except when the <var>no_drop</var> argument
524
+ is true. The method returns true when the connection was released,
525
+ false otherwise.
526
+ <dt><a name="newstmt"><code>newstmt</code></a>
527
+ <dd>Returns a new <a href="#ODBC::Statement">ODBC::Statement</a>
528
+ object without preparing or executing a SQL statement. This allows
529
+ to use
530
+ <a href="#stmt_set_option"><code>ODBC::Statement.set_option</code></a>
531
+ to set special options on the statement before actual execution.
532
+ <dt><a name="tables"><code>tables([<var>pattern</var>])</code></a>
533
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a> with
534
+ information of all or some (<var>pattern</var> String given)
535
+ tables of the data source.
536
+ <dt><a name="columns"><code>columns([<var>table</var>[,<var>column</var>]])</code></a>
537
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
538
+ with column information
539
+ of the given <var>table</var> (String) and optional
540
+ <var>column</var> (String).
541
+ <dt><a name="indexes">
542
+ <code>indexes([<var>table</var>[,<var>unique</var>]])</code></a>
543
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
544
+ with index information
545
+ of the given <var>table</var> (String). If <var>unique</var>
546
+ is given and true, information for unique indexes only is
547
+ returned.
548
+ <dt><a name="types"><code>types([<var>tcode</var>])</code></a>
549
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
550
+ with type information
551
+ of the numeric SQL type <var>tcode</var> or all types if
552
+ <var>tcode</var> is omitted.
553
+ <dt><a name="primary_keys">
554
+ <code>primary_keys([<var>table</var>])</code></a>
555
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
556
+ with primary key information of the given <var>table</var> (String).
557
+ <dt><a name="foreign_keys">
558
+ <code>foreign_keys([<var>table</var>])</code></a>
559
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
560
+ with foreign key information of the given <var>table</var> (String).
561
+ <dt><a name="table_privileges">
562
+ <code>table_privileges([<var>table</var>])</code></a>
563
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
564
+ with owner/right information of the given <var>table</var> (String).
565
+ <dt><a name="procedures"><code>procedures([<var>p</var>])</code></a>
566
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
567
+ with information about stored procedures.
568
+ <dt><a name="procedure_columns">
569
+ <code>procedure_columns([<var>p</var>])</code></a>
570
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
571
+ with information about stored procedures.
572
+ <dt><a name="special_columns">
573
+ <code>special_columns([<var>table</var>[,<var>id</var>,<var>scope</var>]])</code></a>
574
+ <dd>Returns an <a href="#ODBC::Statement">ODBC::Statement</a>
575
+ with column information
576
+ of the given <var>table</var> (String) indicating the
577
+ optimal unique or identifying columns.
578
+ <var>id</var> may
579
+ be specified as <code>ODBC::SQL_BEST_ROWID</code> or
580
+ <code>ODBC::SQL_ROW_VER</code>. <var>scope</var> may be
581
+ specified as <code>ODBC::SQL_SCOPE_CURROW</code>,
582
+ <code>ODBC::SQL_SCOPE_TRANSACTION</code>, or
583
+ <code>ODBC::SQL_SCOPE_SESSION</code>. If omitted the
584
+ defaults are <code>ODBC::SQL_BEST_ROWID</code> and
585
+ <code>ODBC::SQL_SCOPE_CURROW</code>.
586
+ <dt><a name="get_info">
587
+ <code>get_info(<var>info_type</var>[,<var>sql_type</var>])</code></a>
588
+ <dd>Retrieves database meta data according to <var>info_type</var>
589
+ and returns numbers or strings. <var>info_type</var> may be specified
590
+ as integer or string. To force interpretation of the return value
591
+ of the underlying ODBC function <code>SQLGetInfo()</code> as a
592
+ specific Ruby type the optional parameter <var>sql_type</var>
593
+ can be given as e.g.
594
+ <code>ODBC::SQL_SMALLINT</code> (yielding integer),
595
+ <code>ODBC::SQL_INTEGER</code> (yielding integer), and
596
+ <code>ODBC::SQL_CHAR</code> (yielding string).
597
+ <dt><a name="run"><code>run(<var>sql</var>[,<var>args...</var>])</code></a>
598
+ <dd>Prepares and executes the query specified by <var>sql</var>
599
+ with parameters bound from <var>args</var> and returns an
600
+ <a href="#ODBC::Statement">ODBC::Statement</a> or nil, if
601
+ the query did not produce a result set, e.g. when executing
602
+ SQL insert, delete, or update statements.
603
+ <dt><a name="do"><code>do(<var>sql</var>[,<var>args...</var>])</code></a>
604
+ <dd>Prepares and executes the query as in
605
+ <a href="#run"><code>run</code></a>,
606
+ but returns the number of result rows and automatically drops
607
+ the statement. Useful for SQL insert, delete, or update statements.
608
+ <dt><a name="prepare"><code>prepare(<var>sql</var>)</code></a>
609
+ <dd>Prepares the query specified by <var>sql</var> and returns
610
+ an <a href="#ODBC::Statement">ODBC::Statement</a>.
611
+ <dt><a name="proc"><code>proc(<var>sql</var>,[<var>type</var>,<var>size</var>[,<var>n</var>=1]])
612
+ {|<var>stmt</var>| <var>block</var>}</code></a>
613
+ <dd>Prepares the query specified by <var>sql</var> within a
614
+ <a href="#ODBCProc">ODBCProc</a> and returns that procedure.
615
+ When the procedure is called, the statement is executed with
616
+ the procedure's arguments bound to the statement's parameters
617
+ and the statement is bound as parameter in the block, e.g.
618
+ <pre># add customer given name and id
619
+ # and return number of affected rows
620
+
621
+ addcust = dbc.proc("insert into customer values(?, ?)") { |stmt|
622
+ stmt.nrows
623
+ }
624
+
625
+ addcust.call("J.R. User", 9999)
626
+
627
+ # alternative to call: addcust["J.R. User", 9999]</pre>
628
+ The optional arguments <var>type</var>, <var>size</var>, and
629
+ <var>n</var>,
630
+ make the n-th statement parameter into an output parameter
631
+ with that given ODBC data type and size. That statement
632
+ parameter must be omitted when the <a href="#ODBCProc">ODBCProc</a>
633
+ is called. This can be useful for wrapping stored procedures, e.g.
634
+ <pre># wrap statement with output parameter
635
+
636
+ aproc = dbc.proc("{ ? = call stored_proc(?) }", ODBC::SQL_INTEGER, 4) {}
637
+
638
+ # call this statement/procedure, output parameter is result
639
+
640
+ result = aproc.call(99)
641
+
642
+ # alternative to call: result = aproc[99]</pre>
643
+ Finalization of an <a href="#ODBCProc">ODBCProc</a> can be
644
+ done according to this code snippet
645
+ <pre># aproc is wrapped statement, finalize it now
646
+
647
+ aproc.statement.drop</pre>
648
+ <dt><a name="dbc_get_option">
649
+ <code>get_option(<var>option</var>)</code></a>
650
+ <dd>Gets a connection level option. <var>option</var> can be a
651
+ module constant, e.g. <var>SQL_MAX_ROWS</var>, a number, or a
652
+ string. This method returns the integer value of that option.
653
+ <dt><a name="dbc_set_option">
654
+ <code>set_option(<var>option</var>,<var>intval</var>)</code></a>
655
+ <dd>Sets a connection level option. <var>option</var> can be a
656
+ module constant, e.g. <var>SQL_MAX_ROWS</var>, a number, or a
657
+ string. The second parameter <var>intval</var> can be used to
658
+ set driver-specific statement options.
659
+ <dt><a name="autocommit"><code>autocommit[=<var>bool</var>]</code></a>
660
+ <dd>Sets or queries the autocommit option of the connection.
661
+ <dt><a name="concurrency">
662
+ <code>concurrency[=<var>intval</var>]</code></a>
663
+ <dd>Sets or queries the concurrency mode of cursors opened on
664
+ the connection.
665
+ <dt><a name="maxrows"><code>maxrows[=<var>intval</var>]</code></a>
666
+ <dd>Sets or queries the maximum rows returned in result sets from
667
+ the connection.
668
+ <dt><a name="timeout"><code>timeout[=<var>intval</var>]</code></a>
669
+ <dd>Sets or queries the number of seconds to wait for queries to
670
+ execute on the connection before returning.
671
+ <dt><a name="maxlength"><code>maxlength[=<var>intval</var>]</code></a>
672
+ <dd>Sets or queries the maximum amount of data that will be returned
673
+ from a character or binary column.
674
+ <dt><a name="cursortype">
675
+ <code>cursortype[=<var>intval</var>]</code></a>
676
+ <dd>Sets or queries the cursor type used for fetches.
677
+ <dt><a name="noscan"><code>noscan[=<var>bool</var>]</code></a>
678
+ <dd>Sets or queries whether the driver scans SQL strings for ODBC
679
+ escape clauses.
680
+ <dt><a name="rowsetsize"><code>rowsetsize</code></a>
681
+ <dd>Returns the number of rows in a rowset fetched internally by a
682
+ call o SQLExtendedFetch (hardcoded to 1).
683
+ <dt><a name="ignorecase"><code>ignorecase[=<var>bool</var>]</code><a>
684
+ <dd>Sets or queries the uppercase conversion for column names. If
685
+ turned on (<var>bool</var> is true),
686
+ <a href="#ODBC::Statement">ODBC::Statement</a>s
687
+ created by database methods will report column names in
688
+ <a href="#ODBC::Column">ODBC::Column</a>
689
+ or in the statement fetch methods
690
+ as uppercase strings. Otherwise (the default) column names are
691
+ passed unmodified.
692
+ <dt><a name="drop_all"><code>drop_all</code></a>
693
+ <dd>Releases the resources of all open
694
+ <a href="#ODBC::Statement">ODBC::Statement</a>s in this
695
+ database connection.
696
+ <dt><a name="use_time"><code>use_time[=<var>bool</var>]</code></a>
697
+ <dd>Sets or queries the mapping of SQL_DATE, SQL_TIME, and
698
+ SQL_TIMESTAMP data types to Ruby objects. When true,
699
+ SQL_DATE is mapped to Ruby Date objects, SQL_TIME and
700
+ SQL_TIMESTAMP are mapped to Ruby Time objects. Otherwise (default)
701
+ <a href="#ODBC::Date">ODBC::Date</a>,
702
+ <a href="#ODBC::Time">ODBC::Time</a>, and
703
+ <a href="#ODBC::Time">ODBC::TimeStamp</a> are used.
704
+ <dt><a name="use_utc"><code>use_utc[=<var>bool</var>]</code></a>
705
+ <dd>Sets or queries the timezone applied on SQL_DATE, SQL_TIME, and
706
+ SQL_TIMESTAMP data types to Ruby objects. When true,
707
+ Ruby Date and Time objects are represented in UTC, when
708
+ false (default) in the local timezone.
709
+ </dl>
710
+ <h3>singleton methods:</h3>
711
+ <dl>
712
+ <dt><a name="ODBC::new"><code>new</code></a>
713
+ <dd>Creates an unconnected ODBC object, e.g. for a later
714
+ <code>drvconnect</code> method call.
715
+ <dt><a name="ODBC::new2"><code>new(<var>dsn</var>,[<var>user</var>,<var>passwd</var>])</code></a>
716
+ <dd>Connect to an ODBC data source. Options are:
717
+ <dl>
718
+ <dd><var>dsn</var>: Data source name (String or
719
+ <a href="#ODBC::DSN">ODBC::DSN</a>)
720
+ <dd><var>user</var>: Login user name (String)
721
+ <dd><var>passwd</var>: Login password (String)
722
+ </dl>
723
+ </dl>
724
+ <h3>Remarks:</h3>
725
+ The <a href="#run"><code>run</code></a>,
726
+ <a href="#prepare"><code>prepare</code></a>,
727
+ <a href="#do"><code>do</code></a>, and info methods
728
+ (e.g. <a href="#tables"><code>tables</code></a>)
729
+ can be invoked with a block. In this case the block is executed with
730
+ the <a href="#ODBC::Statement">ODBC::Statement</a> as parameter. The
731
+ <a href="#run"><code>run</code></a> and
732
+ <a href="#do"><code>do</code></a> methods use the ODBC API
733
+ function <code>SQLExecDirect()</code> when the SQL statement has no
734
+ parameters.
735
+ </div>
736
+ <hr>
737
+ <div>
738
+ <h2><a name="ODBC::Statement">ODBC::Statement</a></h2>
739
+ <p>
740
+ The class to represent a query and its query result.
741
+ The object of this class is created as the result of every query.
742
+ You may need to invoke the <a href="#close"><code>close</code></a>
743
+ or <a href="#drop"><code>drop</code></a> methods for the
744
+ finished object for better memory performance.
745
+ </p>
746
+ <p>
747
+ When underlying ODBC SQL functions report an error,
748
+ an <a href="#ODBC::Error">ODBC::Error</a>
749
+ exception with a corresponding error message from the ODBC driver
750
+ manager and/or driver is raised.
751
+ </p>
752
+ <p>
753
+ ODBC to Ruby type mapping:
754
+ </p>
755
+ <table><tr><th>ODBC</th><th>Ruby</th></tr>
756
+ <tr><td>SQL_SMALLINT, SQL_INTEGER, SQL_TINYINT, SQL_BIT</td>
757
+ <td>T_FIXNUM, T_BIGNUM</td></tr>
758
+ <tr><td>SQL_FLOAT, SQL_DOUBLE, SQL_REAL</td><td>T_FLOAT</td></tr>
759
+ <tr><td>SQL_DATE, SQL_TYPE_DATE</td>
760
+ <td><a href="#ODBC::Date">ODBC::Date</a> or Date,
761
+ see <a href="#use_time">ODBC::Database.use_time</a>
762
+ </td></tr>
763
+ <tr><td>SQL_TIME, SQL_TYPE_TIME</td>
764
+ <td><a href="#ODBC::Time">ODBC::Time</a> or Time,
765
+ see <a href="#use_time">ODBC::Database.use_time</a>
766
+ </td></tr>
767
+ <tr><td>SQL_TIMESTAMP, SQL_TYPE_TIMESTAMP</td>
768
+ <td><a href="#ODBC::TimeStamp">ODBC::TimeStamp</a> or Time,
769
+ see <a href="#use_time">ODBC::Database.use_time</a>
770
+ </td></tr>
771
+ <tr><td>all others</td><td>T_STRING</td></tr>
772
+ </table>
773
+ <h3>super class:</h3>
774
+ <p>
775
+ <code><a href="#ODBC::Database">ODBC::Database</a></code>
776
+ </p>
777
+ <h3>mixins:</h3>
778
+ <p>
779
+ <code>Enumerable</code>
780
+ </p>
781
+ <h3>methods:</h3>
782
+ <dl>
783
+ <dt><a name="cancel"><code>cancel</code></a>
784
+ <dd>Cancel and close the
785
+ <a href="#ODBC::Statement">ODBC::Statement</a>.
786
+ <dt><a name="close"><code>close</code></a>
787
+ <dd>Close the <a href="#ODBC::Statement">ODBC::Statement</a>.
788
+ <dt><a name="drop"><code>drop</code></a>
789
+ <dd>Close and free the <a href="#ODBC::Statement">ODBC::Statement</a>.
790
+ <dt><a name="column"><code>column(<var>n</var>)</code></a>
791
+ <dd>Returns information of the n-th column of the query result
792
+ as <a href="#ODBC::Column">ODBC::Column</a>.
793
+ <dt><a name="columns1"><code>columns(<var>as_ary=false</var>)</code></a>
794
+ <dd>Returns a hash of column information keyed by column names
795
+ (Strings) of the query result. If <var>as_ary</var> is true,
796
+ an array is returned. In both cases the elements are
797
+ <a href="#ODBC::Column">ODBC::Column</a>s. If the hash keys
798
+ happen to be not unique later columns get their column number
799
+ appended, e.g. <code>FOOBAR</code>, <code>FOOBAR#1</code>.
800
+ <dt><a name="columns2"><code>columns
801
+ {|<var>col</var>| <var>block</var>}</code></a>
802
+ <dd>Iterates over the columns of the query result with <var>col</var>
803
+ bound to each <a href="#ODBC::Column">ODBC::Column</a>.
804
+ <dt><a name="ncols"><code>ncols</code></a>
805
+ <dd>Returns the number of columns of the query result.
806
+ <dt><a name="nrows"><code>nrows</code></a>
807
+ <dd>Returns the number of rows of the query result.
808
+ <dt><a name="cursorname"><code>cursorname[=<var>name</var>]</code></a>
809
+ <dd>Returns or sets the cursor name of the statement.
810
+ <dt><a name="ignorecase2"><code>ignorecase[=<var>bool</var>]</code><a>
811
+ <dd>Same as
812
+ <a href="#ignorecase"><code>ODBC::Database.ignorecase</code></a>
813
+ but affecting this statement only.
814
+ Inherited by the current state of the
815
+ <a href="#ODBC::Database">ODBC::Database</a> at the time the
816
+ statement is created.
817
+ <dt><a name="fetch"><code>fetch</code></a>
818
+ <dd>Returns the next row of the query result as an array.
819
+ <dt><a name="fetch_first"><code>fetch_first</code></a>
820
+ <dd>Returns the first row of the query result as an array.
821
+ <dt><a name="fetch_scroll"><code>fetch_scroll(<var>direction</var>,
822
+ <var>offset=1</var>)</code></a>
823
+ <dd>Returns the row addressed by <var>direction</var>, e.g.
824
+ <code>SQL_FETCH_LAST</code> as an array. <var>offset</var> is
825
+ used for <code>SQL_FETCH_RELATIVE</code> and
826
+ <code>SQL_FETCH_ABSOLUTE</code>.
827
+ <dt><a name="fetch_many"><code>fetch_many(<var>count</var>)</code></a>
828
+ <dd>Returns an array of the next <var>count</var> rows of the query
829
+ result, where each row is an array.
830
+ <dt><a name="fetch_all"><code>fetch_all</code></a>
831
+ <dd>Same as <code>fetch_many</code> except that all remaining rows
832
+ are returned.
833
+ <dt><a name="fetch_hash">
834
+ <code>fetch_hash(<var>with_table_names=false</var>,<var>use_sym=false</var>)</code></a>
835
+ <dd>Returns the next row of the query result as a hash keyed by
836
+ column names. If <var>with_table_names</var> is true,
837
+ the keys are combined table/column names. For uniqueness of keys
838
+ the same rules as in the <a href="#columns1"><code>columns</code></a>
839
+ method are applied. If <var>use_sym</var> is true,
840
+ the keys are formed by intern'ing the (table and) column names.
841
+ Alternatively, one hash argument can be presented to
842
+ <code>fetch_hash</code>, e.g.
843
+ <code>{ :key =&gt; :Symbol, :table_names =&gt; false }</code> or
844
+ <code>{ :key =&gt; :String, :table_names =&gt; true }</code> or
845
+ <code>{ :key =&gt; :Fixnum }</code>.
846
+ <dt><a name="each"><code>each {|<var>row</var>|
847
+ <var>block</var>}</code></a>
848
+ <dd>Iterates over the query result, performing a <code>fetch</code>
849
+ for each row.
850
+ <dt><a name="each_hash">
851
+ <code>each_hash(<var>with_table_names=false</var>,<var>use_sym=false</var>)
852
+ {|<var>row</var>| <var>block</var>}</code></a>
853
+ <dd>Iterates over the query result, performing a
854
+ <code>fetch_hash</code> for each row. The same
855
+ rules for arguments as in <code>fetch_hash</code> apply.
856
+ <dt><a name="execute"><code>execute([<var>args...</var>])</code></a>
857
+ <dd>Binds <var>args</var> to current query and executes it.
858
+ <dt><a name="stmt_run">
859
+ <code>run(<var>sql</var>[,<var>args...</var>])</code></a>
860
+ <dd>Prepares and executes the query specified by <var>sql</var>
861
+ with parameters bound from <var>args</var>.
862
+ <dt><a name="stmt_prep">
863
+ <code>prepare(<var>sql</var>)</code></a>
864
+ <dd>Prepares the query specified by <var>sql</var>.
865
+ <dt><a name="more_results"><code>more_results</code></a>
866
+ <dd>Returns true and switches over to the next result set,
867
+ if the query produced more than one result set. Otherwise
868
+ returns false.
869
+ <dt><a name="stmt_get_option">
870
+ <code>get_option(<var>option</var>)</code></a>
871
+ <dd>Gets a statement level option. <var>option</var> can be a
872
+ module constant, e.g. <var>SQL_MAX_ROWS</var>, a number, or a
873
+ string. This method returns the integer value of that option.
874
+ <dt><a name="stmt_set_option">
875
+ <code>set_option(<var>option</var>,<var>intval</var>)</code></a>
876
+ <dd>Sets a statement level option. <var>option</var> can be a
877
+ module constant, e.g. <var>SQL_MAX_ROWS</var>, a number, or a
878
+ string. The second parameter <var>intval</var> can be used to
879
+ set driver-specific statement options.
880
+ <dt><a name="stmt_concurrency">
881
+ <code>concurrency[=<var>intval</var>]</code></a>
882
+ <dd>Sets or queries the concurrency mode of cursors opened on
883
+ the statement.
884
+ <dt><a name="stmt_maxrows"><code>maxrows[=<var>intval</var>]</code></a>
885
+ <dd>Sets or queries the maximum rows returned by the statement.
886
+ <dt><a name="stmt_timeout"><code>timeout[=<var>intval</var>]</code></a>
887
+ <dd>Sets or queries the number of seconds to wait for the statement
888
+ to execute before returning.
889
+ <dt><a name="stmt_maxlength">
890
+ <code>maxlength[=<var>intval</var>]</code></a>
891
+ <dd>Sets or queries the maximum amount of data that will be returned
892
+ from a character or binary column.
893
+ <dt><a name="stmt_cursortype">
894
+ <code>cursortype[=<var>intval</var>]</code></a>
895
+ <dd>Sets or queries the cursor type used for fetches.
896
+ <dt><a name="stmt_noscan"><code>noscan[=<var>bool</var>]</code></a>
897
+ <dd>Sets or queries whether the driver scans SQL strings for ODBC
898
+ escape clauses.
899
+ <dt><a name="stmt_rowsetsize"><code>rowsetsize</code></a>
900
+ <dd>Returns the number of rows in a rowset fetched internally by
901
+ a call to <var>SQLExtendedFetch</var> (hardcoded to 1).
902
+ <dt><a name="stmt_nparams"><code>nparams</code></a>
903
+ <dd>Returns the number of parameters of the statement.
904
+ <dt><a name="parameter"><code>parameter(<var>n</var>)</code></a>
905
+ <dd>Returns information of the n-th parameter of the query
906
+ as <a href="#ODBC::Parameter">ODBC::Parameter</a>.
907
+ <dt><a name="parameters"><code>parameters</code></a>
908
+ <dd>Returns an array of
909
+ <a href="#ODBC::Parameter">ODBC::Parameter</a>s describing
910
+ all parameters of the query.
911
+ <dt><a name="stmt_param_type"><code>param_type(<var>n</var>[,<var>type</var>,<var>coldef</var>,<var>scale</var>])</code></a>
912
+ <dd>Allows to override the type of parameter <var>n</var>
913
+ and returns the current type. This can be useful
914
+ when the ODBC driver does not provide proper type information
915
+ on <var>SQLDescribeParam</var>.
916
+ <dt><a name="stmt_param_iotype"><code>param_iotype(<var>n</var>[,<var>iotype</var>])</code></a>
917
+ <dd>Allows to change the input/output type of parameter <var>n</var>
918
+ and returns the current input/output type. By
919
+ default, all parameters are <var>ODBC::SQL_PARAM_INPUT</var>.
920
+ When calling a stored procedure in the statement, the output
921
+ parameter must be altered using this method, e.g.
922
+ <pre># assume 1st parameter is input, 2nd is output
923
+ stmt = conn.prepare("call stored_proc( ?, ?)")
924
+ # setup 2nd for output of an integer
925
+ stmt.param_iotype(2, ODBC::SQL_PARAM_OUTPUT)
926
+ stmt.param_output_type(2, ODBC::SQL_INTEGER)
927
+ stmt.param_output_size(2, 4)
928
+ # execute stmt and retrieve value of output parameter
929
+ stmt.execute(42, nil)
930
+ stmt.fetch_all
931
+ out_value = stmt.param_output_value(2);</pre>
932
+ <dt><a name="stmt_param_output_type"><code>param_output_type(<var>n</var>[,<var>type</var>])</code></a>
933
+ <dd>Allows to change the SQL type of output parameter <var>n</var>
934
+ and returns the current type. For further
935
+ information see the sample code in the
936
+ <a href="#stmt_param_iotype"><code>param_iotype</code></a> method.
937
+ <dt><a name="stmt_param_output_size"><code>param_output_size(<var>n</var>[,<var>size</var>])</code></a>
938
+ <dd>Allows to change the byte size of the buffer for output parameter
939
+ <var>n</var> and returns the current size.
940
+ For further information see the sample code in the
941
+ <a href="#stmt_param_iotype"><code>param_iotype</code></a> method.
942
+ <dt><a name="stmt_param_output_value"><code>param_output_value(<var>n</var>)</code></a>
943
+ <dd>Returns the value of the output parameter <var>n</var>.
944
+ For further information see the sample code in the
945
+ <a href="#stmt_param_iotype"><code>param_iotype</code></a> method.
946
+ <dt><a name="make_proc1"><code>make_proc([<var>n</var>])</code></a>
947
+ <dd>Wraps the statement into a <a href="#ODBCProc">ODBCProc</a> object
948
+ and returns that object. The optional <var>n</var> argument is
949
+ the parameter number of the statement which is used as output
950
+ parameter in the wrapped <a href="#ODBCProc">ODBCProc</a>. For
951
+ further information refer to the samples in the description of
952
+ <a href="#proc"><code>ODBC::Database.proc</code></a>.
953
+ </dl>
954
+ <h3>singleton methods:</h3>
955
+ <dl>
956
+ <dt><a name="make_proc2"><code>make_proc(<var>stmt</var>,[<var>n</var>])</code></a>
957
+ <dd>Wraps the statement <var>stmt</var> into a
958
+ <a href="#ODBCProc">ODBCProc</a> object
959
+ and returns that object. The optional <var>n</var> argument is
960
+ the parameter number of the statement which is used as output
961
+ parameter in the wrapped <a href="#ODBCProc">ODBCProc</a>. For
962
+ further information refer to the samples in the description of
963
+ <a href="#proc"><code>ODBC::Database.proc</code></a>.
964
+ </dl>
965
+ <h3>Remarks:</h3>
966
+ The <a href="#fetch"><code>fetch</code></a>,
967
+ <a href="#fetch_hash"><code>fetch_hash</code></a>,
968
+ and <a href="#execute"><code>execute</code></a>
969
+ methods can be invoked with a block. In this case the block is
970
+ executed with one row of the result set (<code>fetch</code> and
971
+ <code>fetch_hash</code>) or with the
972
+ <a href="#ODBC::Statement">ODBC::Statement</a> (<code>execute</code>)
973
+ as parameter.
974
+ <p>If the <a href="#ignorecase2"><code>ignorecase</code></a> option
975
+ is turned on, all column names used in the <code>column</code>,
976
+ <code>columns</code>, and <code>*_hash</code> methods are converted to
977
+ upper case.
978
+ </div>
979
+ <hr>
980
+ <div>
981
+ <h2><a name="ODBC::Column">ODBC::Column</a></h2>
982
+ <p>
983
+ The class to represent (read-only) information of a column of a query.
984
+ Objects of this class are created as result of the
985
+ <a href="#column"><code>column</code></a>
986
+ and <a href="#columns1"><code>columns</code></a> methods of
987
+ <a href="#ODBC::Statement">ODBC::Statement</a>.
988
+ </p>
989
+ <h3>super class:</h3>
990
+ <p>
991
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
992
+ </p>
993
+ <h3>methods:</h3>
994
+ <dl>
995
+ <dt><code>name</code></a>
996
+ <dd>Returns the column name (String).
997
+ <dt><code>table</code></a>
998
+ <dd>Returns the table name (String).
999
+ <dt><code>length</code></a>
1000
+ <dd>Returns the length of the column (Integer).
1001
+ <dt><code>nullable</code></a>
1002
+ <dd>Returns the nullable state of the column (Boolean).
1003
+ <dt><code>searchable</code></a>
1004
+ <dd>Returns the searchable state of the column (Boolean).
1005
+ <dt><code>unsigned</code></a>
1006
+ <dd>Returns the unsigned flag of the column (Boolean).
1007
+ <dt><code>precision</code></a>
1008
+ <dd>Returns the precision of the column (Integer).
1009
+ <dt><code>scale</code></a>
1010
+ <dd>Returns the scale of the column (Integer).
1011
+ <dt><code>type</code></a>
1012
+ <dd>Returns the SQL type of the column (Integer).
1013
+ <dt><code>autoincrement</code></a>
1014
+ <dd>Returns true if the column automatically increments,
1015
+ false, if not, and nil if that information cannot be
1016
+ determined from the column.
1017
+ </dl>
1018
+ </div>
1019
+ <hr>
1020
+ <div>
1021
+ <h2><a name="ODBC::Parameter">ODBC::Parameter</a></h2>
1022
+ <p>
1023
+ The class to represent (read-only) information of a parameter of a
1024
+ query.
1025
+ Objects of this class are created as result of the
1026
+ <a href="#parameter"><code>parameter</code></a> and
1027
+ <a href="#parameters"><code>parameters</code><a> methods of
1028
+ <a href="#ODBC::Statement">ODBC::Statement</a>.
1029
+ </p>
1030
+ <h3>super class:</h3>
1031
+ <p>
1032
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
1033
+ </p>
1034
+ <h3>methods:</h3>
1035
+ <dl>
1036
+ <dt><code>type</code></a>
1037
+ <dd>Returns the parameter's type, e.g. ODBC::SQL_CHAR.
1038
+ <dt><code>precision</code></a>
1039
+ <dd>Returns the parameter's precision (Integer).
1040
+ <dt><code>length</code></a>
1041
+ <dd>Returns the parameter's scale (Integer).
1042
+ <dt><code>nullable</code></a>
1043
+ <dd>Returns the nullable state of the column (Boolean).
1044
+ <dt><code>iotype</code></a>
1045
+ <dd>Returns the parameter's input/output type,
1046
+ e.g. ODBC::SQL_PARAM_INPUT.
1047
+ <dt><code>output_type</code></a>
1048
+ <dd>Returns the parameter's output type, only useful when the
1049
+ parameter is an output parameter (ODBC::SQL_PARAM_OUTPUT or
1050
+ ODBC::SQL_PARAM_INPUT_OUTPUT).
1051
+ <dt><code>output_size</code></a>
1052
+ <dd>Returns the parameter's output buffer size, only useful when the
1053
+ parameter is an output parameter (ODBC::SQL_PARAM_OUTPUT).
1054
+ </dl>
1055
+ </div>
1056
+ <hr>
1057
+ <div>
1058
+ <h2><a name="ODBC::Date">ODBC::Date</a></h2>
1059
+ <p>
1060
+ The class to represent a <code>SQL_DATE</code> column in a table
1061
+ or a <code>SQL_DATE</code> query parameter.
1062
+ </p>
1063
+ <h3>super class:</h3>
1064
+ <p>
1065
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
1066
+ </p>
1067
+ <h3>mixins:</h3>
1068
+ <p>
1069
+ <code>Comparable</code>
1070
+ </p>
1071
+ <h3>methods:</h3>
1072
+ <dl>
1073
+ <dt><a name="date.cmp"><code><=>(<var>adate</var>)</code></a>
1074
+ <dd>Comparison, compares date with <var>adate</var> and returns
1075
+ 0, 1, or -1.
1076
+ <dt><a name="date.day"><code>day[=<var>num</var>]</code></a>
1077
+ <dd>Returns or sets the day component of the date object.
1078
+ <dt><a name="date.month"><code>month[=<var>num</var>]</code></a>
1079
+ <dd>Returns or sets the month component of the date object.
1080
+ <dt><a name="date.year"><code>year[=<var>num</var>]</code></a>
1081
+ <dd>Returns or sets the year component of the date object.
1082
+ <dt><a name="date.to_s"><code>to_s</code></a>
1083
+ <dd>Returns a string representation of the object with format
1084
+ <code>YYYY-MM-DD</code>.
1085
+ <dt><a name="date.clone"><code>clone</code></a>
1086
+ <dd>Returns a fresh copy of the date object.
1087
+ </dl>
1088
+ <h3>singleton methods:</h3>
1089
+ <dl>
1090
+ <dt><a name="date.new"><code>new([<var>year</var>, <var>month</var>,
1091
+ <var>day</var>])</code></a>
1092
+ <dt><code>new(<var>date</var>)</code>
1093
+ <dt><code>new(<var>time</var>)</code>
1094
+ <dt><code>new(<var>string</var>)</code>
1095
+ <dd>Creates a new date object from numeric values or from
1096
+ a <code>Date</code>, <code>Time</code>, or <code>String</code>
1097
+ object. Recognized string formats are e.g.
1098
+ <pre>2001-01-01
1099
+ 2001-01-01 12:00:01
1100
+ {ts '2001-01-01 12:00:01.1'}
1101
+ {d '2001-01-01'}</pre>
1102
+ </dl>
1103
+ </div>
1104
+ <hr>
1105
+ <div>
1106
+ <h2><a name="ODBC::Time">ODBC::Time</a></h2>
1107
+ <p>
1108
+ The class to represent a <code>SQL_TIME</code> column in a table
1109
+ or a <code>SQL_TIME</code> query parameter.
1110
+ </p>
1111
+ <h3>super class:</h3>
1112
+ <p>
1113
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
1114
+ </p>
1115
+ <h3>mixins:</h3>
1116
+ <p>
1117
+ <code>Comparable</code>
1118
+ </p>
1119
+ <h3>methods:</h3>
1120
+ <dl>
1121
+ <dt><a name="time.cmp"><code><=>(<var>atime</var>)</code></a>
1122
+ <dd>Comparison, compares time with <var>atime</var> and returns
1123
+ 0, 1, or -1.
1124
+ <dt><a name="time.second"><code>second[=<var>num</var>]</code></a>
1125
+ <dd>Returns or sets the second component of the time object.
1126
+ <dt><a name="time.minute"><code>minute[=<var>num</var>]</code></a>
1127
+ <dd>Returns or sets the minute component of the time object.
1128
+ <dt><a name="time.hour"><code>hour[=<var>num</var>]</code></a>
1129
+ <dd>Returns or sets the hour component of the time object.
1130
+ <dt><a name="time.to_s"><code>to_s</code></a>
1131
+ <dd>Returns a string representation of the object with format
1132
+ <code>hh:mm:ss</code>.
1133
+ <dt><a name="time.clone"><code>clone</code></a>
1134
+ <dd>Returns a fresh copy of the time object.
1135
+ </dl>
1136
+ <h3>singleton methods:</h3>
1137
+ <dl>
1138
+ <dt><a name="time.new"><code>new([<var>hour</var>, <var>minute</var>,
1139
+ <var>second</var>])</code></a>
1140
+ <dt><code>new(<var>time</var>)</code>
1141
+ <dt><code>new(<var>string</var>)</code>
1142
+ <dd>Creates a new time object from numeric values or from
1143
+ a <code>Time</code> or <code>String</code> object.
1144
+ Recognized string formats are e.g.
1145
+ <pre>12:00:01
1146
+ 2001-01-01 12:00:01
1147
+ {ts '2001-01-01 12:00:01.1'}
1148
+ {t '12:00:01'}</pre>
1149
+ </dl>
1150
+ </div>
1151
+ <hr>
1152
+ <div>
1153
+ <h2><a name="ODBC::TimeStamp">ODBC::TimeStamp</a></h2>
1154
+ <p>
1155
+ The class to represent a <code>SQL_TIMESTAMP</code> column in a table
1156
+ or a <code>SQL_TIMESTAMP</code> query parameter.
1157
+ </p>
1158
+ <h3>super class:</h3>
1159
+ <p>
1160
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
1161
+ </p>
1162
+ <h3>mixins:</h3>
1163
+ <p>
1164
+ <code>Comparable</code>
1165
+ </p>
1166
+ <h3>methods:</h3>
1167
+ <dl>
1168
+ <dt><a name="ts.cmp"><code><=>(<var>atimestamp</var>)</code></a>
1169
+ <dd>Comparison, compares time stamp with <var>atimestamp</var>
1170
+ and returns 0, 1, or -1.
1171
+ <dt><a name="ts.fraction"><code>fraction[=<var>num</var>]</code></a>
1172
+ <dd>Returns or sets the fraction component of the time stamp object.
1173
+ Note that this is expressed in nanoseconds.
1174
+ <dt><a name="ts.second"><code>second[=<var>num</var>]</code></a>
1175
+ <dd>Returns or sets the second component of the time stamp object.
1176
+ <dt><a name="ts.minute"><code>minute[=<var>num</var>]</code></a>
1177
+ <dd>Returns or sets the minute component of the time stamp object.
1178
+ <dt><a name="ts.hour"><code>hour[=<var>num</var>]</code></a>
1179
+ <dd>Returns or sets the hour component of the time stamp object.
1180
+ <dt><a name="ts.day"><code>day[=<var>num</var>]</code></a>
1181
+ <dd>Returns or sets the day component of the time stamp object.
1182
+ <dt><a name="ts.month"><code>month[=<var>num</var>]</code></a>
1183
+ <dd>Returns or sets the month component of the time stamp object.
1184
+ <dt><a name="ts.year"><code>year[=<var>num</var>]</code></a>
1185
+ <dd>Returns or sets the year component of the time stamp object.
1186
+ <dt><a name="ts.to_s"><code>to_s</code></a>
1187
+ <dd>Returns a string representation of the object with format
1188
+ <code>YYYY-MM-DD hh:mm:ss fraction</code>.
1189
+ <dt><a name="ts.clone"><code>clone</code></a>
1190
+ <dd>Returns a fresh copy of the time stamp object.
1191
+ </dl>
1192
+ <h3>singleton methods:</h3>
1193
+ <dl>
1194
+ <dt><a name="ts.new"><code>new([<var>year</var>, <var>month</var>,
1195
+ <var>day</var>, <var>hour</var>, <var>minute</var>,
1196
+ <var>second</var>, <var>fraction</var>])</code></a>
1197
+ <dt><code>new(<var>time</var>)</code>
1198
+ <dt><code>new(<var>string</var>)</code>
1199
+ <dd>Creates a new time stamp object from numeric values or from
1200
+ a <code>Time</code> or <code>String</code> object.
1201
+ Recognized string formats are e.g.
1202
+ <pre>12:00:01
1203
+ 2001-01-01
1204
+ 2001-01-01 12:00:01
1205
+ {ts '2001-01-01 12:00:01.1'}
1206
+ {d '2001-01-01'}
1207
+ {t '12:00:01'}</pre>
1208
+ </dl>
1209
+ </div>
1210
+ <hr>
1211
+ <div>
1212
+ <h2><a name="ODBC::DSN">ODBC::DSN</a></h2>
1213
+ <p>
1214
+ The class to represent a data source name. Objects of this class are
1215
+ created as result of a
1216
+ <a href="#ODBC::datasources"><code>ODBC::datasources</code></a>
1217
+ module function call.
1218
+ </p>
1219
+ <h3>super class:</h3>
1220
+ <p>
1221
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
1222
+ </p>
1223
+ <h3>methods:</h3>
1224
+ <dl>
1225
+ <dt><code>name[=<var>name</var>]</code></a>
1226
+ <dd>Queries or sets the <var>name</var> (String) of the data source.
1227
+ <dt><code>descr[=<var>descr</var>]</code></a>
1228
+ <dd>Queries or sets the <var>descr</var> (description, String)
1229
+ of the data source.
1230
+ </dl>
1231
+ <h3>singleton methods:</h3>
1232
+ <dl>
1233
+ <dt><a name="ODBC::DSN.new"><code>new</code></a>
1234
+ <dd>Returns an empty <a href="#ODBC::DSN">ODBC::DSN</a> object.
1235
+ </dl>
1236
+ </div>
1237
+ <hr>
1238
+ <div>
1239
+ <h2><a name="ODBC::Driver">ODBC::Driver</a></h2>
1240
+ <p>
1241
+ The class to represent an ODBC driver with name and attributes.
1242
+ Objects of this class are
1243
+ created as result of a
1244
+ <a href="#ODBC::drivers"><code>ODBC::drivers</code></a>
1245
+ module function call.
1246
+ </p>
1247
+ <h3>super class:</h3>
1248
+ <p>
1249
+ <code><a href="#ODBC::Object">ODBC::Object</a></code>
1250
+ </p>
1251
+ <h3>methods:</h3>
1252
+ <dl>
1253
+ <dt><code>name[=<var>name</var>]</code></a>
1254
+ <dd>Queries or sets the <var>name</var> (String) of the ODBC driver.
1255
+ <dt><code>attrs[[<var>key</var>][=<var>value</var>]]</code></a>
1256
+ <dd>Queries or sets attributes in the <var>attrs</var> Hash of the
1257
+ ODBC driver object. The <var>key</var>s and <var>value</var>s
1258
+ should be Strings.
1259
+ </dl>
1260
+ <h3>singleton methods:</h3>
1261
+ <dl>
1262
+ <dt><a name="ODBC::Driver.new"><code>new</code></a>
1263
+ <dd>Returns an empty <a href="#ODBC::Driver">ODBC::Driver</a> object.
1264
+ </dl>
1265
+ </div>
1266
+ <div>
1267
+ <hr>
1268
+ <h2><a name="ODBCProc">ODBCProc</a></h2>
1269
+ <p>
1270
+ The class to represent a procedure with ODBC database/statement
1271
+ context.
1272
+ Objects of this class are created as result of a
1273
+ <a href="#proc"><code>ODBC::Database.proc</code></a> method call.
1274
+ </p>
1275
+ <h3>super class:</h3>
1276
+ <p>
1277
+ <code>Proc</a></code>
1278
+ </p>
1279
+ <h3>methods:</h3>
1280
+ <dl>
1281
+ <dt><a name="call"><code>call([<var>args*</var>])</code></a>
1282
+ <dd>Executes the SQL statement with parameters set from <var>args</var>
1283
+ and then invokes the procedure's block, setting the block's
1284
+ single parameter to the
1285
+ <a href="#ODBC::Statement">ODBC::Statement</a>.
1286
+ <dt><code>[[<var>args*</var>]]</code>
1287
+ <dd>Synonym for <code>call</code>.
1288
+ </dl>
1289
+ </div>
1290
+ <div>
1291
+ <hr>
1292
+ <h2><a name="ODBC::Error">ODBC::Error</a></h2>
1293
+ <p>
1294
+ The class to represent ODBC related exceptions. The descriptive
1295
+ string is made up of the first ODBC driver or driver manager
1296
+ message as concatenation of SQL state, native error, driver manager
1297
+ name, database name/vendor, DSN, and error text, e.g. <pre>
1298
+ S1000 (1146) [unixODBC][TCX][MySQL]Table 'test.foo' doesn't exist</pre>
1299
+ For internally generated errors, e.g. method invocation on
1300
+ a broken connection, the descriptive string starts with
1301
+ 'INTERN' and native error 0, e.g. <pre>
1302
+ INTERN (0) [RubyODBC]No connection</pre>
1303
+ For errors programmatically generated by the
1304
+ <a href="#ODBC::Object.raise"><code>raise</code></a> method,
1305
+ the descriptive string starts with 'INTERN' and native error 1,
1306
+ e.g. <pre>
1307
+ INTERN (1) [RubyODBC]Programmer forgot to RTFM</pre>
1308
+ </p>
1309
+ <h3>super class:</h3>
1310
+ <p>
1311
+ <code>StandardError</a></code>
1312
+ </p>
1313
+ </div>
1314
+ <div>
1315
+ <hr>
1316
+ <h2>Undocumented</h2>
1317
+ <h3>Use The Source, Luke!</h3>
1318
+ <p>
1319
+ <code>ODBC::add_dsn(<var>driver</var>,<var>issys=false</var>)</code><br>
1320
+ <code>ODBC::add_dsn(<var>name</var>,<var>attrs</var>,<var>issys=false</var>)</code><br>
1321
+ <code>ODBC::config_dsn(<var>driver</var>,<var>issys=false</var>)</code><br>
1322
+ <code>ODBC::config_dsn(<var>name</var>,<var>attrs</var>,<var>issys=false</var>)</code><br>
1323
+ <code>ODBC::del_dsn(<var>driver</var>,<var>issys=false</var>)</code><br>
1324
+ <code>ODBC::del_dsn(<var>name</var>,<var>attrs</var>,<var>issys=false</var>)</code><br>
1325
+ <code>ODBC::write_file_dsn(<var>filename</var>,<var>appname</var>,<var>key</var>[,<var>value</var>])</code><br>
1326
+ <code>ODBC::read_file_dsn(<var>filename</var>,<var>appname</var>,<var>key</var>)</code><br>
1327
+ <code>ODBC::trace([<var>mask</var>])</code><br>
1328
+ <br>
1329
+ <code>ODBC::Statement.fetch!</code><br>
1330
+ <code>ODBC::Statement.fetch_first!</code><br>
1331
+ <code>ODBC::Statement.fetch_first_hash(<var>with_table_names=false</var>,<var>use_sym=false</var>)</code><br>
1332
+ <code>ODBC::Statement.fetch_scroll!(<var>direction</var>,<var>offset=1</var>)</code><br>
1333
+ <code>ODBC::Statement.fetch_hash!(<var>with_table_names=false</var>,<var>use_sym=false</var>)</code><br>
1334
+ </p>
1335
+ <hr>
1336
+ <address>
1337
+ mailto:<a href="mailto:chw@ch-werner.de">Christian Werner</a>
1338
+ </address>
1339
+ </body>
1340
+ </html>