1
SELECT JS("var foo = 'Hello'; foo + ', World';");
2
JS("var foo = 'Hello'; foo + ', World';")
4
SELECT JS("var foo = 'Hello'; foo + ', ' + arguments[0];", "World");
5
JS("var foo = 'Hello'; foo + ', ' + arguments[0];", "World")
7
SELECT JS("var foo = 'Hello'; foo + ', ' + bar;", "World" AS 'bar');
8
JS("var foo = 'Hello'; foo + ', ' + bar;", "World" AS 'bar')
10
CREATE TABLE jstest (id INT PRIMARY KEY auto_increment, i INT, d DOUBLE, t TIMESTAMP, dt DATETIME);
11
INSERT INTO jstest VALUES (1, -5, 7.5, '2001-02-16 20:38:40', '2011-09-24 22:26:31');
12
SELECT JS("arguments[0] + 1", i) FROM jstest WHERE id=1;
13
JS("arguments[0] + 1", i)
15
SELECT JS("arguments[0] + 1.1", d) FROM jstest WHERE id=1;
16
JS("arguments[0] + 1.1", d)
18
SELECT JS("var d = arguments[0]; d.getUTCFullYear() + ' - ' + d.getUTCHours() + ' - ' + + d.getUTCSeconds();", t) FROM jstest WHERE id=1;
19
JS("var d = arguments[0]; d.getUTCFullYear() + ' - ' + d.getUTCHours() + ' - ' + + d.getUTCSeconds();", t)
21
SELECT JS("var d = arguments[0]; d.getUTCDate() + ' - ' + d.getUTCHours() + ' - ' + d.getUTCMinutes();", dt) FROM jstest WHERE id=1;
22
JS("var d = arguments[0]; d.getUTCDate() + ' - ' + d.getUTCHours() + ' - ' + d.getUTCMinutes();", dt)
24
SELECT JS("var num = arguments[0] + arguments[1]; arguments[2] + num;", i, d, "The sum is: ") FROM jstest WHERE id=1;
25
JS("var num = arguments[0] + arguments[1]; arguments[2] + num;", i, d, "The sum is: ")
27
SELECT JS('var jsondoc = JSON.parse(arguments[0]); JSON.stringify(jsondoc["name"]["firstname"]);', '{ "name" : {"firstname" : "Henrik", "lastname" : "Ingo"} }');
28
JS('var jsondoc = JSON.parse(arguments[0]); JSON.stringify(jsondoc["name"]["firstname"]);', '{ "name" : {"firstname" : "Henrik", "lastname" : "Ingo"} }')
31
SELECT JS("this is not javascript");
32
ERROR HY000: Script error: At line 1: SyntaxError: Unexpected identifier (Do SHOW ERRORS for more information.)
33
SELECT JS("var foo = 'Another'; foo + ' thread';");
34
JS("var foo = 'Another'; foo + ' thread';")