How can I use system(operating system) variables like JAVA_HOME In my own mysql stored procedure.
Guess you may need to use an external library such as UDF Repository for MySQL to do this. A reference to the library can be found here. There should be a sys_get() function call that may serve the purpose.
Related
We store representations of millions of chemical compounds as BLOBs in a MySQL database. We also keep hashes of these BLOBs when we need to query among these compounds and comparing these hashes in the queries.
Since we found out that standard hash functions(such as CRC) provided by MySQL library collides frequently for our use-case, we used a custom hash function specific to our data, wrapped it as a MySQL plugin and created a User Defined Function with this plugin as below:
CREATE FUNCTION customhash RETURNS INTEGER SONAME 'customhash.so'
Unfortunately, we need to move our MySQL installation to another managed data centre and because of the security reasons & data centre policy, we are not allowed to customize MySQL by adding plugins.
We've recently heard about the XXHash library, we made a few tests on it and we found out it has great performance and it doesn't generate collisions in our data. Also, it turns out it has already been used by MySQL standard distribution internally.
I wonder if it is possible to configure MySQL server to call XXH64_digest function in our MySQL routines without compiling it as a plugin.
I've checked MySQL source code and built-in functions and I could not find any way to run XXHash in MySQL routines. It seems XXHash is used by MySQL internally and it is not user-visible.
In order to run XXHash in MySQL routines, I have developed a plugin in case anyone needs to use XXHash algorithm in MySQL server.
This plug in can be found here: Github repository for xxhash_mysql_plugin.
After installing plug in you can run the xxhash function in your select statements as below:
How do I create a UDF for MySQL using Delphi?
Does anyone have any code templates?
I want the code template to be integrated in Delphi versions(2007 and upper), so I need these templates to be usable with and without Unicode support.
For starters, Google reveals:
documentation
a forum thread
an example
You need to create a DLL with a few exported functions, as documented.
I'm trying to write a MySQL UDF (User Definied Function), which should read the configuration file of MySQL - my.cnf -, or access MySQL session and status vars.
How do I do that ?
I'm sure, there are functions implemented in MySQL source code - somewhere ... for this functionality.
How do I find them?
Also, is there a good MySQL source API documentation?
Thanks,
krisy
The easiest solution I found, was starting MySQL from a script, which script contains commands, to set enviromental variables, and accesss these variables througg getenv() function from UDF.
If anyone has a better solution, I'm interested very much :-)
I have heard that one in PostgreSQL could write stored procedures in ruby (also python/java/c++).
Is this possible in MySQL?
Because I dont want to learn their own language for it.
Thanks
No, you can't. Just install PostgreSQL on your (virtual) system and install PL/Ruby as well:
http://moulon.inra.fr/ruby/plruby.html
Setting up a virtual machine (in VMware or Virtual Box) using Ubuntu with PostgreSQL, takes just a few minutes:
https://help.ubuntu.com/10.04/serverguide/C/postgresql.html
Simply put - nope. In MySQL you have to write a SP in their language or a UDF in C/C++. I brought up a C/C++ UDF, but I don't believe you can even really do a stored procedure in them.
They don't support different languages via a pluggable system like PostgreSQL.
Is possible? I plan to backup mysql database using vb.net. If you know any beginner tutorial on how to do this, then please let me know.
If I understand the question correctly, you want to start mysql.exe from VB.Net and supply some command-line parameters to tell it what to do (in your case, do a database backup). (FWIW, you might be better off using mysqldump.exe for that.)
You can start any process via the System.Diagnostics.Process.Start method. You'll probably want either this variant that gives you full control over the startup, or this one that just lets you specify the process (EXE) name and arguments. Here's a page with lots of examples. They're in C#, but it shows using these methods; the syntactic differences don't (I suspect) get in the way much.
Off-the-cuff example:
Imports System.Diagnostics
Process.Start("mysqldump.exe", "myDatabaseName")
' Or include the path:
Process.Start("C:\Program Files\MySQL\MySQL Server\bin\mysqldump.exe", "myDatabaseName")