At 10:39 16/11/00 +0100, Zeugswetter Andreas SB wrote:
>
>Has anybody had time to look at how this is done in DB/2, Oracle ? Philip ?
>

Don't know about Oracle or DB2, but Dec/RDB has:

    Create Function <name1> [Stored Name Is <name2>] (...) Returns <type>;
        [ External Name <name3> ] [ Location <libfile> ] 
        [Language {ADA|C|Fortran|Pascal|General] 
        General Parameter Style [Not] Variant

where <name1> is the function name, the 'Stored Name' relates to
cross-schema functions, the 'External Name' is the name of the entry point,
'location' is the file location and the 'Variant' part corresponds to our
'iscacheable' attribute.

Functions themselves require no special coding. This is pretty much what I
think 'Language C' does for us now - just calling a shared library. There
is definitely a case to be made for coninuing to support standard calls to
general libraries unmodified. In Tom's current proposal, I think this will
be the case if there is no 'function-info' function available. 




----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                 |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/

Fri, 17 Nov 2000 21:43:28 +1100
Philip Warner <pjw@rhyme.com.au>
Re: AW: Coping with 'C' vs 'newC' function language
  namesh
On Fri, Nov 17, 2000 at 09:43:28PM +1100, Philip Warner wrote:
> At 10:39 16/11/00 +0100, Zeugswetter Andreas SB wrote:
> >
> >Has anybody had time to look at how this is done in DB/2, Oracle ? Philip ?
> >
> 
> Don't know about Oracle or DB2, but Dec/RDB has:
> 

Well, I don't know 'nuthing about Oracle, but I _did_ sign up for the
OTN web site some time ago, specifically to get at Oracle docs. ;-)

After clicking around there for a bit I came up with this, which is my
interpretation of a 'flowchart' style language diagram:

CREATE [OR REPLACE] FUNCTION [<schema>.]<name> 
      [( <argument1> [IN|OUT|IN OUT] [NOCOPY] <datatype1> [, <...>] )] 
    RETURN <datatype> 
      [{AUTHID {CURRENT_USER|DEFINER} | DETERMINISTIC | PARALLEL_ENABLE} <...>]
{IS|AS} 
    { <pl/sql_function_body>| 
    LANGUAGE {JAVA NAME '<java_method_name>'| 
              C [NAME <c_func_name>] LIBRARY <lib_name> 
			  [WITH CONTEXT] [PARAMETERS (...)] 
			  }
    }

The actual filesystem path to the DLL or .so is defined with a CREATE
LIBRARY command.

The WITH CONTEXT bit is a pointer to an opaque structure that the
underlying function is supposed to pass on to service routines it might
call, for their use.

It seems the parameters can be defined either in place with the name,
or with the PARAMETERS keyword.

Philip's comments about this directly calling into a C shared library
seem to apply, as well.

Ross
-- 
Open source code is like a natural resource, it's the result of providing
food and sunshine to programmers, and then staying out of their way.
[...] [It] is not going away because it has utility for both the developers 
and users independent of economic motivations.  Jim Flynn, Sunnyvale, Calif.

Fri, 17 Nov 2000 12:57:37 -0600
"Ross J. Reedstrom" <reedstrm@rice.edu>
Re: AW: Coping with 'C' vs 'newC' function language namesh