- COPYRIGHT & LICENSE
Fey::Literal::Term - Represents a literal term in a SQL statement
my $term = Fey::Literal::Term->new(@anything)
This class represents a literal term in a SQL statement. A "term" in this module means a literal term that will be used verbatim, without quoting.
This allows you to create SQL for almost any expression, so that you can something like this
EXTRACT( DOY FROM TIMESTAMP User.creation_date ), which is a valid Postgres expression. This would be created like this:
my $term = Fey::Literal::Term->new ( 'DOY FROM TIMESTAMP ', $column ); my $function = Fey::Literal::Function->new( 'EXTRACT', $term );
This ability to insert arbitrary strings into a SQL statement is meant to be used as a back-door to support any sort of SQL snippet not otherwise supported by the core Fey classes in a more direct manner.
This module is a subclass of
This class provides the following methods:
This method creates a new
Fey::Literal::Term object representing the term passed to the constructor.
More than one argument may be given; they will all be joined together in the generated SQL. For example:
my $term = Fey::Literal::Term->new( $column, '::text' );
The arguments can be plain scalars, objects with a
sql_or_alias() method (columns, tables, etc.) or any object which is overloaded (the assumption being it that it overloads stringification).
Returns the array reference of fragments passed to the constructor.
Returns the appropriate SQL snippet. Any Fey objects in the
term() will have
sql() called on them to generate their part of the term.
This class does the
Of course, the contents of a given term may not really allow for any of these things, but having this class do these roles means you can freely use a term object in any part of a SQL snippet.
Dave Rolsky, <firstname.lastname@example.org>
See Fey for details on how to report bugs.
Copyright 2006-2009 Dave Rolsky, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.