Second pass at adding key files
This commit is contained in:
422
site/glist/templates/help/GT/SQL/Tree/Rebuild.html
Normal file
422
site/glist/templates/help/GT/SQL/Tree/Rebuild.html
Normal file
@ -0,0 +1,422 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>GT::SQL::Tree::Rebuild - Helps to turn a table into one usable by GT::SQL::Tree.</title>
|
||||
<link rev="made" href="mailto:root@penguin.office.gossamer-threads.com" />
|
||||
|
||||
<style type="text/css">
|
||||
/* $MVD$:fontset("Untitled Font Set 1","ARIEL","HELVETICA","HELV","SANSERIF") */
|
||||
/* $MVD$:fontset("Arial","Arial") */
|
||||
/* $MVD$:fontset("Arial Black","Arial Black") */
|
||||
/* $MVD$:fontset("Algerian","Algerian") */
|
||||
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
font-family: Verdana, Arial, sans-serif;
|
||||
font-size: small;
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
p {
|
||||
background-color : white;
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
h1 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : bold;
|
||||
font-size : medium;
|
||||
background-color : white;
|
||||
color : maroon;
|
||||
}
|
||||
|
||||
|
||||
h2 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : medium;
|
||||
font-weight : bold;
|
||||
color : blue;
|
||||
background-color : white;
|
||||
}
|
||||
|
||||
|
||||
h3 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : bold;
|
||||
font-size : medium;
|
||||
color : black;
|
||||
background-color : white;
|
||||
}
|
||||
|
||||
|
||||
h4 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : bold;
|
||||
font-size : small;
|
||||
color : maroon;
|
||||
background-color : white;
|
||||
}
|
||||
|
||||
|
||||
h5 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : bold;
|
||||
font-size : small;
|
||||
color : blue;
|
||||
background-color : white;
|
||||
}
|
||||
|
||||
|
||||
h6 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : bold;
|
||||
font-size : small;
|
||||
color : black;
|
||||
background-color : white;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
ol {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
dl {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
li {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
th {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
td {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
dl {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
dd {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
dt {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
code {
|
||||
font-family : Courier;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
|
||||
pre {
|
||||
font-family : Courier;
|
||||
font-size : small;
|
||||
color : black;
|
||||
}
|
||||
|
||||
.mvd-H1 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : bold;
|
||||
font-size : 14.0pt;
|
||||
background-color : transparent;
|
||||
background-image : none;
|
||||
color : maroon;
|
||||
}
|
||||
|
||||
|
||||
.mvd-H2 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : 12.0pt;
|
||||
color : blue;
|
||||
}
|
||||
|
||||
|
||||
p.indent {
|
||||
font-family : "Verdana, Arial, sans-serif";
|
||||
list-style-type : circle;
|
||||
list-style-position : inside;
|
||||
color : black;
|
||||
margin-left : 16.0pt;
|
||||
}
|
||||
|
||||
|
||||
.mvd-P-indent {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
list-style-type : circle;
|
||||
list-style-position : inside;
|
||||
color : black;
|
||||
margin-left : 16.0pt;
|
||||
}
|
||||
|
||||
|
||||
pre.programlisting {
|
||||
font-size : 9.0pt;
|
||||
list-style-type : disc;
|
||||
margin-left : 16.0pt;
|
||||
margin-top : -14.0pt;
|
||||
}
|
||||
|
||||
|
||||
.mvd-PRE-programlisting {
|
||||
font-size : 9.0pt;
|
||||
list-style-type : disc;
|
||||
margin-left : 16.0pt;
|
||||
margin-top : -14.0pt;
|
||||
}
|
||||
|
||||
|
||||
.mvd-PRE {
|
||||
font-size : 9.0pt;
|
||||
}
|
||||
|
||||
|
||||
p.note {
|
||||
margin-left : 28.0pt;
|
||||
}
|
||||
|
||||
|
||||
.mvd-P-note {
|
||||
margin-left : 28.0pt;
|
||||
}
|
||||
|
||||
|
||||
.mvd-H4 {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-weight : normal;
|
||||
font-size : 9.0pt;
|
||||
color : black;
|
||||
margin-left : 6.0pt;
|
||||
margin-top : -14.0pt;
|
||||
}
|
||||
|
||||
|
||||
.mvd-P {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
font-size : 10.0pt;
|
||||
color : black;
|
||||
}
|
||||
|
||||
.mvd-BODY {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
background-color : white;
|
||||
}
|
||||
|
||||
|
||||
p.indentnobullet {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
list-style-type : none;
|
||||
}
|
||||
|
||||
|
||||
.mvd-P-indentnobullet {
|
||||
font-family : Verdana, Arial, sans-serif;
|
||||
list-style-type : none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body style="background-color: white">
|
||||
|
||||
<p><a name="__index__"></a></p>
|
||||
<!-- INDEX BEGIN -->
|
||||
|
||||
<ul>
|
||||
|
||||
<li><a href="#name">NAME</a></li>
|
||||
<li><a href="#synopsis">SYNOPSIS</a></li>
|
||||
<li><a href="#description">DESCRIPTION</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#new__create_a_rebuild_object">new - Create a Rebuild object</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#copyright">COPYRIGHT</a></li>
|
||||
<li><a href="#version">VERSION</a></li>
|
||||
</ul>
|
||||
<!-- INDEX END -->
|
||||
|
||||
<hr />
|
||||
<p>
|
||||
</p>
|
||||
<h1><a name="name">NAME</a></h1>
|
||||
<p>GT::SQL::Tree::Rebuild - Helps to turn a table into one usable by GT::SQL::Tree.</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
||||
<pre>
|
||||
use GT::SQL::Tree;
|
||||
use GT::SQL::Tree::Rebuild;</pre>
|
||||
<pre>
|
||||
my $rebuild = GT::SQL::Tree::Rebuild->new(
|
||||
table => $DB->table('MyTable'),
|
||||
missing_root => \&root_code,
|
||||
missing_father => \&father_code,
|
||||
missing_depth => \&depth_code,
|
||||
order_by => 'column_name'
|
||||
);</pre>
|
||||
<pre>
|
||||
$DB->editor('MyTable')->add_tree(root => $root_col, father => $father_col, depth => $depth_col, rebuild => $rebuild);</pre>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="description">DESCRIPTION</a></h1>
|
||||
<p>GT::SQL::Tree::Rebuild is designed to go hand-in-hand with GT::SQL::Tree and
|
||||
aids in turning an existing table into one with the neccessary root, father and
|
||||
depth columns needed by GT::SQL::Tree.</p>
|
||||
<p>The main purpose is to do a one-shot conversion of a table to make it compatible
|
||||
with GT::SQL::Tree.</p>
|
||||
<p>
|
||||
</p>
|
||||
<h2><a name="new__create_a_rebuild_object">new - Create a Rebuild object</a></h2>
|
||||
<p>There is only one method that is called - new. You pass the arguments needed
|
||||
and get back a GT::SQL::Tree::Rebuild object. This object should then be passed
|
||||
into GT::SQL::Tree->create (typically via <code>$editor->add_tree()</code>)</p>
|
||||
<p><code>new()</code> takes a hash with up to 4 argument pairs: ``table'' (required), and one or
|
||||
more of ``missing_root'', ``missing_father'', or ``missing_depth''. The values are
|
||||
explained below.</p>
|
||||
<dl>
|
||||
<dt><strong><a name="item_table">table</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
Required. You specify the table object for the table to rebuild. For example, if
|
||||
you are going to add a tree to the ``Category'' table, you provide the ``Category''
|
||||
table object here.
|
||||
</dd>
|
||||
<p></p>
|
||||
<dt><strong><a name="item_cols">cols</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
By default, an entire row will be returned. To speed up the process and lower
|
||||
the memory usage, you can use the <a href="#item_cols"><code>cols</code></a> option, which specifies the columns to
|
||||
select for $row. It is recommended that you only select columns that you need as
|
||||
doing so will definately save time and memory.
|
||||
</dd>
|
||||
<p></p>
|
||||
<dt><strong><a name="item_missing_father_2c_missing_root_2c_missing_depth">missing_father, missing_root, missing_depth</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
Each of these arguments takes a code reference as its value. The arguments to
|
||||
the code references are as follows:
|
||||
</dd>
|
||||
<dl>
|
||||
<dt><strong><a name="item__24row">$row</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
The first argument is a hash reference of the row being examined. Your job, in
|
||||
the code reference, is to examine $row and determine the missing value,
|
||||
depending on which code reference is being called. missing_root needs to return
|
||||
the root_id for this row; missing_father needs to return the father_id, and the
|
||||
missing_depth code reference should return the depth for the row.
|
||||
</dd>
|
||||
<p></p>
|
||||
<dt><strong><a name="item__24table">$table</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
The second argument passed to the code references is the same table object that
|
||||
you pass into new(), which you can select from if neccessary.
|
||||
</dd>
|
||||
<p></p></dl>
|
||||
<dt><strong><a name="item_missing_father">missing_father</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
The <a href="#item_missing_father"><code>missing_father</code></a> code reference is called first - before <a href="#item_missing_root"><code>missing_root</code></a>
|
||||
and <a href="#item_missing_depth"><code>missing_depth</code></a>. The code reference is called as described above and should
|
||||
return the ID of the father of the row passed in. A false return (0 or undef) is
|
||||
interpreted as meaning that this is a root and therefore has no father.
|
||||
</dd>
|
||||
<p></p>
|
||||
<dt><strong><a name="item_missing_root">missing_root</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
<a href="#item_missing_root"><code>missing_root</code></a> has to return the root of the row passed in. This is called
|
||||
after <a href="#item_missing_father"><code>missing_father</code></a>, so the $row will contain whatever you returned in
|
||||
<a href="#item_missing_father"><code>missing_father</code></a> in the father ID column. Of course, this only applies if using
|
||||
both <a href="#item_missing_root"><code>missing_root</code></a> and <a href="#item_missing_father"><code>missing_father</code></a>.
|
||||
</dd>
|
||||
<p></p>
|
||||
<dt><strong><a name="item_missing_depth">missing_depth</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
<a href="#item_missing_depth"><code>missing_depth</code></a> has to return the depth of the row passed in. This is called
|
||||
last, so if you are also using <a href="#item_missing_father"><code>missing_father</code></a> and/or <a href="#item_missing_root"><code>missing_root</code></a>, you
|
||||
will have whatever was returned by those code refs available in the $row.
|
||||
</dd>
|
||||
<p></p>
|
||||
<dt><strong><a name="item_order_by">order_by</a></strong><br />
|
||||
</dt>
|
||||
<dd>
|
||||
The query done to retrieve records can be sorted using the <a href="#item_order_by"><code>order_by</code></a> option.
|
||||
It should be anything valid for ``ORDER BY _____''. Often it can be useful to have
|
||||
your results returned in a certain order - for example:
|
||||
order_by => 'depth_column ASC'
|
||||
would insure that parents come before roots. Of course, this example wouldn't
|
||||
work if you are using ``missing_depth'' since none of the depth values will be
|
||||
set.
|
||||
</dd>
|
||||
<p></p></dl>
|
||||
<p>Once you have a GT::SQL::Tree::Rebuild object, you should pass it into
|
||||
<code>GT::SQL::Tree->create</code> (which typically involves passing it into
|
||||
<code>$editor->add_tree()</code>, which passed it through). Before calculating the
|
||||
tree, GT::SQL::Tree will call on the rebuild object to reproduce the father,
|
||||
root, and/or depth columns (whichever you specified).</p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="copyright">COPYRIGHT</a></h1>
|
||||
<p>Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved.
|
||||
<a href="http://www.gossamer-threads.com/">http://www.gossamer-threads.com/</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<hr />
|
||||
<h1><a name="version">VERSION</a></h1>
|
||||
<p>Revision: $Id: Rebuild.pm,v 1.10 2005/04/06 23:11:08 jagerman Exp $</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user