Class FunctionMultiReturn


  • public class FunctionMultiReturn
    extends java.lang.Object
    User defined functions can return a result set, and can therefore be used like a table. This sample application uses such a function to convert polar to cartesian coordinates.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String... args)
      This method is called when executing this sample application from the command line.
      static java.sql.ResultSet polar2Cartesian​(java.lang.Double r, java.lang.Double alpha)
      Convert polar coordinates to cartesian coordinates.
      static java.lang.Double[] polar2CartesianArray​(java.lang.Double r, java.lang.Double alpha)
      Convert polar coordinates to cartesian coordinates.
      static java.sql.ResultSet polar2CartesianSet​(java.sql.Connection conn, java.lang.String query)
      Convert a set of polar coordinates to cartesian coordinates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FunctionMultiReturn

        public FunctionMultiReturn()
    • 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 - on failure
      • polar2Cartesian

        public static java.sql.ResultSet polar2Cartesian​(java.lang.Double r,
                                                         java.lang.Double alpha)
        Convert polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data.
        Parameters:
        r - the distance from the point 0/0
        alpha - the angle
        Returns:
        a result set with two columns: x and y
      • polar2CartesianArray

        public static java.lang.Double[] polar2CartesianArray​(java.lang.Double r,
                                                              java.lang.Double alpha)
        Convert polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data.
        Parameters:
        r - the distance from the point 0/0
        alpha - the angle
        Returns:
        an array two values: x and y
      • polar2CartesianSet

        public static java.sql.ResultSet polar2CartesianSet​(java.sql.Connection conn,
                                                            java.lang.String query)
                                                     throws java.sql.SQLException
        Convert a set of polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data.
        Parameters:
        conn - the connection
        query - the query
        Returns:
        a result set with the coordinates
        Throws:
        java.sql.SQLException - on failure