DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

Not supporting new type of columns [rt.cpan.org #117846]

Open mbeijen opened this issue 8 years ago • 2 comments
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,

mbeijen avatar Nov 14 '17 19:11 mbeijen

Looks related to #206

dveeden avatar Sep 15 '18 18:09 dveeden

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.

dveeden avatar Sep 15 '18 22:09 dveeden