[root@wx03 mojo]# cat relink.pl
use Mojolicious::Lite;
use JSON qw/encode_json decode_json/;
use Encode;
no strict;
no warnings;
use JSON;
use POSIX;
use JSON::RPC::Client;
use Data::Dumper;
use DBI;
# /foo?user=sri`
my %hash=();
my $dbUser='DEVOPS';
my $user="root";
my $passwd="R00t,uHagt.xx";
my $dbh = DBI->connect("dbi:mysql:database=$dbUser;host=127.0.0.1;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;
get '/api/relink' => sub{
my $c = shift;
my @arr2=();
my $env = $c->param('env');
my $hostSql = qq{select ip,info,env from publish_info where env='$env';};
my ($a1, $a2, $a3,$a4,$a5,$a6,$a7,$a8,$a9);
my $selStmt = $dbh->prepare($hostSql);
$selStmt->execute();
$selStmt->bind_columns(undef, \$a1, \$a2,\$a3);
while( $selStmt->fetch() ){
print "\$a1 i
PERL DBI 自动重连问题
最新推荐文章于 2022-04-27 17:11:11 发布