Package org.h2.samples
Class Function
java.lang.Object
org.h2.samples.Function
This sample application shows how to define and use
custom (user defined) functions in this database.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResultSetgetMatrix(Connection conn, Integer size) Creates a simple result set with two columns.static booleanisPrime(int value) Check if a value is a prime number.static voidThis method is called when executing this sample application from the command line.static ResultSetquery(Connection conn, String sql) Execute a query.static ResultSetCreates a simple result set with one row.
-
Constructor Details
-
Function
public Function()
-
-
Method Details
-
main
This method is called when executing this sample application from the command line.- Parameters:
args- the command line parameters- Throws:
Exception- on failure
-
isPrime
public static boolean isPrime(int value) Check if a value is a prime number.- Parameters:
value- the value- Returns:
- true if it is a prime number
-
query
Execute a query.- Parameters:
conn- the connectionsql- the SQL statement- Returns:
- the result set
- Throws:
SQLException- on failure
-
simpleResultSet
Creates a simple result set with one row.- Returns:
- the result set
-
getMatrix
Creates a simple result set with two columns.- Parameters:
conn- the connectionsize- the number of x and y values- Returns:
- the result set with two columns
- Throws:
SQLException- on failure
-