skaes-mysql 2.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (10) hide show
  1. data/COPYING +56 -0
  2. data/COPYING.ja +51 -0
  3. data/README.html +1087 -0
  4. data/README_ja.html +1312 -0
  5. data/extconf.rb +73 -0
  6. data/mysql.c.in +2302 -0
  7. data/mysql.gemspec +61 -0
  8. data/test.rb +1442 -0
  9. data/tommy.css +134 -0
  10. metadata +60 -0
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ (see the file GPL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -0,0 +1,51 @@
1
+ $BK\%W%m%0%i%`$O%U%j!<%=%U%H%&%'%"$G$9!%(BGPL(the GNU General
2
+ Public License)$B$^$?$O0J2<$K<($9>r7o$GK\%W%m%0%i%`$r:FG[I[$G(B
3
+ $B$-$^$9!%(BGPL$B$K$D$$$F$O(BGPL$B%U%!%$%k$r;2>H$7$F2<$5$$!%(B
4
+
5
+ 1. $BJ#@=$O@)8B$J$/<+M3$G$9!%(B
6
+
7
+ 2. $B0J2<$N>r7o$N$$$:$l$+$rK~$?$9;~$KK\%W%m%0%i%`$N%=!<%9$r(B
8
+ $B<+M3$KJQ99$G$-$^$9!%(B
9
+
10
+ (a) $B%M%C%H%K%e!<%:$K%]%9%H$7$?$j!$:n<T$KJQ99$rAwIU$9$k(B
11
+ $B$J$I$NJ}K!$G!$JQ99$r8x3+$9$k!%(B
12
+
13
+ (b) $BJQ99$7$?K\%W%m%0%i%`$r<+J,$N=jB0$9$kAH?%FbIt$@$1$G(B
14
+ $B;H$&!%(B
15
+
16
+ (c) $BJQ99E@$rL@<($7$?$&$(!$%=%U%H%&%'%"$NL>A0$rJQ99$9$k!%(B
17
+ $B$=$N%=%U%H%&%'%"$rG[I[$9$k;~$K$OJQ99A0$NK\%W%m%0%i(B
18
+ $B%`$bF1;~$KG[I[$9$k!%$^$?$OJQ99A0$NK\%W%m%0%i%`$N%=!<(B
19
+ $B%9$NF~<jK!$rL@<($9$k!%(B
20
+
21
+ (d) $B$=$NB>$NJQ99>r7o$r:n<T$H9g0U$9$k!%(B
22
+
23
+ 3. $B0J2<$N>r7o$N$$$:$l$+$rK~$?$9;~$KK\%W%m%0%i%`$r%3%s%Q%$(B
24
+ $B%k$7$?%*%V%8%'%/%H%3!<%I$d<B9T7A<0$G$bG[I[$G$-$^$9!%(B
25
+
26
+ (a) $B%P%$%J%j$r<u$1<h$C$??M$,%=!<%9$rF~<j$G$-$k$h$&$K!$(B
27
+ $B%=!<%9$NF~<jK!$rL@<($9$k!%(B
28
+
29
+ (b) $B5!3#2DFI$J%=!<%9%3!<%I$rE:IU$9$k!%(B
30
+
31
+ (c) $BJQ99$r9T$C$?%P%$%J%j$OL>A0$rJQ99$7$?$&$(!$%*%j%8%J(B
32
+ $B%k$N%=!<%9%3!<%I$NF~<jK!$rL@<($9$k!%(B
33
+
34
+ (d) $B$=$NB>$NG[I[>r7o$r:n<T$H9g0U$9$k!%(B
35
+
36
+ 4. $BB>$N%W%m%0%i%`$X$N0zMQ$O$$$+$J$kL\E*$G$"$l<+M3$G$9!%$?(B
37
+ $B$@$7!$K\%W%m%0%i%`$K4^$^$l$kB>$N:n<T$K$h$k%3!<%I$O!$$=(B
38
+ $B$l$>$l$N:n<T$N0U8~$K$h$k@)8B$,2C$($i$l$k>l9g$,$"$j$^$9!%(B
39
+
40
+ $B$=$l$i%U%!%$%k$N0lMw$H$=$l$>$l$NG[I[>r7o$J$I$KIU$$$F$O(B
41
+ LEGAL$B%U%!%$%k$r;2>H$7$F$/$@$5$$!%(B
42
+
43
+ 5. $BK\%W%m%0%i%`$X$NF~NO$H$J$k%9%/%j%W%H$*$h$S!$K\%W%m%0%i(B
44
+ $B%`$+$i$N=PNO$N8"Mx$OK\%W%m%0%i%`$N:n<T$G$O$J$/!$$=$l$>(B
45
+ $B$l$NF~=PNO$r@8@.$7$??M$KB0$7$^$9!%$^$?!$K\%W%m%0%i%`$K(B
46
+ $BAH$_9~$^$l$k$?$a$N3HD%%i%$%V%i%j$K$D$$$F$bF1MM$G$9!%(B
47
+
48
+ 6. $BK\%W%m%0%i%`$OL5J]>Z$G$9!%:n<T$OK\%W%m%0%i%`$r%5%]!<%H(B
49
+ $B$9$k0U;V$O$"$j$^$9$,!$%W%m%0%i%`<+?H$N%P%0$"$k$$$OK\%W(B
50
+ $B%m%0%i%`$N<B9T$J$I$+$iH/@8$9$k$$$+$J$kB;32$KBP$7$F$b@U(B
51
+ $BG$$r;}$A$^$;$s!%(B
@@ -0,0 +1,1087 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <!-- $Id: README.html 237 2008-09-29 15:03:04Z tommy $ -->
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="content-style-type" content="text/css">
6
+ <link rel=stylesheet type="text/css" href="tommy.css">
7
+ <link rev=made href="mailto:tommy@tmtm.org">
8
+ <title>MySQL/Ruby</title>
9
+ </head>
10
+
11
+ <body>
12
+ <h1>MySQL/Ruby</h1>
13
+ <p><a href="README_ja.html">[Japanese]</a></p>
14
+ <hr>
15
+ <p>
16
+ This is the <a href="http://www.mysql.com">MySQL</a> API module for Ruby.
17
+ It provides the same functions for Ruby programs that the MySQL C API provides for C programs.
18
+ </p>
19
+
20
+ <h2>Download</h2>
21
+ <a href="http://tmtm.org/downloads/mysql/ruby/">tmtm.org</a>
22
+
23
+ <h2>Requirement</h2>
24
+ <ul>
25
+ <li>MySQL 5.0.51a
26
+ <li>Ruby 1.8.5-1.8.7
27
+ </ul>
28
+ <p>
29
+ The module may work for other versions, but that has not been verified.
30
+ </p>
31
+
32
+ <h2>License</h2>
33
+ <p>
34
+ This program is under <a href="http://www.ruby-lang.org/en/LICENSE.txt">Ruby's license</a>.
35
+ </p>
36
+
37
+ <h2>Install</h2>
38
+ <p>
39
+ 1st:
40
+ </p>
41
+ <pre class="code">
42
+ % ruby extconf.rb
43
+ </pre>
44
+ <p>
45
+ or
46
+ </p>
47
+ <pre class="code">
48
+ % ruby extconf.rb --with-mysql-dir=/usr/local/mysql
49
+ </pre>
50
+ <p>
51
+ or
52
+ </p>
53
+ <pre clas="code">
54
+ % ruby extconf.rb --with-mysql-config
55
+ </pre>
56
+ <p>
57
+ then
58
+ </p>
59
+ <pre>
60
+ % make
61
+ </pre>
62
+ <p>
63
+ extconf.rb has following options:
64
+ </p>
65
+ <dl>
66
+ <dt>--with-mysql-include=<i>dir</i>
67
+ <dd>
68
+ MySQL header file directory. Default is /usr/local/include.
69
+
70
+ <dt>--with-mysql-lib=<i>dir</i>
71
+ <dd>
72
+ MySQL library directory. Default is /usr/local/lib.
73
+
74
+ <dt>--with-mysql-dir=<i>dir</i>
75
+ <dd>
76
+ Same as --with-mysql-include=<i>dir</i>/include,
77
+ --with-mysql-lib=<i>dir</i>/lib.
78
+
79
+ <dt>--with-mysql-config[=<i>/path/to/mysql_config</i>]
80
+ <dd>
81
+ Get compile-parameter from mysql_config command.
82
+ </dl>
83
+ <p>
84
+ 2nd:
85
+ </p>
86
+ <pre class="code">
87
+ % ruby ./test.rb -- [<i>hostname</i> [<i>user</i> [<i>passwd</i> [<i>dbname</i> [<i>port</i> [<i>socket</i> [<i>flag</i>]]]]]]]
88
+ </pre>
89
+
90
+ <p>
91
+ 3rd:
92
+ </p>
93
+ <pre class="code">
94
+ # make install
95
+ </pre>
96
+
97
+ <h3>Note</h3>
98
+ <p>
99
+ If you get error like 'libmysqlclient not found' when testing,
100
+ you need to specify the directory in which the library is
101
+ located so that make can find it.
102
+ </p>
103
+ <pre class="code">
104
+ % env LD_RUN_PATH=<i>libmysqlclient.so directory</i> make
105
+ </pre>
106
+ <p>
107
+ test.rb is tested on Linux only.
108
+ </p>
109
+
110
+ <h2>Usage</h2>
111
+ <p>
112
+ The names of methods provided by this module basically are the
113
+ same as the names of the functions in the C API, except that the
114
+ Ruby method names do not begin with a 'mysql_' prefix. For
115
+ example, the Ruby query() method corresponds to the C API
116
+ mysql_query() function. For details on the use of each Ruby
117
+ method, see the descriptions of the corresponding C functions in
118
+ the MySQL Reference Manual.
119
+ </p>
120
+ <p>
121
+ Some Ruby methods may be invoked under other names that serve as
122
+ equivalent aliases, as noted below.
123
+ </p>
124
+ <p>
125
+ If an error occurs when a method executes, it raises a
126
+ Mysql::Error exception.
127
+ </p>
128
+
129
+ <h2>Mysql class</h2>
130
+ <h3>CLASS METHODS</h3>
131
+ <dl>
132
+ <dt>init()
133
+ <dd>
134
+ <p>
135
+ It return Mysql object. It not connect to mysqld.
136
+ </p>
137
+
138
+ <dt>real_connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
139
+ <dt>connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
140
+ <dt>new(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
141
+ <dd>
142
+ <p>
143
+ connect to mysqld and return Mysql object.
144
+ </p>
145
+
146
+ <dt>escape_string(str)
147
+ <dt>quote(str)
148
+ <dd>
149
+ <p>
150
+ quote string for insert/update.
151
+ </p>
152
+
153
+ <dt>get_client_info()
154
+ <dt>client_info()
155
+ <dd>
156
+ <p>
157
+ return client version information.
158
+ </p>
159
+
160
+ <dt>get_client_version()
161
+ <dt>client_version()
162
+ <dd>
163
+ <p>
164
+ return client version as number.
165
+ </p>
166
+
167
+ <dt>debug(str)
168
+ <dd>
169
+ <p>
170
+ same as C API mysql_debug().
171
+ </p>
172
+ </dl>
173
+
174
+ <h3>OBJECT METHODS</h3>
175
+ <dl>
176
+ <dt>options(opt, val=nil)
177
+ <dd>
178
+ <p>
179
+ same as C API mysql_options().
180
+ </p>
181
+
182
+ <dt>real_connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
183
+ <dt>connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
184
+ <dd>
185
+ <p>
186
+ same as Mysql.real_connect().
187
+ </p>
188
+
189
+ <dt>affected_rows()
190
+ <dd>
191
+ <p>
192
+ return affected rows.
193
+ </p>
194
+
195
+ <dt>autocommit(mode)
196
+ <dd>
197
+ <p>
198
+ set autocommit mode.
199
+ </p>
200
+
201
+ <dt>change_user(user=nil, passwd=nil, db=nil)
202
+ <dd>
203
+ <p>
204
+ change user.
205
+ </p>
206
+
207
+ <dt>character_set_name()
208
+ <dd>
209
+ <p>
210
+ return character set.
211
+ </p>
212
+
213
+ <dt>close()
214
+ <dd>
215
+ <p>
216
+ close connection.
217
+ </p>
218
+
219
+ <dt>commit()
220
+ <dd>
221
+ <p>
222
+ commit transaction.
223
+ </p>
224
+
225
+ <dt>create_db(db)
226
+ <dd>
227
+ <p>
228
+ create database.
229
+ </p>
230
+
231
+ <dt>drop_db(db)
232
+ <dd>
233
+ <p>
234
+ drop database.
235
+ </p>
236
+
237
+ <dt>dump_debug_info()
238
+ <dd>
239
+ <p>
240
+ same as C API mysql_dump_debug_info().
241
+ </p>
242
+
243
+ <dt>errno()
244
+ <dd>
245
+ <p>
246
+ return error number.
247
+ </p>
248
+
249
+ <dt>error()
250
+ <dd>
251
+ <p>
252
+ return error message.
253
+ </p>
254
+
255
+ <dt>escape_string(str)
256
+ <dt>quote(str)
257
+ <dd>
258
+ <p>
259
+ quote strings for insert/update.
260
+ same as C API mysql_real_escape_string().
261
+ </p>
262
+
263
+ <dt>field_count()
264
+ <dd>
265
+ <p>
266
+ return number of columns of last query.
267
+ </p>
268
+
269
+ <dt>get_client_info()
270
+ <dt>client_info()
271
+ <dd>
272
+ <p>
273
+ return client version information.
274
+ </p>
275
+
276
+ <dt>get_client_version()
277
+ <dt>client_version()
278
+ <dd>
279
+ <p>
280
+ return client version number.
281
+ </p>
282
+
283
+ <dt>get_host_info()
284
+ <dt>host_info()
285
+ <dd>
286
+ <p>
287
+ return connection information.
288
+ </p>
289
+
290
+ <dt>get_proto_info()
291
+ <dt>proto_info()
292
+ <dd>
293
+ <p>
294
+ return connection protocol version.
295
+ </p>
296
+
297
+ <dt>get_server_info()
298
+ <dt>server_info()
299
+ <dd>
300
+ <p>
301
+ return server version information.
302
+ </p>
303
+
304
+ <dt>get_server_version()
305
+ <dt>server_version()
306
+ <dd>
307
+ <p>
308
+ return server version number.
309
+ </p>
310
+
311
+ <dt>info()
312
+ <dd>
313
+ <p>
314
+ return information of last query.
315
+ </p>
316
+
317
+ <dt>insert_id()
318
+ <dd>
319
+ <p>
320
+ return last AUTO_INCREMENT value.
321
+ </p>
322
+
323
+ <dt>kill(id)
324
+ <dd>
325
+ <p>
326
+ kill thread.
327
+ </p>
328
+
329
+ <dt>list_dbs(db=nil)
330
+ <dd>
331
+ <p>
332
+ return database list.
333
+ </p>
334
+
335
+ <dt>list_fields(table, field=nil)
336
+ <dd>
337
+ <p>
338
+ return Mysql::Result object.
339
+ </p>
340
+
341
+ <dt>list_processes()
342
+ <dd>
343
+ <p>
344
+ return Mysql::Result object.
345
+ </p>
346
+
347
+ <dt>list_tables(table=nil)
348
+ <dd>
349
+ <p>
350
+ return table list Array.
351
+ </p>
352
+
353
+ <dt>more_results?()
354
+ <dd>
355
+ <p>
356
+ returns true if more results exist from the currently executed query.
357
+ </p>
358
+
359
+ <dt>next_result()
360
+ <dd>
361
+ <p>
362
+ returns true if more results exist from the currently executed query.
363
+ after this, you do store_result() to get result table of query.
364
+ </p>
365
+
366
+ <dt>ping()
367
+ <dd>
368
+ <p>
369
+ check server.
370
+ </p>
371
+
372
+ <dt>prepare(q)
373
+ <dd>
374
+ <p>
375
+ </p>
376
+
377
+ <dt>query(q)
378
+ <dt>real_query(q)
379
+ <dd>
380
+ <p>
381
+ do query and store_result(). return Mysql::Result object.
382
+ If query_with_result is false, it does not store_result().
383
+ </p>
384
+
385
+ <dt>query(q) {|res| ...}
386
+ <dt>real_query(q) {|res| ...}
387
+ <dd>
388
+ <p>
389
+ do query and execute block with Mysql::Result object.
390
+ if you specify multiple query, then repeat block.
391
+ set_server_option(Mysql::OPTION_MULTI_STATEMENTS) is executed automatically.
392
+ </p>
393
+
394
+ <dt>refresh(r)
395
+ <dd>
396
+ <p>
397
+ flush server log or cache.
398
+ </p>
399
+
400
+ <dt>reload()
401
+ <dd>
402
+ <p>
403
+ reload access privilege table.
404
+ </p>
405
+
406
+ <dt>rollback()
407
+ <dd>
408
+ <p>
409
+ rollback transaction.
410
+ </p>
411
+
412
+ <dt>select_db(db)
413
+ <dd>
414
+ <p>
415
+ select database.
416
+ </p>
417
+
418
+ <dt>set_server_option(opt)
419
+ <dd>
420
+ <p>
421
+ set option to server.
422
+ options is one of Mysql::OPTION_MULTI_STATEMENTS_ON, Mysql::OPTION_MULTI_STATEMENTS_OFF.
423
+ </p>
424
+
425
+ <dt>shutdown()
426
+ <dd>
427
+ <p>
428
+ shutdown server.
429
+ </p>
430
+
431
+ <dt>ssl_set(key=nil, cert=nil, ca=nil, capath=nil, cipher=nil)
432
+ <dd>
433
+ <p>
434
+ use SSL.
435
+ </p>
436
+
437
+ <dt>stat()
438
+ <dd>
439
+ <p>
440
+ return server status.
441
+ </p>
442
+
443
+ <dt>stmt_init()
444
+ <dd>
445
+ <p>
446
+ return Mysql::Stmt class object.
447
+ </p>
448
+
449
+ <dt>store_result()
450
+ <dd>
451
+ <p>
452
+ return Mysql::Result object.
453
+ </p>
454
+
455
+ <dt>thread_id()
456
+ <dd>
457
+ <p>
458
+ retrun thread id.
459
+ </p>
460
+
461
+ <dt>use_result()
462
+ <dd>
463
+ <p>
464
+ return Mysql::Result object.
465
+ </p>
466
+
467
+ <dt>warning_count()
468
+ <dd>
469
+ <p>
470
+ return warning count last query.
471
+ </p>
472
+ </dl>
473
+
474
+ <h3>OBJECT VARIABLES</h3>
475
+
476
+ <dl>
477
+ <dt>query_with_result
478
+ <dd>
479
+ <p>
480
+ If true, query() also invokes store_result() and returns a
481
+ Mysql::Result object. Default is true.
482
+ </p>
483
+
484
+ <dt>reconnect
485
+ <dd>
486
+ <p>
487
+ If true, reconnect to server automatically when disconect to server.
488
+ Default is false.
489
+ </p>
490
+
491
+ </dl>
492
+
493
+ <h2>Mysql::Result class</h2>
494
+
495
+ <h3>OBJECT METHODS</h3>
496
+ <dl>
497
+ <dt>free()
498
+ <dd>
499
+ <p>
500
+ free memory of result table.
501
+ </p>
502
+
503
+ <dt>data_seek(offset)
504
+ <dd>
505
+ <p>
506
+ seek row.
507
+ </p>
508
+
509
+ <dt>fetch_field()
510
+ <dd>
511
+ <p>
512
+ return next Mysql::Field object.
513
+ </p>
514
+
515
+ <dt>fetch_fields()
516
+ <dd>
517
+ <p>
518
+ return Array of Mysql::Field object.
519
+ </p>
520
+
521
+ <dt>fetch_field_direct(fieldnr)
522
+ <dd>
523
+ <p>
524
+ return Mysql::Field object.
525
+ </p>
526
+
527
+ <dt>fetch_lengths()
528
+ <dd>
529
+ <p>
530
+ return Array of field length.
531
+ </p>
532
+
533
+ <dt>fetch_row()
534
+ <dd>
535
+ <p>
536
+ return row as Array.
537
+ </p>
538
+
539
+ <dt>fetch_hash(with_table=false)
540
+ <dd>
541
+ <p>
542
+ return row as Hash.
543
+ If with_table is true, hash key format is "tablename.fieldname".
544
+ </p>
545
+
546
+ <dt>field_seek(offset)
547
+ <dd>
548
+ <p>
549
+ seek field.
550
+ </p>
551
+
552
+ <dt>field_tell()
553
+ <dd>
554
+ <p>
555
+ return field position.
556
+ </p>
557
+
558
+ <dt>num_fields()
559
+ <dd>
560
+ <p>
561
+ return number of fields.
562
+ </p>
563
+
564
+ <dt>num_rows()
565
+ <dd>
566
+ <p>
567
+ return number of rows.
568
+ </p>
569
+
570
+ <dt>row_seek(offset)
571
+ <dd>
572
+ <p>
573
+ seek row.
574
+ </p>
575
+
576
+ <dt>row_tell()
577
+ <dd>
578
+ <p>
579
+ return row position.
580
+ </p>
581
+ </dl>
582
+
583
+ <h3>ITERATOR</h3>
584
+ <dl>
585
+ <dt>each() {|x| ...}
586
+ <dd>
587
+ <p>
588
+ 'x' is array of column values.
589
+ </p>
590
+
591
+ <dt>each_hash(with_table=false) {|x| ...}
592
+ <dd>
593
+ <p>
594
+ 'x' is hash of column values, and the keys are the column names.
595
+ </p>
596
+ </dl>
597
+
598
+ <h2>Mysql::Field class</h2>
599
+
600
+ <h3>OBJECT VARIABLES(read only)</h3>
601
+ <dl>
602
+ <dt>name<dd>field name
603
+ <dt>table<dd>table name
604
+ <dt>def<dd>default value
605
+ <dt>type<dd>field type
606
+ <dt>length<dd>field length
607
+ <dt>max_length<dd>max field length
608
+ <dt>flags<dd>field flag
609
+ <dt>decimals<dd>number of decimals
610
+ </dl>
611
+
612
+ <h3>OBJECT METHODS</h3>
613
+ <dl>
614
+ <dt>hash()
615
+ <dd>
616
+ <p>
617
+ return field as Hash.
618
+ </p>
619
+ <p>
620
+ ex.) obj.name == obj.hash['name']
621
+ </p>
622
+
623
+ <dt>is_not_null?()
624
+ <dd>
625
+ <p>
626
+ True if this field is defined as NOT NULL.
627
+ </p>
628
+
629
+ <dt>is_num?()
630
+ <dd>
631
+ <p>
632
+ True if this field type is numeric.
633
+ </p>
634
+
635
+ <dt>is_pri_key?()
636
+ <dd>
637
+ <p>
638
+ True if this field is a primary key.
639
+ </p>
640
+
641
+ <dt>inspect()
642
+ <dd>
643
+ <p>
644
+ return "#&lt;Mysql::Field:fieldname&gt;"
645
+ </p>
646
+ </dl>
647
+
648
+ <h2>Mysql::Stmt class</h2>
649
+ <p>
650
+ Example:
651
+ </p>
652
+ <pre class="code">
653
+ my = Mysql.new(hostname, username, password, databasename)
654
+ st = my.prepare("insert into tblname (col1,col2,col3) values (?,?,?)")
655
+ st.execute("abc",123,Time.now)
656
+ st.prepare("select col1,col2,col3 from tblname")
657
+ st.execute
658
+ st.fetch # => ["abc", 123, #&lt;Mysql::Time:2005-07-24 23:52:55&gt;]
659
+ st.close
660
+ </pre>
661
+
662
+ <h3>OBJECT METHODS</h3>
663
+ <dl>
664
+ <dt>affected_rows()
665
+ <dd>
666
+ <p>
667
+ </p>
668
+
669
+ <dt>bind_result(class, ...)
670
+ <dd>
671
+ <p>
672
+ </p>
673
+
674
+ <dt>close()
675
+ <dd>
676
+ <p>
677
+ </p>
678
+
679
+ <dt>data_seek(offset)
680
+ <dd>
681
+ <p>
682
+ </p>
683
+
684
+ <dt>execute(arg, ...)
685
+ <dd>
686
+ <p>
687
+ </p>
688
+
689
+ <dt>fetch()
690
+ <dd>
691
+ <p>
692
+ </p>
693
+ <p>
694
+ Type mapping:
695
+ </p>
696
+ <table>
697
+ <tr><th>MySQL type<th>Ruby class
698
+ <tr><td>TINYINT, SMALLINT, MEDIUMINT, YEAR<td>Fixnum
699
+ <tr><td>INT, BIGINT<td>Fixnum or Bignum
700
+ <tr><td>FLOAT, DOUBLE<td>Float
701
+ <tr><td>DECIMAL<td>String
702
+ <tr><td>DATE, DATETIME, TIMESTAMP, TIME<td>Mysql::Time
703
+ <tr><td>CHAR, VARCHAR, BINARY, VARBINARY, TINYBLOB, TINYTEXT, TINYBLOB, TINYTEXT, MEDIUMBLOB, MEDIUMTEXT, LONGBLOB, LONGTEXT, ENUM, SET, BIT<td>String
704
+ <tr><td>NULL<td>NilClass
705
+ </table>
706
+
707
+ <dt>field_count()
708
+ <dd>
709
+ <p>
710
+ </p>
711
+
712
+ <dt>free_result()
713
+ <dd>
714
+ <p>
715
+ </p>
716
+
717
+ <dt>insert_id()
718
+ <dd>
719
+ <p>
720
+ </p>
721
+
722
+ <dt>num_rows()
723
+ <dd>
724
+ <p>
725
+ </p>
726
+
727
+ <dt>param_count()
728
+ <dd>
729
+ <p>
730
+ </p>
731
+
732
+ <dt>prepare(q)
733
+ <dd>
734
+ <p>
735
+ </p>
736
+
737
+ <dt>result_metadata()
738
+ <dd>
739
+ <p>
740
+ </p>
741
+
742
+ <dt>row_seek(offset)
743
+ <dd>
744
+ <p>
745
+ </p>
746
+
747
+ <dt>row_tell()
748
+ <dd>
749
+ <p>
750
+ </p>
751
+
752
+ <dt>sqlstate()
753
+ <dd>
754
+ <p>
755
+ </p>
756
+ </dl>
757
+
758
+ <h3>ITERATOR</h3>
759
+ <dl>
760
+ <dt>each() {|x| ...}
761
+ <dd>
762
+ <p>
763
+ </p>
764
+ </dl>
765
+
766
+ <h2>Mysql::Time class</h2>
767
+ <p>
768
+ </p>
769
+
770
+ <h3>CLASS METHODS</h3>
771
+ <dl>
772
+ <dt>new(year=0,month=0,day=0,hour=0,minute=0,second=0,neg=false,second_part=0)
773
+ <dd>
774
+ <p>
775
+ </p>
776
+ </dl>
777
+
778
+ <h3>OBJECT VARIABLES</h3>
779
+ <dl>
780
+ <dt>year
781
+ <dd>
782
+
783
+ <dt>month
784
+ <dd>
785
+
786
+ <dt>day
787
+ <dd>
788
+
789
+ <dt>hour
790
+ <dd>
791
+
792
+ <dt>minute
793
+ <dd>
794
+
795
+ <dt>second
796
+ <dd>
797
+
798
+ <dt>neg
799
+ <dd>
800
+
801
+ <dt>second_part
802
+ <dd>
803
+ </dl>
804
+
805
+ <h2>Mysql::Error class</h2>
806
+
807
+ <h3>OBJECT VARIABLES(read only)</h3>
808
+ <dl>
809
+ <dt>error
810
+ <dd>eror message
811
+ <dt>errno
812
+ <dd>error number
813
+ </dl>
814
+
815
+ <h2>History</h2>
816
+ <dl>
817
+ <dt>2008-09-29
818
+ <dd>
819
+ version 2.8<br>
820
+ version 2.7.7
821
+ <ul>
822
+ <li>When connecting to MySQL, EINTR is occurred sometimes ([ruby-dev:31842])
823
+ <li>MySQL/Ruby 2.7.* can not be compiled on Ruby 1.8.5.
824
+ </ul>
825
+
826
+ <dt>2008-06-20
827
+ <dd>
828
+ version 2.8pre4<br>
829
+ <ul>
830
+ <li>[ruby-dev:35152]
831
+ </ul>
832
+
833
+ <dt>2008-06-17
834
+ <dd>
835
+ version 2.8pre3<br>
836
+ version 2.7.6
837
+ <ul>
838
+ <li>On 64bit machine, Mysql::Stmt#execute raise error on large numeric value(>= 2**30).
839
+ </ul>
840
+
841
+ <dt>2008-03-08
842
+ <dd>
843
+ version 2.8pre2<br>
844
+ version 2.7.5
845
+ <ul>
846
+ <li>On 64bit machine, Mysql::Stmt#fetch return invalid numeric value.
847
+ </ul>
848
+
849
+ <dt>2007-12-26
850
+ <dd>
851
+ version 2.8pre1
852
+ <ul>
853
+ <li>for Ruby 1.9.0
854
+ <li>Incompat: Mysql::Result#each_hash don't create column name string each row. it's shared.
855
+ <li>Incompat: Mysql#query with block no longer turn on multi-statements mode automatically.
856
+ </ul>
857
+
858
+ <dt>2007-08-22
859
+ <dd>
860
+ version 2.7.4
861
+ <ul>
862
+ <li>BUG: Mysql::Stmt#execute memory leak.
863
+ </ul>
864
+
865
+ <dt>2006-12-20
866
+ <dd>
867
+ version 2.7.3
868
+ <ul>
869
+ <li>BUG: Mysql#query with block is stopped when last query failed.
870
+ </ul>
871
+
872
+ <dt>2006-10-28
873
+ <dd>
874
+ version 2.7.2
875
+ <ul>
876
+ <li>BUG: Mysql::Stmt#result_metadata don't return nil. (Thanks to Hidetoshi)
877
+ <li>BUG: Mysql#close check mysql_errno.
878
+ <li>BUG: multistatement Mysql#query with block ignore error.
879
+ <li>extconf.rb for Visual C++. (Thanks to Shugo Maeda)
880
+ <li>support MySQL BIT type.
881
+ <li>add Mysql::Field::TYPE_BIT, TYPE_NEWDECIMAL.
882
+ </ul>
883
+
884
+ <dt>2006-06-04
885
+ <dd>
886
+ version 2.7.1
887
+ <ul>
888
+ <li>change free() to xfree(). To avoid crash on Windows. (Thanks Tobias Grimm)
889
+ </ul>
890
+
891
+ <dt>2005-08-22
892
+ <dd>
893
+ version 2.7
894
+ <ul>
895
+ <li>add constants for Mysql#options: Mysql::OPT_GUESS_CONNECTION, Mysql::OPT_USE_EMBEDDED_CONNECTION, Mysql::OPT_USE_REMOTE_CONNECTION, Mysql::SET_CLIENT_IP
896
+ <li>test.rb: for 4.0.x, 5.0.x
897
+ </ul>
898
+
899
+ <dt>2005-08-16
900
+ <dd>
901
+ version 2.7-beta3
902
+ <ul>
903
+ <li>add Mysql::Stmt#bind_result
904
+ </ul>
905
+
906
+ <dt>2005-08-02
907
+ <dd>
908
+ version 2.7-beta2
909
+ <ul>
910
+ <li>BUG: mysql.c.in: fetch_hash: nil value doesn't exist in hash. (Thanks Stefan Kaes)
911
+ <li>add constant Mysql::VERSION.
912
+ <li>add Mysql#prepare
913
+ </ul>
914
+
915
+ <dt>2005-07-24
916
+ <dd>
917
+ version 2.7-beta
918
+ <ul>
919
+ <li>add Mysql#stmt_init method
920
+ <li>add Mysql::Stmt, Mysql::Time, Mysql::RowOffset class
921
+ <li>add Mysql::Error#sqlstate method
922
+ <li>change offset value to Mysql::RowOffset object that is used by Mysql::Result#row_seek,row_tell
923
+ </ul>
924
+
925
+ <dt>2005-07-31
926
+ <dd>
927
+ version 2.6.3
928
+ <ul>
929
+ <li>add constant Mysql::VERSION.
930
+ </ul>
931
+
932
+ <dt>2005-07-26
933
+ <dd>
934
+ version 2.6.2
935
+ <ul>
936
+ <li>BUG: mysql.c.in: fetch_hash: nil value doesn't exist in hash. (Thanks Stefan Kaes)
937
+ </ul>
938
+
939
+ <dt>2005-06-28
940
+ <dd>
941
+ version 2.6.1
942
+ <ul>
943
+ <li>mysql.c.in: fix to compile error on MacOSX.
944
+ </ul>
945
+
946
+ <dt>2005-04-25
947
+ <dd>
948
+ version 2.6
949
+ <ul>
950
+ <li>add constants for Mysql#option():
951
+ Mysql::OPT_PROTOCOL, Mysql::OPT_READ_TIMEOUT,
952
+ Mysql::OPT_WRITE_TIMEOUT, Mysql::SET_CHARSET_DIR,
953
+ Mysql::SET_CHARSET_NAME, Mysql::SHARED_MEMORY_BASE_NAME,
954
+ Mysql::SECURE_AUTH
955
+ <li>add methods: Mysql#more_results?(), Mysql#next_result(),
956
+ Mysql#set_server_option(), Mysql#sqlstate()
957
+ <li>add constants for Mysql#connect():
958
+ Mysql::CLIENT_MULTI_STATEMENTS, Mysql::CLIENT_MULTI_RESULTS
959
+ <li>add constants for Mysql#set_server_option():
960
+ Mysql::OPTION_MULTI_STATEMENTS_ON,
961
+ Mysql::OPTION_MULTI_STATEMENTS_OFF
962
+ <li>add Mysql#query() with block
963
+ <li>add Mysql#reconnect(), Mysql#reconnect=()
964
+ <li>When connection was closed, it don't try to reconnect by default.
965
+ </ul>
966
+
967
+ <dt>2005-02-12
968
+ <dd>
969
+ version 2.5.2
970
+ <ul>
971
+ <li>BUG: Mysql#connect make object to not close. (Thanks Andres Salomon)
972
+ </ul>
973
+
974
+ <dt>2004-09-20
975
+ <dd>
976
+ version 2.5.1
977
+ <ul>
978
+ <li>add Mysql#set_ssl().
979
+ </ul>
980
+
981
+ <dt>2004-08-31
982
+ <dd>
983
+ version 2.5
984
+ <ul>
985
+ <li>correspond to MySQL 4.1.x.
986
+ <li>change MysqlRes, MysqlField, MysqlError to Mysql::Result, Mysql::Field, Mysql::Error.
987
+ <li>add Mysql.client_version(), Mysql.get_client_version(),
988
+ Mysql#client_version(), Mysql#get_client_version(),
989
+ Mysql#server_version(), Mysql#get_server_version(),
990
+ Mysql#warning_count(), Mysql#commit(), Mysql#rollback(),
991
+ Mysql#autocommit().
992
+ <li>add Mysql::Field#is_not_null?(), Mysql::Field#is_pri_key?(),
993
+ Mysql::Field#is_num?().
994
+ <li>add MysqlField::TYPE_VAR_STRING.
995
+ </ul>
996
+
997
+ <dt>2003-08-10
998
+ <dd>
999
+ version 2.4.5
1000
+ <ul>
1001
+ <li>extconf.rb: correspond to MySQL 4.1.
1002
+ <li>mysql.c.in: correspond to Ruby 1.8.
1003
+ </ul>
1004
+
1005
+ <dt>2003-02-23
1006
+ <dd>
1007
+ version 2.4.4a
1008
+ <ul>
1009
+ <li>make extconf.rb to correspond to Ruby 1.8.0
1010
+ </ul>
1011
+
1012
+ <dt>2003-01-29
1013
+ <dd>
1014
+ version 2.4.4
1015
+ <ul>
1016
+ <li>add Mysql::OPT_LOCAL_INFILE.
1017
+ <li>add --with-mysql-config option to extconf.rb.
1018
+ <li>extconf.rb automatically detect typical library.
1019
+ </ul>
1020
+
1021
+ <dt>2003-01-05
1022
+ <dd>
1023
+ version 2.4.3c
1024
+ <ul>
1025
+ <li>modified English README. Thanks to Paul DuBois.
1026
+ </ul>
1027
+
1028
+ <dt>2002-12-24
1029
+ <dd>
1030
+ version 2.4.3b
1031
+ <ul>
1032
+ <li>make extconf.rb to correspond to Ruby 1.6.8.
1033
+ </ul>
1034
+
1035
+ <dt>2002-11-07
1036
+ <dd>
1037
+ version 2.4.3a
1038
+ <ul>
1039
+ <li>fix bug duplicating constant.
1040
+ </ul>
1041
+
1042
+ <dt>2002-09-10
1043
+ <dd>
1044
+ version 2.4.3
1045
+ <ul>
1046
+ <li>for error number with prefix ER_ .
1047
+ <li>get error constant from errmsg.h and mysqld_error.h automatically.
1048
+ </ul>
1049
+
1050
+ <dt>2002-01-07
1051
+ <dd>
1052
+ version 2.4.2
1053
+ <ul>
1054
+ <li>for MySQL 4.0.
1055
+ <li>change `uint' to `unsigned int' (for mswin).
1056
+ </ul>
1057
+
1058
+ <dt>2001-12-02
1059
+ <dd>
1060
+ version 2.4.1
1061
+ <ul>
1062
+ <li>remove `extern' (for Cygiwn).
1063
+ <li>change option of extconf.rb.
1064
+ </ul>
1065
+
1066
+ <dt>2001-10-12
1067
+ <dd>
1068
+ version 2.4.0
1069
+ <ul>
1070
+ <li>for Ruby 1.7.
1071
+ <li>add Mysql::debug(), Mysql#change_user(), Mysql#character_set_name(), Mysql#dump_debug_info().
1072
+ </ul>
1073
+ </dl>
1074
+
1075
+ <h2>Author</h2>
1076
+ <p>
1077
+ e-mail: TOMITA Masahiro <a href="mailto:tommy@tmtm.org">tommy@tmtm.org</a>
1078
+ <a href="http://tmtm.org">http://tmtm.org</a>
1079
+ </p>
1080
+ <hr>
1081
+ <address><a href="mailto:tommy@tmtm.org">TOMITA Masahiro</a></address>
1082
+ <!-- Created: Sun Aug 29 11:52:09 JST 2004 -->
1083
+ <!-- hhmts start -->
1084
+ Last modified: Tue Sep 30 00:01:12 JST 2008
1085
+ <!-- hhmts end -->
1086
+ </body>
1087
+ </html>