mysql升级5.7.19版本JSON类型测试和perl与Go-client

写在之前

从5.1切换到5.7,主要由mysql-server、mysql-devel、mysql-libs三部分
成功安装后:

-bash-4.1$ mysql -V
mysql  Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using  EditLine wrapper

JSON类型测试

Paste_Image.png

perl客户端测试clob类型

需要安装DBI和DBD-mysql,可以打成绿色包以后免安装可直接解压使用。

#CREATE TABLE person (
#number INT(11) auto_increment primary key,
#name VARCHAR(255),
#birthday DATE,
#description LONGTEXT);

require("MysqlPub.pl");
my $dbh = &dbCon("MysqlPub");

#插入clob字段和日期字段
my $statement = "insert into person(name,birthday,description) values(?,'1983-11-23 00:00:00','跑步跳高')";
my $UpdLog = $dbh->prepare($statement);
my $result = $UpdLog->execute('liyr');

#查看插入信息
my $sth = $dbh->prepare("SELECT * FROM person");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
  print "Found a row: number = $ref->{'number'}, name = $ref->{'name'}, birthday = $ref->{'birthday'}, description = $ref->{'description'}\n";
}
$sth->finish();

#doselect测试
$statement = "SELECT name FROM person";
$sth = &doselect($dbh, $statement);
while(my $ref = $sth->fetchrow_arrayref()){
    my $name =  $ref->[0];
    print "doselect test name : $name\n";
}
$sth->finish();
$dbh->disconnect();

golang客户端

使用_ "github.com/go-sql-driver/mysql"包,代码也很简单就不贴了。。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容