DBD-mysql
DBD-mysql copied to clipboard
Not supporting new type of columns [rt.cpan.org #117846]
trafficstars
Migrated from rt.cpan.org#117846 (status was 'new')
Requestors:
From [email protected] on 2016-09-15 05:32:31:
Perl v5.20.3
p5-DBD-mysql-4.035
When using the database columns of type json get a warning:
column_info: unrecognized column type âjson'
https://dev.mysql.com/doc/refman/5.7/en/json.html <https://dev.mysql.com/doc/refman/5.7/en/json.html>
Best regards,
Looks related to #206
test case:
#!/usr/bin/perl
use v5.24.0;
use DBI;
my $dsn = "DBI:mysql:database=test;host=127.0.0.1;port=8011";
my $dbh = DBI->connect($dsn, "msandbox", "msandbox");
$dbh->do("drop table if exists t1");
$dbh->do('create table t1(
id serial primary key,
j json
)');
$dbh->do(q/insert into t1(j) values ('{"foo": "bar"}')/);
my $sth = $dbh->prepare("SELECT id, j FROM t1");
$sth->execute();
while (my $res = $sth->fetchrow_hashref()) {
printf("id=%s j=%s\n", $res->{'id'}, $res->{'j'});
}
$sth->finish();
$dbh->column_info( undef, "test", "t1", "id" );
$dbh->column_info( undef, "test", "t1", "j" );
$dbh->disconnect();
Output:
id=1 j={"foo": "bar"}
column_info: unrecognized column type 'json' of `test`.`t1`.j treated as varchar at ./example.pl line 23.