Skip to content

Commit

Permalink
add: pod comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ken39arg committed Mar 31, 2012
1 parent 0498147 commit e0bc10f
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 2 deletions.
24 changes: 22 additions & 2 deletions bin/shard_prompt
Expand Up @@ -40,8 +40,28 @@ shard_prompt - database management prompt for sharded databases.
$ shard_prompt --config=<path/to/config.yaml>
$ shard_prompt --help
Options:
--config -c <file> : databases configfile
=head2 Options:
--config -c <file> : databases configfile. (default : ${HOME}/.sharding_prompt.yml).
--help -h : show this manual
=head2 Config file example
connect_infos:
name1:
dsn: DBI:mysql:database=dbname1;host=localhost;
name2:
dsn: DBI:mysql:database=dbname2;host=localhost;
user: username
password: password
options:
RaiseError: 1
name3:
dsn: DBI:mysql:database=dbname3;host=localhost;
user: root
password: ''
85 changes: 85 additions & 0 deletions lib/MySQL/Sharding/Client.pm
Expand Up @@ -266,3 +266,88 @@ sub _parse_set {
}

1;
__END__
=head1 NAME
MySQL::Sharding::Client - Perl extention to do can be use as one DBI handle to many DBI handles.
=head1 VERSION
This document describes MySQL::Sharding::Client version 0.0.1.
=head1 SYNOPSIS
use MySQL::Sharding::Client;
# connect any dsn
my $dbh = MySQL::Sharding::Client->connect(
connect_infos => {
shard01 => {
dsn => $shard01_dsn,
user => $shard01_user,
password => $shard01_password,
options => $shard01_dboption,
},
shard02 => {
dsn => $shard02_dsn,
},
},
user => $default_user,
password => $default_pass,
);
# ping to all dbhs.
die "connect fail" unless $dbh->ping;
# do statement
# usable SQL command is only `SELECT` or `SET`.
my $sth = $dbh->do( $statement );
# prepare and execute
$sth = $dbh->prepare( $statement );
$sth->execute;
$sth->execute( @bind_value );
$rv = $sth->rows;
@row_ary = $sth->fetchrow_array;
%row_hash = $sth->fetchrow_hash;
$ary_ref = $sth->fetchrow_arrayref;
$hash_ref = $sth->fetchrow_hashref;
$sth->disconnect;
=head1 DESCRIPTION
This module is to do can be use as one DBI handle to many DBI handles.
DML is supported in this module is only SELECT.
And support some analyzed command COUNT, SUM, MAX, MIN.
=head1 DEPENDENCIES
Perl 5.8.1 or later.
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
=head1 SEE ALSO
L<perl>
=head1 AUTHOR
Kensaku Araga E<lt>ken39arg {at} gmail.com<gt>
=head1 LICENSE AND COPYRIGHT
Copyright (c) 2012, Kensaku Araga. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
60 changes: 60 additions & 0 deletions lib/MySQL/Sharding/Client/Prompt.pm
Expand Up @@ -122,3 +122,63 @@ sub __print_row {
}

1;
__END__
=head1 NAME
MySQL::Sharding::Client::Prompt - perl module to do use MySQL::Sharding::Client by prompt.
=head1 VERSION
This document describes MySQL::Sharding::Client::Prompt version 0.0.1.
=head1 SYNOPSIS
use MySQL::Sharding::Client::Prompt;
# create by MySQL::Sharding::Client connect options
$prompt = MySQL::Sharding::Client::Prompt->new(
%handler_options,
);
# create by yaml file.
$prompt = MySQL::Sharding::Client::Prompt->new(
yaml => 'path/to/connect_infos.yaml',
);
$prompt->run;
$prompt->run(
title => 'shard01 and shard01',
prompt => 'pronpt> ',
);
=head1 DESCRIPTION
this module used by sharding_prompt
=head1 DEPENDENCIES
Perl 5.8.1 or later.
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
=head1 SEE ALSO
L<perl>
=head1 AUTHOR
Kensaku Araga E<lt>ken39arg {at} gmail.com<gt>
=head1 LICENSE AND COPYRIGHT
Copyright (c) 2012, Kensaku Araga. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
70 changes: 70 additions & 0 deletions lib/MySQL/Sharding/Client/ResultSet.pm
Expand Up @@ -299,3 +299,73 @@ sub _merge_row {
}

1;
__END__
=head1 NAME
MySQL::Sharding::Client::ResultSet - perl module to used by MySQL::Sharding::Client.
=head1 VERSION
This document describes MySQL::Sharding::Client::Client version 0.0.1.
=head1 SYNOPSIS
use MySQL::Sharding::Client::ResultSet;
my $sth = MySQL::Sharding::Client::ResultSet->new(
command => 'SELECT',
%arguments,
);
$sth->add_stmt( $_->prepare($statement) ) for @dbhs;
$sth->execute(@bind_value);
$rv = $sth->rows;
$sth->group_by(@column_names);
$sth->order_by($column_name, 'ASC');
$sth->order_by($column_name, 'DESC');
$sth->limit($num);
@row_ary = $sth->fetchrow_array;
%row_hash = $sth->fetchrow_hash;
$ary_ref = $sth->fetchrow_arrayref;
$hash_ref = $sth->fetchrow_hashref;
$sth->disconnect;
=head1 DESCRIPTION
This Module instance returned by MySQL::Sharding::Client->prepare
or MySQL::Sharding::Client->do.
=head1 DEPENDENCIES
Perl 5.8.1 or later.
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
=head1 SEE ALSO
L<perl>
=head1 AUTHOR
Kensaku Araga E<lt>ken39arg {at} gmail.com<gt>
=head1 LICENSE AND COPYRIGHT
Copyright (c) 2012, Kensaku Araga. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut

0 comments on commit e0bc10f

Please sign in to comment.