SQL::Schema::Function - A function stored within the database



NAME

SQL::Schema::Function - A function stored within the database


SYNOPSIS

  my $function = SQL::Schema::Function->new(%attr);
  my $sql = $function->create_statement;
  print $sql;
  print "$function";


DESCRIPTION

SQL::Schema::Function is a class for objects representing a function stored within the database. The methods of an instanciated object do allow to access the information within a database's data dictionary and to represent them as SQL create statements and the like using the proper SQL dialect.

Constructors

  $function = SQL::Schema::Function->new(%attr);

The new method instanciates a function object. The object is an in memory representation of a (possible) database function. The attributes are given as key value pairs by the hash %attr. Possible keys are:

  key               required?   value description
  name              yes         the name of the function
                                without preceeding schema name
  text              yes         the concatenation of all the text lines
                                forming the function's source code

As a function is basically a piece of source stored within the database, this class inherits all methods from SQL::Schema::Source. So please have a look at the new method describet at the SQL::Schema::Source(3) manpage. Though the new method here overwrites the new method there, it calls the super class's new method with just the key value pair for the source's type added.

  $function = SQL::Schema::Function->select($dbh,$name);

The select method fetches the attributes required by new from the database and returns the function object. (It calls new internally.)

If the function with the name $name could not be found within the database, the method returns undef.

The method's arguments are as follows:

$dbh
A database handle as defined by DBI(3).

$name
The name of the function without preceeding schema name.

Methods

The following attribute methods do exist:

  $type = $function->type;

The method type always returns the string ``function''. This package inherits all the other methods from SQL::Schema::Source as a database function basically is a special kind of source within the database. For more information, please have a look at the SQL::Schema::Source(3) manpage.


AUTHOR AND COPYRIGHT

  SQL::Schema::Function is Copyright (C) 2000,
    Torsten Hentschel
    Windmuehlenweg 47
    44141 Dortmund
    Germany
    Email: todd@bayleys.ping.de
  All rights reserved.
  You may distribute this package under the terms of either the GNU
  General Public License or the Artistic License, as specified in the
  Perl README file.


SEE ALSO

DBI(3), the SQL::Schema(3) manpage, the SQL::Schema::Source(3) manpage

 SQL::Schema::Function - A function stored within the database