SQL::Tree - Generate a trigger-based SQL tree implementation
use SQL::Tree qw/generate/; use DBI; my %opts = ( dbtype => $dbtype, table => $table, pk => $pk_column, parent => $parent_column, drop => $bool, type => $type, ); my $dbh = DBI->connect(...); foreach my $sql ( generate( %opts ) ) { $dbh->do( $sql ); }
SQL::Tree generates the SQL for a herarchical data (tree) implementation using triggers, as described here:
http://www.depesz.com/index.php/2008/04/11/my-take-on-trees-in-sql/
A single subroutine is exported (on demand) that returns a list of SQL statements:
generate( %opts ) -> @str
See the sqltree documentation for the list of arguments and their meanings.
sqltree(1) - command line access to SQL::Tree
Mark Lawrence <nomad@null.net>
Copyright 2010 Mark Lawrence <nomad@null.net>
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 3 of the License, or (at your option) any later version.
To install SQL::Tree, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::Tree
CPAN shell
perl -MCPAN -e shell install SQL::Tree
For more information on module installation, please visit the detailed CPAN module installation guide.