## org.h2.samples
Class Function

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

    public class Function

extends java.lang.Object

This sample application shows how to define and use custom (user defined) functions in this database.

Constructor Summary
`Function()`

Method Summary
`static java.sql.ResultSet` `getMatrix(java.sql.Connection conn, java.lang.Integer size)` Creates a simple result set with two columns.
`static boolean` `isPrime(int value)` Check if a value is a prime number.
`static void` `main(java.lang.String... args)` This method is called when executing this sample application from the command line.
`static java.sql.ResultSet` `query(java.sql.Connection conn, java.lang.String sql)` Execute a query.
`static java.sql.ResultSet` `simpleResultSet()` Creates a simple result set with one row.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Function

    public Function()

Method Detail

### main

    public static void main(java.lang.String... args)
                     throws java.lang.Exception

  This method is called when executing this sample application from the command line.

  Parameters:
    `args` - the command line parameters
  Throws:
    `java.lang.Exception`

### 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 java.sql.ResultSet query(java.sql.Connection conn,
                                           java.lang.String sql)
                                    throws java.sql.SQLException

  Execute a query.

  Parameters:
    `conn` - the connection
    `sql` - the SQL statement
  Returns:
    the result set
  Throws:
    `java.sql.SQLException`

### simpleResultSet

    public static java.sql.ResultSet simpleResultSet()

  Creates a simple result set with one row.

  Returns:
    the result set

### getMatrix

    public static java.sql.ResultSet getMatrix(java.sql.Connection conn,
                                               java.lang.Integer size)
                                        throws java.sql.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:
    `java.sql.SQLException`