The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SQL::OOP::IDArray - ID arrays for SQL

SYNOPSIS

    ### field
    my $field = SQL::OOP::ID->new(@path_to_field);
    $field->to_string # e.g. "tbl"."col"
    
    ### from
    my $from = SQL::OOP::ID->new(@path_to_table);
    $from->to_string # e.g. "schema"."tbl"
    
    ### IDArray
    my $fields = SQL::OOP::IDArray->new($field1, $field2);
    $fields->to_string # e.g. "schema"."tbl1", "schema"."tbl2"

DESCRIPTION

This module provides a class SQL::OOP::IDArray which represents ID array.

METHODS

This class represents ID arrays such as field lists in SELECT or table lists in FROM clause. This class inherits SQL::OOP::Array class.

SQL::OOP::IDArray->new(@ids)

    my $id_list = SQL::OOP::IDArray->new('tbl1', 'tbl2', 'tbl3');
    
    $id_list->to_string; # "tbl1", "tbl2", "tbl3"    

SQL::OOP::IDArray->new(@id_objects)

Here is some examples.

    my $id_obj1 = SQL::OOP::ID->new('public', 'tbl1');
    my $id_obj2 = SQL::OOP::ID->new('public', 'tbl2');
    my $id_obj3 = SQL::OOP::ID->new('public', 'tbl3');
    
    my $id_list = SQL::OOP::IDArray->new($id_obj1, $id_obj2, $id_obj3);
    
    $id_list->to_string; # "public"."tbl1", "public"."tbl2", "public"."tbl3"

$instance->append

Appends elements into existing 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.