SQL::Schema::Source - A source stored within the database |
SQL::Schema::Source - A source stored within the database
my $source = SQL::Schema::Source->new(%attr);
my $sql = $source->create_statement; print $sql;
print "$source";
SQL::Schema::Source
is a class for objects representing the source
of a package, function, procedure etc. 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.
$source = SQL::Schema::Source->new(%attr);
The new method instanciates a source object. The object is
an in memory representation of a (possible) database source.
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 package, procedure, function, ... without preceeding schema name
type yes the type of the source; e.g. `procedure', `function', `package', `package body', ...
text yes the concatenation of all the text lines forming the source code
All the keys correspond to the columns with the same name from
Oracle's data dictionary view user_sources
. Only text
is somewhat
special: It has to be a concatenation of the source lines.
$source = SQL::Schema::Source->select($dbh,$name,$type);
The select method fetches the attributes required by new from the database and returns the source object. (It calls new internally.)
If the source with the name $name
could not be found within
the database, the method returns undef.
The method's arguments are as follows:
$dbh
$name
$type
The following attribute methods do return the current value of the attributes (as handed over to the new method):
$name = $source->name; $type = $source->type; $text = $source->text;
$sql = $source->create_statement; $sql = "$source";
Returns a string containing an SQL statements for creation of this source. This method is overloaded with the string operator. So the two examples above are equivalent.
$sql = $trigger->drop_statement;
Returns a string containing an SQL statement that would drop this trigger.
SQL::Schema::Source 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.
DBI(3), the SQL::Schema(3) manpage,
SQL::Schema::Source - A source stored within the database |