Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sql::abstract::tree(3) [osx man page]

SQL::Abstract::Tree(3)					User Contributed Perl Documentation				    SQL::Abstract::Tree(3)

NAME
SQL::Abstract::Tree - Represent SQL as an AST SYNOPSIS
my $sqla_tree = SQL::Abstract::Tree->new({ profile => 'console' }); print $sqla_tree->format('SELECT * FROM foo WHERE foo.a > 2'); # SELECT * # FROM foo # WHERE foo.a > 2 METHODS
new my $sqla_tree = SQL::Abstract::Tree->new({ profile => 'console' }); $args = { profile => 'console', # predefined profile to use (default: 'none') fill_in_placeholders => 1, # true for placeholder population placeholder_surround => # The strings that will be wrapped around [GREEN, RESET], # populated placeholders if the above is set indent_string => ' ', # the string used when indenting indent_amount => 2, # how many of above string to use for a single # indent level newline => " ", # string for newline colormap => { select => [RED, RESET], # a pair of strings defining what to surround # the keyword with for colorization # ... }, indentmap => { select => 0, # A zero means that the keyword will start on # a new line from => 1, # Any other positive integer means that after on => 2, # said newline it will get that many indents # ... }, } Returns a new SQL::Abstract::Tree object. All arguments are optional. profiles There are four predefined profiles, "none", "console", "console_monochrome", and "html". Typically a user will probably just use "console" or "console_monochrome", but if something about a profile bothers you, merely use the profile and override the parts that you don't like. format $sqlat->format('SELECT * FROM bar WHERE x = ?', [1]) Takes $sql and "@bindargs". Returns a formatting string based on the string passed in parse $sqlat->parse('SELECT * FROM bar WHERE x = ?') Returns a "tree" representing passed in SQL. Please do not depend on the structure of the returned tree. It may be stable at some point, but not yet. unparse $sqlat->unparse($tree_structure, @bindargs) Transform "tree" into SQL, applying various transforms on the way. format_keyword $sqlat->format_keyword('SELECT') Currently this just takes a keyword and puts the "colormap" stuff around it. Later on it may do more and allow for coderef based transforms. pad_keyword my ($before, $after) = @{$sqlat->pad_keyword('SELECT')}; Returns whitespace to be inserted around a keyword. fill_in_placeholder my $value = $sqlat->fill_in_placeholder(@bindargs) Removes last arg from passed arrayref and returns it, surrounded with the values in placeholder_surround, and then surrounded with single quotes. indent Returns as many indent strings as indent amounts times the first argument. ACCESSORS
colormap See "new" fill_in_placeholders See "new" indent_amount See "new" indent_string See "new" indentmap See "new" newline See "new" placeholder_surround See "new" perl v5.16.2 2012-06-14 SQL::Abstract::Tree(3)

Check Out this Related Man Page

DBIx::Class::SQLMaker(3pm)				User Contributed Perl Documentation				DBIx::Class::SQLMaker(3pm)

NAME
DBIx::Class::SQLMaker - An SQL::Abstract-based SQL maker class DESCRIPTION
This module is a subclass of SQL::Abstract and includes a number of DBIC-specific workarounds, not yet suitable for inclusion into the SQL::Abstract core. It also provides all (and more than) the functionality of SQL::Abstract::Limit, see DBIx::Class::SQLMaker::LimitDialects for more info. Currently the enhancements to SQL::Abstract are: o Support for "JOIN" statements (via extended "table/from" support) o Support of functions in "SELECT" lists o "GROUP BY"/"HAVING" support (via extensions to the order_by parameter) o Support of "...FOR UPDATE" type of select statement modifiers o The "-ident" operator o The "-value" operator OPERATORS
-ident Used to explicitly specify an SQL identifier. Takes a plain string as value which is then invariably treated as a column name (and is being properly quoted if quoting has been requested). Most useful for comparison of two columns: my %where = ( priority => { '<', 2 }, requestor => { -ident => 'submitter' } ); which results in: $stmt = 'WHERE "priority" < ? AND "requestor" = "submitter"'; @bind = ('2'); -value The -value operator signals that the argument to the right is a raw bind value. It will be passed straight to DBI, without invoking any of the SQL::Abstract condition-parsing logic. This allows you to, for example, pass an array as a column value for databases that support array datatypes, e.g.: my %where = ( array => { -value => [1, 2, 3] } ); which results in: $stmt = 'WHERE array = ?'; @bind = ([1, 2, 3]); AUTHORS
See "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.14.2 2011-11-29 DBIx::Class::SQLMaker(3pm)
Man Page