Class Function

java.lang.Object
org.h2.samples.Function

public class Function extends Object
This sample application shows how to define and use custom (user defined) functions in this database.
  • Constructor Details

    • Function

      public Function()
  • Method Details

    • main

      public static void main(String... args) throws Exception
      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

      public static ResultSet query(Connection conn, String sql) throws SQLException
      Execute a query.
      Parameters:
      conn - the connection
      sql - the SQL statement
      Returns:
      the result set
      Throws:
      SQLException - on failure
    • simpleResultSet

      public static ResultSet simpleResultSet()
      Creates a simple result set with one row.
      Returns:
      the result set
    • getMatrix

      public static ResultSet getMatrix(Connection conn, Integer size) throws SQLException
      Creates a simple result set with two columns.
      Parameters:
      conn - the connection
      size - the number of x and y values
      Returns:
      the result set with two columns
      Throws:
      SQLException - on failure