DB::Object::Query::Elements - Query Elements Manipulation Class
use DB::Object::Query::Elements; my $elems = DB::Object::Query::Elements->new( debug => 4 ) || die( DB::Object::Query::Elements->error, "\n" ); $elems->push( $new_element ); $elems->push({ field => $some_field_name, value => $some_field_value, type => $sql_type, format => $insert_formatting, # Could also be $1, $2, ?1, ?2, or other variants supported by driver placeholder => '?', }); $elems->merge( $other_elements_object ); # Clause class inherits from Elements class $elems->merge( $some_clause_object );
v0.1.0
This class represent a query manipulation class designed to access, store and retrieve query elements
Elements are stored in an internal array object accessible with "elements", and all the other methods are used to access or manipulate those elements data.
Takes an hash or hash reference of key-value pairs matching any of the methods below.
Returns a newly instantiated object upon success, or sets an error and return undef or an empty list, depending on the caller's context.
undef
Sets or gets an array object of DB::Object::Query::Element objects.
Read-only. Returns an array object of all the elements field property.
This is a shortcut for calling "for" in Module::Generic::Array on this class "elements"
This is a shortcut for calling "foreach" in Module::Generic::Array on this class "elements"
Read-only. Returns an array object of all the elements format property.
Read-only. Returns an array object of all the elements generic representation.
This is a shortcut for calling "is_empty" in Module::Generic::Array on this class "elements"
This is a shortcut for calling "length" in Module::Generic::Array on this class "elements"
Provided with one or more DB::Object::Query::Elements objects (including DB::Object::Query::Clause objects that inherit from DB::Object::Query::Elements), and this will merge those objects into this current object.
If the underlying elements are numbered placeholders such as $1, $2, or ?1, ?2, then they will be properly sorted internally.
$1
$2
?1
?2
It returns the current object.
Provided with an hash or hash reference of parameter, and this will instantiate a new DB::Object::Query::Element object and return it.
If an error occurred, such as if bad parameters were provided, an error object is set and undef, or an empty list depending on the context, is returned.
Provided with objects of classes DB::Object::Query::Elements or DB::Object::Query::Element, or alternatively an hash reference of property-value pairs needed to instantiate a new DB::Object::Query::Element, and this will add those objects to the stack of elements managed by this class.
Sets or gets the DB::Object::Query object set for this object.
Various methods return cached value once they have been computed for improved performance. Calling reset will force re-computing next time either one is called.
reset
Those methods are "fields", "formats", "types" and "values"
Returns a new clone of the current DB::Object::Query::Elements object with its elements sorted based on their index property
Read-only. Returns an array object of all the elements type property.
Read-only. Returns an array object of all the elements value property.
Jacques Deguest <jack@deguest.jp>
DB::Object::Query, DB::Object::Query::Clause, DB::Object::Query::Element, DB::Object
Copyright(c) 2023 DEGUEST Pte. Ltd.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DB::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DB::Object
CPAN shell
perl -MCPAN -e shell install DB::Object
For more information on module installation, please visit the detailed CPAN module installation guide.