Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

mattn/mysql-mruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MySQL UDF with mruby

Installation

$ git clone git://github.com/mattn/mysql-mruby.git$ cd mysql-mruby$ make$ sudo cp mysql_mrb.so /foo/bar/lib/mysql/plugin/
$ mysql -urootmysql> create function mrb_eval returns string soname 'mrb_eval.so';

Usage

mysql> SELECT mrb_eval('[1,2,3].map {|x| "hello" + x}');+-------------------------------------------+| mrb_eval('[1,2,3].map {|x| "hello#{x}"}') |+-------------------------------------------+| ["hello1", "hello2", "hello3"]            |+-------------------------------------------+1 row in set (0.00 sec)
mysql> select mrb_eval('ARGV', now(), now());+------------------------------------------------+| mrb_eval('ARGV', now(), now())                 |+------------------------------------------------+| ["2015-05-01 19:53:02", "2015-05-01 19:53:02"] |+------------------------------------------------+1 row in set (0.00 sec)
mysql> create table foo(id integer primary key auto_increment, value text);Query OK, 0 rows affected (0.39 sec)mysql> insert into foo(value) values('foo');Query OK, 1 row affected (0.08 sec)mysql> insert into foo(value) values('boo');Query OK, 1 row affected (0.02 sec)mysql> select mrb_eval('ARGV[0]', value) from foo;+----------------------------+| mrb_eval('ARGV[0]', value) |+----------------------------+| foo                        || boo                        |+----------------------------+2 rows in set (0.00 sec)

Author

Yasuhiro Matsumoto (a.k.a mattn)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp