Fey::Literal::String - Represents a literal string in a SQL statement


Fey documentation Contained in the Fey distribution.

Index


Code Index:

NAME

Top

Fey::Literal::String - Represents a literal string in a SQL statement

VERSION

Top

version 0.40

SYNOPSIS

Top

  my $string = Fey::Literal::String->new($string)

DESCRIPTION

Top

This class represents a literal string in a SQL statement.

INHERITANCE

Top

This module is a subclass of Fey::Literal.

METHODS

Top

This class provides the following methods:

Fey::Literal::String->new($string)

This method creates a new Fey::Literal::String object representing the string passed to the constructor.

$string->string()

Returns the string as passed to the constructor.

$string->id()

The id for a string is always just the string itself.

$string->sql()

$string->sql_with_alias()

$string->sql_or_alias()

Returns the appropriate SQL snippet.

ROLES

Top

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

BUGS

Top

See Fey for details on how to report bugs.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


Fey documentation Contained in the Fey distribution.

package Fey::Literal::String;
BEGIN {
  $Fey::Literal::String::VERSION = '0.40';
}

use strict;
use warnings;
use namespace::autoclean;

use Fey::Types qw( Str );

use Moose;
use MooseX::SemiAffordanceAccessor;
use MooseX::StrictConstructor;

with 'Fey::Role::Comparable', 'Fey::Role::Selectable', 'Fey::Role::IsLiteral';

has 'string' => (
    is       => 'ro',
    isa      => Str,
    required => 1,
);

sub BUILDARGS {
    my $class = shift;

    return { string => shift };
}

sub sql { $_[1]->quote( $_[0]->string() ) }

sub sql_with_alias { goto &sql }

sub sql_or_alias { goto &sql }

__PACKAGE__->meta()->make_immutable();

1;

# ABSTRACT: Represents a literal string in a SQL statement




__END__