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

NAME

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

SYNOPSIS

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

VERSION

   v0.300.1

DESCRIPTION

This is a MySQL specific statement object.

METHODS

distinct

This takes no argument and this will modify the query to add the keyword DISTINCT

    $sth->distinct;
    # produces SELECT DISTINCT....
    $sth->distinct( 'name' );
    # produces SELECT DISTINCT ON (name)....

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

It returns the newly created statement handler.

See MySQL documentation for more information

dump

This will dump the result of the query to STDOUT or to a file if file argument is provided, or if a filehandle is provided with fh, it will be used to print out the data.

It takes also a vsep, which defaults to a command and a hsep which defaults to a new line.

It returns the current object.

ignore

This takes no argument and this will modify the queries of type alter, insert, update to add the keyword IGNORE

    $sth->ignore;
    # produces INSERT IGNORE....

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

It returns the newly created statement handler.

See MySQL documentation for more information

only

This returns an error as SELECT FROM ONLY is not supported by MySQL.

priority

Provided with a priority integer that can be 0 or 1 with 0 being LOW_PRIORITY and 1 being HIGH_PRIORITY and this will adjust the query formatted to add the priority. This works only on Mysql drive though.

If used on queries other than DELETE, INSERT, REPLACE, SELECT, UPDATE an error will be returned.

If called in void context, this will execute the newly create statement handler immediately.

It returns the newly create statement handler.

wait

    $sth->wait || die( $sth->error );

This takes no parameter and only works on queries of type INSERT or UPDATE. It will modify the previously prepared query to add the keyword DELAYED

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

It returns the newly created statement handler.

See MySQL documentation for more information

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.