Verify support for H2 database aliases in SQL scripts

This commit introduces a test to demonstrate how to define an alias in
an SQL script executed against an embedded H2 database.

Issue: SPR-15896
This commit is contained in:
Sam Brannen
2017-08-26 15:04:48 +01:00
parent 582014e944
commit 4e81ee5fdf
3 changed files with 35 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
DROP ALIAS IF EXISTS REVERSE;
-- REVERSE function borrowed from http://www.h2database.com/html/grammar.html#create_alias
CREATE ALIAS REVERSE AS $$
String reverse(String s) {
return new StringBuilder(s).reverse().toString();
}
$$;
INSERT INTO users(first_name, last_name) values('Sam', 'Brannen');