NAME

DB::Object::Mysql::Query - Query Object for MySQL

SYNOPSIS

use DB::Object::Mysql::Query;
my $this = DB::Object::Mysql::Query->new || die( DB::Object::Mysql::Query->error, "\n" );

VERSION

v0.3.8

DESCRIPTION

This is a MySQL specific query object.

METHODS

binded_having

Sets or gets the array object (Module::Generic::Array) for the binded value in HAVING clauses.

format_from_epoch

This takes the parameters bind and value and returns a formatted FROM_UNIXTIME expression.

format_to_epoch

This takes the parameters bind, value and quote and returns a formatted expression to returns the epoch value out of the given field: UNIX_TIMESTAMP

having

Calls "_where_having" in DB::Object::Query to build a having clause.

limit

Build a new DB::Object::Query::Clause clause object by calling "_process_limit" and return it.

replace

This method can take either 1 parameter which would then be a DB::Object::Statement object, or it can also be an hash reference of options.

It can alternatively take an hash of options.

If a statement was provided, it will be stringified calling "as_string" in DB::Object::Statement and used as a select query in the replace statement.

When preparing the replace query, this will be mindful to avoid fields that are null by default and not provided among the options.

If called in void context, this will execute the prepared statement immediately.

It returns the prepared statement handler (DB::Object::Statement).

reset

If the object property query_reset is not already set, this will remove the following properties from the current query object, set "enhance" in DB::Object::Query to true and return the query object.

Properties removed are: alias local binded binded_values binded_where binded_limit binded_group binded_having binded_order where limit group_by order_by reverse from_unixtime unix_timestamp sorted

reset_bind

Reset all the following object properties to an anonymous array: binded binded_where binded_group binded_having binded_order binded_limit

_query_components

This is called by the various query methods like "select" in DB::Object::Query, "insert" in DB::Object::Query, "update" in DB::Object::Query, "delete" in DB::Object::Query

It will get the various query components (group, having, sort, order, limit) that have been set and add them formatted to an array that is returned.

This version of "_query_components" exists here to provide MySQL specific implementation. See also the generic one in "_query_components" in DB::Object::Query

SEE ALSO

perl

AUTHOR

Jacques Deguest <jack@deguest.jp>

COPYRIGHT & LICENSE

Copyright (c) 2019-2021 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.