Fry::Lib::CDBI::Outline - A Class::DBI library for Fry::Shell which displays several database queries in an outline format.
This document describes version 0.14
This module has one command, outlineSearches, which takes a query outline and produces results in the same outline format. To write an outline in one line for commandline apps, there is a shorthand syntax. Take the sample outline:
0 dog 1 rex 1 cartoon 2 snoopy 2 brian 0 cat Note: the numbers are the outline levels and aren't usually seen
In shorthand syntax this is 'dog(rex,cartoon(snoopy,brian))cat'. I'll use node to refer to a line in an outline ie 'dog'. There are three characters that delimit indent levels between nodes:
'(':following node is indented one level ')': following node is unindented one level ',': following node remains at same level
Each node is a query chunk which uses the same syntax as the search commands in Fry::Lib::CDBI::Basic.
For example, here's a simple query outline:
which means the following query outline:
tags=perl tags=dbi read name=Shell::
which would produce:
tags=perl tags=dbi #results of tags=dbi and tags=perl read #results of tags=read and tags=perl name=Shell:: #results of name=Shell:
The resulting outline produces results under the last level children. By default the query chunks ('tags=perl') are ANDed. If no $splitter ('=' here) is in a given query chunk then a default column name is assumed by $otlcol. In this example, $otlcol = 'tags' for the 'read' node.
Although there is no required table format I usually use this module for tables that I'm tagging. See Fry::Lib::CDBI::Tags for more detail.
right_indent: Increases outline level by one. no_indent: Outline level remains the same. left_indent: Decreases outline level by one. otlcol: column assumed in searches when no column given indent_char: Character used to indent nodes
The subroutines are indented by subroutine frame and are called in the order they appear.
outlineSearches create_outline get_outline input_to_nodes get_indents get_values set_results alias_otl search_outline makeNodeOutline print_indented_rows outlineSearches(@outline_terms): command which returns outline of search results, an $outline_term is equal to $search_term$level_delimiter where $search_term is the same as in Fry::Lib::CDBI::Basic and a $level_delimiter is one of the variables $indent,$no_indent or $left_indent create_outline(@outline_terms): wrapper sub get_outline(@outline_terms): Returns an arrayref of node objects. A node object contains the following attributes: value: search term used by search functions results: Class::DBI objects from search indent: indent/outline level input_to_nodes(@outline_terms): splits input on a $level_delimiter to return array of nodes get_indents(@input_to_nodes): returns an indent value for each node based on a $level_delimiter get_values(@get_indents): returns a value for each node set_results(\@node): sets results attribute of a node object alias_otl(@search_terms): unaliases outline search terms to make it compatible with :CDBI::Basic search terms search_outline(@search_terms): does a search using one of the search functions from :CDBI::Basic makeNodeOutline(@node): makes a node outline by indenting properly and displaying Class::DBI search results
Me. Gabriel that is. If you want to bug me with a bug: email@example.com If you like using perl,linux,vim and databases to make your life easier (not lazier ;) check out my website at www.chwhat.com.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.