sqltree - hierarchical data (tree) implementation in SQL
sqltree [DRIVER] [TABLE] [PK] [PARENT] [TYPE]
sqltree generates the SQL for a herarchical data (tree) implementation using triggers, as described here:
This implementation relies on a previously-defined table containing:
a single primary key column
a parent column that references the primary key
a column to hold path data [optional]
Several triggers are added to this previously-defined table, which update a new table holding in-depth tree information.
Output from sqltree can usually be piped directly to the "sqlite3" or "psql" command line tools.
All of these argument will be prompted for if they are not provided on the command line.
Must be 'SQLite' or 'Pg'. Patches for other database systems are welcome.
The name of the (existing) table holding the hierarchical data. The additional tree table will be called "table_tree".
The primary key column of the (existing) table holding the hierarchical data.
The parent column of the (existing) table holding the hierarchical data.
The SQL column type of the (existing) primary key and parent columns.
An existing column in TABLE into which the tree path will be automatically calculated. This column should be defined as TEXT or VARCHAR, and should be UNIQUE.
--pathis given to identify the existing column in TABLE from which path names will be built.
[NOT IMPLEMENTED] An existing column in TABLE containing the object ordering information.
Mark Lawrence <firstname.lastname@example.org>
Copyright (C) 2010,2013 Mark Lawrence <email@example.com>
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.