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

NAME

SQL::Tree - Generate a trigger-based SQL tree implementation

SYNOPSIS

  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 );
  }

DESCRIPTION

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.

SEE ALSO

sqltree(1) - command line access to SQL::Tree

AUTHOR

Mark Lawrence <nomad@null.net>

COPYRIGHT AND LICENSE

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.