MPMinus
view release on metacpan or search on metacpan
lib/MPMinus/Store/MySQL.pm view on Meta::CPAN
package MPMinus::Store::MySQL; # $Id: MySQL.pm 266 2019-04-26 15:56:05Z minus $
use strict;
use utf8;
=encoding utf-8
=head1 NAME
MPMinus::Store::MySQL - MySQL MPMinus::Store::DBI interface
=head1 VERSION
Version 1.42
=head1 SYNOPSIS
use MPMinus::Store::MySQL;
# MySQL connect
my $mysql = new MPMinus::Store::MySQL (
-host => '192.168.1.1',
-database => 'TEST',
-user => 'login',
-pass => 'password',
-attr => {
mysql_enable_utf8 => 1,
RaiseError => 0,
PrintError => 0,
},
);
my $dbh = $mysql->connect;
my $pingstat = $mysql->ping if $mysql;
# Table select (as array)
my @result = $mysql->table($sql, @inargs);
# Table select (as hash)
my %result = $mysql->tableh($key, $sql, @inargs); # $key - primary index field name
# Record (as array)
my @result = $mysql->record($sql, @inargs);
# Record (as hash)
my %result = $mysql->recordh($sql, @inargs);
# Fiels (as scalar)
my $result = $mysql->field($sql, @inargs);
# SQL/PL-SQL
my $sth = $mysql->execute($sql, @inargs);
...
$sth->finish;
=head1 DESCRIPTION
MySQL MPMinus::Store::DBI interface
See L<MPMinus::Store::DBI>
=head2 new
See L<MPMinus::Store::DBI>
=head1 EXAMPLE
use MPMinus::Store::MySQL;
my $mysql = new MPMinus::Store::MySQL (
-host => '192.168.1.1',
-name => 'mylocaldb',
-user => 'root',
-password => 'password',
);
my @table = $mysql->table("select * from tablename where date = ?", "01.01.2000")
=head1 HISTORY
=over 8
=item B<1.00 / 11.04.2007>
Init version
( run in 0.426 second using v1.01-cache-2.11-cpan-39bf76dae61 )