Skip to content

Instantly share code, notes, and snippets.

@tokuhirom
Created September 25, 2008 10:32
Show Gist options
  • Save tokuhirom/12797 to your computer and use it in GitHub Desktop.
Save tokuhirom/12797 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# see http://rt.cpan.org/Public/Bug/Display.html?id=37027#txn-497961
use strict;
use warnings;
use DBI;
use YAML;
use IO::Prompt;
&main; exit;
sub d {
my $dbh = shift;
my $sth = $dbh->prepare("SELECT * FROM user");
$sth->execute();
print YAML::Dump([map { $_->[1] } @{$sth->fetchall_arrayref()}]);
}
sub main {
my $dbh = DBI->connect("DBI:mysql:database=mysql;mysql_auto_reconnect=1", "root", '', {mysql_auto_reconnect=>1});
d($dbh);
prompt("wait >"); # restart mysql here
d($dbh);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment