{"id":19064981,"url":"https://github.com/netkiller/mysql-fifo-plugin","last_synced_at":"2025-04-28T11:27:27.490Z","repository":{"id":12544364,"uuid":"15214475","full_name":"netkiller/mysql-fifo-plugin","owner":"netkiller","description":"MySQL Pipes (FIFOs) Plugin","archived":false,"fork":false,"pushed_at":"2017-03-17T02:36:22.000Z","size":7,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-28T11:27:24.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netkiller.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-16T01:29:31.000Z","updated_at":"2022-07-23T05:53:28.000Z","dependencies_parsed_at":"2022-07-21T16:18:37.444Z","dependency_job_id":null,"html_url":"https://github.com/netkiller/mysql-fifo-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netkiller%2Fmysql-fifo-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netkiller%2Fmysql-fifo-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netkiller%2Fmysql-fifo-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netkiller%2Fmysql-fifo-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netkiller","download_url":"https://codeload.github.com/netkiller/mysql-fifo-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251303903,"owners_count":21567771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T00:48:06.319Z","updated_at":"2025-04-28T11:27:27.459Z","avatar_url":"https://github.com/netkiller.png","language":"C","funding_links":["https://www.paypal.me/netkiller"],"categories":[],"sub_categories":[],"readme":"mysql-fifo-plugin\n=================\n\nMySQL Pipes (FIFOs) Plugin\n\nBuild\n-----\n\tcd /usr/local/src/\n\tgit clone https://github.com/netkiller/mysql-fifo-plugin.git\n\tcd mysql-fifo-plugin/\n\t\n\tcmake .\n\tmake\n\tmake install\n\n\tor\n\t\n\tgcc -O3  -g  -I/usr/include/mysql -I/usr/include  -fPIC -lm -lz -shared -o libfifo.so fifo.c\n\tsudo mv libfifo.so /usr/lib/mysql/plugin/\n\t\nPlugin Install and Uninstall\n--------------\n\n### Install\n\n\tcreate function fifo_create returns string soname 'libfifo.so';\n\tcreate function fifo_remove returns string soname 'libfifo.so';\n\tcreate function fifo_read returns string soname 'libfifo.so';\n\tcreate function fifo_write returns string soname 'libfifo.so';\n\n### Uninstall\n\n\tdrop function fifo_create;\n\tdrop function fifo_remove;\n\tdrop function fifo_read;\n\tdrop function fifo_write;\n\nTesting\n-------\n### 创建管道\t\n\tmysql\u003e create function fifo_create returns string soname 'libfifo.so';\n\tQuery OK, 0 rows affected (0.02 sec)\n\n\tmysql\u003e select fifo_create('/tmp/myfifo');\n\t+----------------------------+\n\t| fifo_create('/tmp/myfifo') |\n\t+----------------------------+\n\t| ture                       |\n\t+----------------------------+\n\t1 row in set (0.00 sec)\n\t\n\t查看管道是否创建\n\t\n\t$ ls /tmp/myfifo \n\t/tmp/myfifo\n\t\n\t覆盖测试，正确应该返回false\n\t\n\tmysql\u003e select fifo_create('/tmp/myfifo');\n\t+----------------------------+\n\t| fifo_create('/tmp/myfifo') |\n\t+----------------------------+\n\t| false                      |\n\t+----------------------------+\n\t1 row in set (0.00 sec)\n\n### 删除管道\t\n\tmysql\u003e select fifo_remove('/tmp/myfifo');\n\t+----------------------------+\n\t| fifo_remove('/tmp/myfifo') |\n\t+----------------------------+\n\t| true                       |\n\t+----------------------------+\n\t1 row in set (0.00 sec)\n\t\n\tmysql\u003e select fifo_remove('/tmp/my');\n\t+------------------------+\n\t| fifo_remove('/tmp/my') |\n\t+------------------------+\n\t| false                  |\n\t+------------------------+\n\t1 row in set (0.00 sec)\n\n\t删除不存在的管道会提示 false\n\n### 读管道\n\n\t在一个终端窗口中运行\n\tmysql\u003e select fifo_read('/tmp/myfifo');\n\t+--------------------------+\n\t| fifo_read('/tmp/myfifo') |\n\t+--------------------------+\n\t| Hello world              |\n\t+--------------------------+\n\t1 row in set (7.85 sec)\n\n\t在另一个终端窗口中运行\n\tmysql\u003e select fifo_write('/tmp/myfifo','Hello world !!!');\n\t+---------------------------------------------+\n\t| fifo_write('/tmp/myfifo','Hello world !!!') |\n\t+---------------------------------------------+\n\t| true                                        |\n\t+---------------------------------------------+\n\t1 row in set (0.00 sec)\t\n\t\n\t或者\n\t\n\t在命令行运行\n\t$ echo \"Hello world\" \u003e /tmp/myfifo\n\t\n\t在SQL客户端中运行\n\tmysql\u003e select fifo_read('/tmp/myfifo');\n\t+--------------------------+\n\t| fifo_read('/tmp/myfifo') |\n\t+--------------------------+\n\t| Hello world\n\t\t\t\t |\n\t+--------------------------+\n\t1 row in set (0.00 sec)\n\t注意上面echo会自动增加换行符，-n参数可以避免\n\t$ echo -n \"Hello world\" \u003e /tmp/myfifo\n\t\n\tmysql\u003e select fifo_read('/tmp/myfifo');\n\t+--------------------------+\n\t| fifo_read('/tmp/myfifo') |\n\t+--------------------------+\n\t| Hello world              |\n\t+--------------------------+\n\t1 row in set (0.01 sec)\n\t\n### 写管道\n\tmysql\u003e select fifo_write('/tmp/myfifo','Hello world !!!');\n\t+---------------------------------------------+\n\t| fifo_write('/tmp/myfifo','Hello world !!!') |\n\t+---------------------------------------------+\n\t| true                                        |\n\t+---------------------------------------------+\n\t1 row in set (0.00 sec)\n\t\n\t$ cat /tmp/myfifo\n\tHello world !!!\n\t\n\t管道 /tmp/nofifo 不存在会返回false\n\tmysql\u003e select fifo_write('/tmp/nofifo',concat(mobile,'\\r\\n')) from demo;\n\t+-------------------------------------------------+\n\t| fifo_write('/tmp/nofifo',concat(mobile,'\\r\\n')) |\n\t+-------------------------------------------------+\n\t| false                                           |\n\t| false                                           |\n\t| false                                           |\n\t| false                                           |\n\t| false                                           |\n\t+-------------------------------------------------+\n\t5 rows in set (0.01 sec)\t\n\n# Donations\n\nWe accept PayPal through:\n\nhttps://www.paypal.me/netkiller\n\nWechat (微信) / Alipay (支付宝) 打赏:\n\nhttp://www.netkiller.cn/home/donations.html\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/netkiller/mysql-fifo-plugin/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetkiller%2Fmysql-fifo-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetkiller%2Fmysql-fifo-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetkiller%2Fmysql-fifo-plugin/lists"}