# $Id: README,v 1.16 2002/01/07 01:22:51 tommy Exp $

MySQL Ruby Module ver2.4.2

This is MySQL Ruby API. This have same function as C API.

[Requirement]

* MySQL 3.23.10+
* Ruby 1.4.5+

It may be made with other version but not verified.

[Install]

1st:
	% ruby extconf.rb
	% make

  extconf.rb has following options:

    --with-mysql-include=<dir>
	MySQL header directory. Default is /usr/local/include.

    --with-mysql-lib=<dir>
	MySQL library directory. Default is /usr/local/lib.

    --with-mysql-dir=<dir>
	Same as --with-mysql-include=<dir>/include,
	--with-mysql-lib=<dir>/lib.

2nd:
	% ruby -I. ./test.rb hostname user passwd

  test.rb has some argument. MySQL server hostname and MySQL username
  and password who can create database.

3rd:
	# make install

Note:

1. If you get error like 'libmysqlclient not found' when testing, you
   need to specify library directory on make.
	% env LD_RUN_PATH=<libmysqlclient.so directory> make

2. If you use libmysqlclient.a static library, some library may be
   needed. Edit extconf.rb to enable "have_library('m')" and
   "have_library('z')".

[Usage]

The method name is basically same as C API but no need 'mysql_'
prefix. For detail of usage of method, please see MySQL manual.

If an error occured in method, it raise MysqlError exception.

require "mysql"
	loading mysql module.

[Mysql class]

 CLASS METHODS
    init()
	Used for Mysql#options()
    real_connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
	alias: connect(), new()
    escape_string(str)
	alias: quote()
    get_client_info()
	alias: client_info()
    debug(str)

 OBJECT METHODS
    options(opt, val=nil)
    real_connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
	alias: connect()
    affected_rows()
    change_user(user=nil, passwd=nil, db=nil)
    character_set_name()
    close()
    create_db(db)
    dump_debug_info()
    drop_db(db)
    errno()
    error()
    escape_string(str)
	alias: quote()
    field_count()
    get_host_info()
	alias: host_info()
    get_proto_info()
	alias: proto_info()
    get_server_info()
	alias: server_info()
    info()
    insert_id()
    kill(id)
    list_dbs(db=nil)
    list_fields(table, field=nil)
    list_processes()
    list_tables(table=nil)
    ping()
    query(q)
    refresh(r)
    reload()
    select_db(db)
    shutdown()
    stat()
    store_result()
    thread_id()
    use_result()

 OBJECT VARIABLES
    query_with_result
	If true, query() do also store_result() and return MysqlRes
	object.  Default is true.

[MysqlRes class]

 CLASS METHODS
    free()
    data_seek(offset)
    fetch_field()
    fetch_fields()
    fetch_field_direct(fieldnr)
    fetch_lengths()
    fetch_row()
    fetch_hash(with_table=false)
    field_seek(offset)
    field_tell()
    num_fields()
    num_rows()
    row_seek(offset)
    row_tell()

 ITERATER
    each() {|x| ...}
	'x' is array of column value.
    each_hash(with_table=false) {|x| ...}
	'x' is hash of column value, and the key is column name.

[MysqlField class]

 OBJECT VARIABLES (read only)
    name
    table
    def
    type
    length
    max_length
    flags
    decimals

 OBJECT METHODS
    hash()
    inspect()
	return string formatted "#<MysqlField:name>".

[MysqlError class]

 OBJECT VARIABLES (read only)
    error
    errno

[History]

  2002-01-07	2.4.2
    * for MySQL 4.0.
    * change `uint' to `unsigned int' (for mswin).

  2001-12-02	2.4.1
    * remove `extern' (for Cygiwn).
    * change option of extconf.rb.

  2001-10-12	2.4.0
    * for Ruby 1.7.
    * add Mysql::debug(), Mysql#change_user(), Mysql#character_set_name(),
      Mysql#dump_debug_info().

[Author]

  e-mail: TOMITA Masahiro <tommy@tmtm.org>
  http://www.tmtm.org/mysql/
