Fey::Literal::Function - Represents a literal function in a SQL statement
my $function = Fey::Literal::Function->new( 'LENGTH', $column );
This class represents a literal function in a SQL statement, such as NOW() or LENGTH(User.username).
NOW()
LENGTH(User.username)
This module is a subclass of Fey::Literal.
Fey::Literal
This class provides the following methods:
This method creates a new Fey::Literal::Function object.
Fey::Literal::Function
It requires at least one argument, which is the name of the SQL function that this literal represents. It can accept any number of additional optional arguments. These arguments must be either scalars, literals, or columns which belong to a table.
Any scalars passed in as arguments will be passed in turn to Fey::Literal->new_from_scalar().
Fey::Literal->new_from_scalar()
Use this to explicitly set a function's alias name for use in SQL. If you don't set this it will be autogenerated as needed.
The function's name, as passed to the constructor.
Returns an array reference of the function's arguments, as passed to the constructor.
Returns the appropriate SQL snippet.
Calling $function->sql_with_alias() causes a unique alias for the function to be created.
$function->sql_with_alias()
This class does the Fey::Role::Selectable, Fey::Role::Comparable, Fey::Role::Groupable, and Fey::Role::Orderable roles.
Fey::Role::Selectable
Fey::Role::Comparable
Fey::Role::Groupable
Fey::Role::Orderable
This class overrides the is_groupable() and is_orderable() methods so that they only return true if the $function->sql_with_alias() has been called previously. This function is called when a function is used in the SELECT clause of a query. A function must be used in a SELECT in order to be used in a GROUP BY or ORDER BY clause.
is_groupable()
is_orderable()
SELECT
GROUP BY
ORDER BY
Dave Rolsky, <autarch@urth.org>
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.
To install Fey, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fey
CPAN shell
perl -MCPAN -e shell install Fey
For more information on module installation, please visit the detailed CPAN module installation guide.