NAME

SQL::OOP::Array - An Abstract class for any combination of snippets

SYNOPSIS

my $array = SQL::OOP::Array->new(@elements);
my $sql  = $array->to_string;
my @bind = $array->bind;

DESCRIPTION

This is an abstract class which represents array of SQL snippets.

METHODS

This class inherits all methods from SQL::OOP::Base. Some of them is overridden.

SQL::OOP::Array->new(@elements)

Constructor. Since this class is an abstract, you may not have to call this directly.

SQL::OOP::Array->new('elem1', 'elem2', 'elem3'); # elem1 elem2 elem3

Arguments can be SQL::OOP::Base instances.

my $elem1 = SQL::OOP::Base->new('elem1');
my $elem2 = SQL::OOP::Base->new('elem2');
my $elem3 = SQL::OOP::Base->new('elem3');

SQL::OOP::Array->new($elem1, $elem2, $elem3); # elem1 elem2 elem3

$instance->append(@elements)

This method appends elements to the instance and returns $self. This method takes same arguments as new constructor.

$instance->set_sepa($string)

This sets separator string such as ' AND ', ' OR '.

$instance->bind;

This method corrects all children's bind values and returns all together.

$instance->generate;

This method generates SQL. This is called inside to_string so don't call it directly. This method internally corrects all children's to_string results and join them with separator.

$instance->values;

Retrieve values into array.

$instance->fix_element_in_list_context

This method is internally called by generate method to parenthesizes the SQL on list context.

SEE ALSO