#!/usr/bin/perl
use DBI;
use Encode;
$user="root";
$passwd="1234567";
$dbh="192.168.32.232";
my $table=<STDIN>;
chomp $table;
print "\$table is $table\n";
my $table=encode("utf8",decode("gbk","$table"));
print "\$table is $table\n";
$dbh = DBI->connect("dbi:mysql:database=zjzc;host=192.168.32.232;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;
$dbh->do("SET NAMES utf8");
##my $hostSql = qq{select script from publish_info where env='$env' and info='$app' and ip='$ip'};
my $sql=qq{select sn,name,productType from zjzc.Product where name like '%$table%'};
print "\$sql is $sql\n";
$sth=$dbh->prepare($sql);
$sth->execute;
while (@recs=$sth->fetchrow_array) {
foreach (@recs)
{print encode("gbk",decode("utf8","$_"))}
print "\n";
}
$dbh->disconnect;
mysql utf8 中文
程序员文章站
2024-03-23 17:59:28
...
下一篇: UTF8 转GB 中文字符
推荐阅读
-
mysql utf8 中文
-
UTF8 转GB 中文字符
-
windows cmd 下utf8正常显示中文(转)
-
mysql之同表复制插入数据
-
python:读取excel并将其数据插入mysql
-
MySQL和CouchDB各插入5000条记录的速度对比 博客分类: 数据库 CouchDBMySQLperformancejsonSQL
-
python读取Excel文件,连接MySQL数据库插入或更新表
-
friendfeed如何使用mysql 博客分类: 也说架构 MySQLCouchDB数据结构
-
Mysql的Group By 博客分类: Mysql mysqlgroup by
-
mysql 优化 博客分类: 其他 MySQLCC++C#