-
-
16 Jun 2015 03:55:50 UTC
- Distribution: Fey
- Module version: 0.43
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (6)
- Testers (893 / 4 / 0)
- Kwalitee
Bus factor: 1- 97.59% Coverage
- License: artistic_2
- Activity
24 month- Tools
- Download (88.18KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 5 contributors-
Aristotle Pagaltzis
-
hdp@glaive.weftsoar.net
-
hdp@localhost
-
hdp@rook.opensourcery.com
-
Oliver Charles
- Dependencies
- Carp
- Exception::Class
- Exporter
- List::AllUtils
- Moose
- Moose::Role
- Moose::Util::TypeConstraints
- MooseX::Params::Validate
- MooseX::Role::Parameterized
- MooseX::SemiAffordanceAccessor
- MooseX::StrictConstructor
- MooseX::Types
- MooseX::Types::Combine
- MooseX::Types::Moose
- Scalar::Util
- Task::Weaken
- Tie::IxHash
- base
- namespace::autoclean
- overload
- strict
- warnings
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Take me over?
The maintainer of this distribution is looking for someone to take over! If you're interested then please contact them via email.- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- INHERITANCE
- METHODS
- DETAILS OF SQL GENERATION
- ROLES
- BUGS
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
Fey::Literal::Term - Represents a literal term in a SQL statement
VERSION
version 0.43
SYNOPSIS
my $term = Fey::Literal::Term->new(@anything)
DESCRIPTION
This class represents a literal term in a SQL statement. A "term" in this module means a literal SQL snippet that will be used verbatim, without quoting.
This allows you to create SQL for almost any expression, for example
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.
INHERITANCE
This module is a subclass of
Fey::Literal
.METHODS
This class provides the following methods:
Fey::Literal::Term->new(@fragments)
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).$term->term()
Returns the array reference of fragments passed to the constructor.
$term->can_have_alias()
$term->set_can_have_alias()
If this attribute is explicitly set to a false value, then then the SQL-generating methods below will never include an alias.
$term->id()
The id for a term is uniquely identifies the term.
$term->sql()
$term->sql_with_alias()
$term->sql_or_alias()
Returns the appropriate SQL snippet. If the term contains any Fey objects, their
sql_or_alias()
method is called to generate their part of the term.DETAILS OF SQL GENERATION
A term generates SQL by taking each of the elements passed to its constructor and concatenating them. If the element is an object with a
sql_or_alias()
method, that method will be called to generate SQL. Otherwise, the element is just used as-is.If
$term->can_have_alias()
is false, then calling any of the three SQL-generating methods is always equivalent to calling$term->sql()
.ROLES
This class does the
Fey::Role::Selectable
,Fey::Role::Comparable
,Fey::Role::Groupable
, andFey::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.
BUGS
See Fey for details on how to report bugs.
AUTHOR
Dave Rolsky <autarch@urth.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 - 2015 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
Module Install Instructions
To install Fey, copy and paste the appropriate command in to your terminal.
cpanm Fey
perl -MCPAN -e shell install Fey
For more information on module installation, please visit the detailed CPAN module installation guide.