The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Genezzo::Havok::UserFunctions - load the user_functions table

SYNOPSIS

 # don't say "use Genezzo::Havok::UserFunctions".  Update the
 # dictionary havok table:

select HavokUse('Genezzo::Havok::UserFunctions') from dual;

DESCRIPTION

NOTE: this module replaces Genezzo::Havok::UserExtend.

The module Genezzo::XEval::Prepare constructs a function call interface based upon information from the user_functions table:

create table user_functions ( xid number, xtype char, xname char, args char, owner char, creationdate char, version char, argstyle char, sqlname char, typecheck char );

xid - a unique id number
xtype - the string "require" or "function"
xname - if xtype = "require", then xname is a package name, like "Text::Soundex". if xtype = "function", xname is a function name. A function name may be qualified with a package.
args - if xtype = "require", an (optional) blank-separated list of functions to import to the default Genezzo namespace. if xtype = "function", supply an actual function body in curly braces.
owner - owner of the package or function
creationdate - date row was created
version
argstyle - if set to HASH, pass a hash of the dictionary, the dbh, and the array ref function_args, else the function is just passed an array of the function arguments.
sqlname - currently UNUSED. Will be used to distinguish the perl function name from the SQL function name
typecheck - currently UNUSED. Will be used to distinguish a supplied type-checking function from a purely SQL execution function.

Example:

insert into user_functions values (1, 'require', 'Genezzo::Havok::Examples', 'isRedGreen', 'SYSTEM', '2004-09-21T12:12');

The row causes UserFunctions to "require Genezzo::Havok::Examples", and it imports "isRedGreen" into the default Genezzo namespace* (actually, it creates a stub function that calls Genezzo::Havok::Examples::isRedGreen").

An easier method is to use add_user_function, which is defined in Genezzo::Havok::Utils. The equivalent command to load the isRedGreen function is:

  select 
    add_user_function(
      'module=Genezzo::Havok::Examples',
      'function=isRedGreen')
  from dual;

ARGUMENTS

FUNCTIONS

EXPORT

LIMITATIONS

TODO

use "sqlname" and "typecheck" attributes in user_functions table
Need to fix "import" mechanism so can load specific functions into Genezzo::GenDBI namespace, versus creating stub functions. Use "import" and "export_to_level".
Could just load Acme::Everything and we'd be done...
Need function "type" information so can validate argument lists, determine return type of function. If pass named args, have "TypeCheck" and "Execute" modes for sql_function. Or have typecheck function pass back name/ref to execute function, since it may change depending on argument types.

AUTHOR

Jeffrey I. Cohen, jcohen@genezzo.com

SEE ALSO

perl(1).

Copyright (c) 2004, 2005, 2006 Jeffrey I Cohen. All rights reserved.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Address bug reports and comments to: jcohen@genezzo.com

For more information, please visit the Genezzo homepage at http://www.genezzo.com