NAME
Net::Drizzle - perl bindings for libdrizzle
SYNOPSIS
use Net::Drizzle;
my $dr = Net::Drizzle->new();
my $con = $dr->con_create();
$con->set_tcp('localhost', 10010);
$con->add_options(Net::Drizzle::DRIZZLE_CON_MYSQL);
$con->set_db("information_schema");
$dr->escape(q{"});
my $s1 = $con->query_add('select * from foo;');
$dr->query_run_all();
if ($s1->error_code != 0) {
die "@{[ $s1->error_code ]}: @{[ $s1->error ]}";
}
while (my $row = $s1->row_next) {
my @row = @$row;
printf "$i: $row[0], $row[1]";
}
DESCRIPTION
Net::Drizzle is perl bindings for libdrizzle. Net::Drizzle has a straightforward interface for libdrizzle. If you want a DBI like interface, please use DBD::Drizzle instead.
libdrizzle can connect to mysql server and drizzle server. You can use libdrizzle as better version of libmysqlclient.
libdrizzle's great features are listed below.
THIS MODULE IS IN ITS BETA QUALITY. API MAY CHANGE IN THE FUTURE
- Concurrent Queries
-
Net::Drizzle can handle the concurrent queries.The example code is in the synopsis.
- Non-blocking I/O support
-
Net::Drizzle can use with any event driven frameworks such as POE, Danga::Socket, etc.
- Server interface
-
This library provides server protocol interface. You can use it to write proxies or "fake" drizzle and mysql servers.
METHODS
- my $drizzle = Net::Drizzle->new();
-
create new instance of Net::Drizzle.
- my $con = $drizzle->con_create();
-
create new connection object.
- my $con = $drizzle->con_add_tcp($host, $port, $user, $password, $db, $options);
-
create new connection object for a lot of informations.
- $drizzle->query_run_all();
-
run all queries concurrently.
- Net::Drizzle->escape(q{"';})
-
quote meta chars.
- Net::Drizzle->hex_string("\x61");
-
This method is same as unpack('H*', $str).
- my $ver = Net::Drizzle->drizzle_version();
-
get the version of libdrizzle
- $drizzle->add_options($options)
-
add options.
- $drizzle->con_wait();
-
Wait for I/O on connections.
- $drizzle->error();
-
Return an error string for last library error encountered.
- $drizzle->error_code()
-
Return an error code for last library error encountered.
- $drizzle->query_run()
-
Run queries concurrently, returning when one is complete.
BENCHMARKS
This is a simple benchmark result of Net::Drizzle(by benchmark/simple.pl).
Net::Drizzle: 0.01
DBD::mysql: 4.007
DBI: 1.608
Rate dbd_mysql serial concurrent
dbd_mysql 65.6/s -- -48% -53%
serial 126/s 92% -- -11%
concurrent 141/s 115% 12% --
AUTHOR
Tokuhiro Matsuno <tokuhirom @*(#RJKLFHFSDLJF gmail.com>
THANKS TO
kazuhooku(many advice and suggested to write this module)
gfx++(xs)
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.