• Mojo Mysql utf-8字符集 需要{mysql_enable_utf8 => 1}


     get '/api/log_mon/get_log' => sub{
       my $c = shift;
       my $env = $c->param('env');
       my $host = $c->param('host');
       use DBI;
    my $dbUser='DEVOPS';  
    my $user="root";  
    my $passwd="1234567"; 
    
    my @arr2=();;  
    my $dbh  = DBI->connect("dbi:mysql:database=DEVOPS;host=192.168.32.161;port=3306",$user,$passwd,{mysql_enable_utf8 => 1} ) or die "can't connect to database ". DBI-errstr;
    my $hostSql = qq{select   sn,host_name,host_ip,v_date,info,env from err_info where env='$env' and host_name='$host' order by v_date desc limit 20}; 
    my ($a1, $a2, $a3,$a4,$a5,$a6,$a7,$a8,$a9);  
    my $selStmt = $dbh->prepare($hostSql);  
    $selStmt->execute();  
    $selStmt->bind_columns(undef, $a1, $a2, $a3,$a4,$a5,$a6);  
    #$selStmt->execute();  
    while( $selStmt->fetch() ){ push (@arr2, "$a1  $a2  $a3 $a4 $a5 $a6
    " );
    };
    chomp @arr2;
    print "@arr2 is @arr2
    ";
     $c->render(json =>  @arr2);
     };
      

  • 相关阅读:
    Beyond Compare比较图片怎么修改背景颜色
    Leonardo's Notebook UVALive
    Saddle Point ZOJ
    概率dp总结 正在更新
    First Knight UVALive
    Scout YYF I POJ
    RedIsGood TopCoder
    聪聪和可可 HYSBZ
    So you want to be a 2n-aire? UVA
    国家队论文集
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350681.html
Copyright © 2020-2023  润新知