Javability (Java, Zaurus, Linux, Live) by Jean-Marc Autexier, Saarland/Germany
cat /dev/www | egrep 'Java|Linux|Zaurus|ITnews|Live' > blog

20.12.03 11:34 ( , , , )

News:
Run java in MySQL. It allows you to extend user defined functions in Java.
Sample code: the function test.GreenBar is executed on column1 and column2 of the result set
SELECT: SELECT judf("test/GreenBar", COLUMN1, COLUMN2) FROM foo;

Java Code:
package test;


public class GreenBar {

public static String exec(String[] args) {
StringBuffer buf = new StringBuffer("Green bar (");
buf.append(args.length);
buf.append(") ");
for(int i = 0; i < args.length; i++){
buf.append(", ");
buf.append(args[i]);
}
return buf.toString();
}

// future interface?
public static byte[] exec(byte[][] args) {
return ("green bar " + new String(args[0])).getBytes();
}
}

posted by Jean-Marc Autexier | 0 comments | Permalink | Send to Friends | Google it!
Subscribe

Locations of visitors to this page
selected blogs
ressources
Security
Unsorted
Fun
Free&Open Software
archives
This is a personal web page. Things said here do not represent the position of my employer.
RSS icons by: FastIcon.com