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 =
          ( 'DOY FROM TIMESTAMP '
             . $column->sql_or_alias( $sql->dbh() ) );

  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 ma


This module is a subclass of Fey::Literal.


This class provides the following methods:


This method creates a new Fey::Literal::Term object representing the term passed to the constructor.


Returns the term as passed to the constructor.




Returns the appropriate SQL snippet.


This class does the Fey::Role::Selectable, Fey::Role::Comparable, Fey::Role::Groupable, and Fey::Role::Orderable roles.

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, <>


See Fey for details on how to report bugs.


Copyright 2006-2008 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.