Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a User-Defined Stored Procedure to the SQLite schema #236

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Crazee
Copy link

@Crazee Crazee commented Jun 30, 2017

I created a Bedrock plugin udf.so that registers a SQLite stored procedure called gouda. You can, of course, replace the definition in udf.c with others that please you. It gets made via "make udf" (which is in with my Docker build mechanism, just because). You load it by adding, say,

-plugins udf,db,jobs,cache,mysql

to bedrock.cfg.

Then cheese up your SQL:

$ docker run -it --rm --net container:rock mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: bedrock e7bb200ce9a21be4c3d23e7f7a49775539e164c6

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [bedrock]> SELECT gouda(3.1, 4.2, 1.5, 2.7) AS cheese;
+--------+
| cheese |
+--------+
|   8.97 |
+--------+
1 row in set (0.00 sec)

MySQL [bedrock]> 

@quinthar
Copy link
Contributor

quinthar commented Jun 30, 2017 via email

@Crazee
Copy link
Author

Crazee commented Jun 30, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants