Sugama Keita > SQL-OOP-0.20 > SQL::OOP::Array

Download:
SQL-OOP-0.20.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source   Latest Release: SQL-OOP-0.21

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 ^

AUTHOR ^

Sugama Keita, <sugama@jamadam.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2011 by Sugama Keita.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: