🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

ruby-mysql-ext

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ruby-mysql-ext

2.9.14
Rubygems
Version published
Maintainers
1
Created
Source

= ruby-mysql

== Description

MySQL connector for Ruby.

== Installation

ruby setup.rb

=== Gem Installation

gem install ruby-mysql

== Features/Problems

  • Ruby だけで書かれているのでコンパイル不要です。

  • Ruby 1.9.x の M17N に対応しています。

  • MySQL/Ruby 2.8.x とほぼ互換があります。

== Synopsis

使用例:

my = Mysql.connect('hostname', 'username', 'password', 'dbname') my.query("select col1, col2 from tblname").each do |col1, col2| p col1, col2 end stmt = my.prepare('insert into tblname (col1,col2) values (?,?)') stmt.execute 123, 'abc'

== Incompatible with MySQL/Ruby 2.8.x

  • Ruby 1.8.x ではシフトJISのような安全でないマルチバイト文字セットに対して Mysql#escape_string を使用すると例外が発生します。

  • いくつかのメソッドがありません: Mysql#debug, Mysql#change_user, Mysql#create_db, Mysql#drop_db, Mysql#dump_debug_info, Mysql#ssl_set, Mysql#reconnect

  • Mysql#options でサポートしているオプションは次のものだけです: Mysql::INIT_COMMAND, Mysql::OPT_CONNECT_TIMEOUT, Mysql::OPT_LOCAL_INFILE, Mysql::OPT_READ_TIMEOUT, Mysql::OPT_WRITE_TIMEOUT, Mysql::SET_CHARSET_NAME. これら以外を指定すると "option not implementted" という warning が標準エラー出力に出力されます。

  • Mysql#use_result は Mysql#store_result と同じです。つまりサーバーから一気に結果セットを読み込みます。

== Improvement from MySQL/Ruby 2.8.x

  • Ruby 1.9.x の M17N に対応しています。 mysqld へのクエリ文字列やプリペアドステートメントで与える値は mysqld との接続の文字コードに自動的に変換されます。 mysqld からの結果文字列は接続文字コードとして取り出されます。

  • Mysql::Result, Mysql::Stmt が Enumerable を include しています。

  • ブロックなしの Mysql::Result#each, each_hash Mysql::Stmt#each, each_hash が Enumerator を返します。

  • Mysql#charset= で接続 charset を指定できます。

  • Mysql::Error だけでなく、エラー種別ごとにエラークラスが用意されてます。たとえば、構文エラーの場合は Mysql::ServerError::ParseError など。これらのエラーは Mysql::Error の継承クラスです。

== Copyright

Author :: TOMITA Masahiro tommy@tmtm.org Copyright :: Copyright (c) 2009-2012 TOMITA Masahiro License :: Ruby's

FAQs

Package last updated on 30 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts