BINLOG_GTID_POS(..) does not return proper error unless mysql_store_result is called

Description

When I use BINLOG_GTID_POS(..) on a server where binary log is not enabled, I expect it to return ER_NO_BINARY_LOGGING. It does so lets say in MySQL client, but with some API variants it does not.

C API:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #include <my_global.h> #include <mysql.h> int main(int argc, char **argv) { MYSQL con; mysql_init(&con); if (mysql_real_connect(&con, "127.0.0.1", "root", "", "test", 3306, NULL, 0) == NULL) { fprintf(stderr, "ERROR: %s\n", mysql_error(&con)); exit(1); } mysql_query(&con,"select binlog_gtid_pos('a',1)"); // If I call mysql_store_result(&con) here, everything works. // If I call mysql_use_result(&con) or nothing at all, there is no error fprintf(stderr,"Here should be an error: %s\n",mysql_error(&con)); mysql_close(&con); }

Perl:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 use DBD::mysql; use strict; my $dsn = "dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test"; my $dbh = DBI->connect($dsn); unless (defined $dbh) { print STDERR "Could not connect to $dsn\n"; exit(1); } my $sth = $dbh->prepare("SELECT binlog_gtid_pos('a',1)"); # If I set mysql_store_result here, or nothing at all, everything works. # If I set mysql_use_result, it does not $sth->{'mysql_use_result'}=1; unless (defined $sth) { print STDERR $dbh->errstr(), "\n"; exit(1); } $sth->execute(); print "Here should be an error: ", $sth->errstr(), "\n"; $sth->finish(); $dbh->disconnect();

In both cases output is

1 Here should be an error:

Current tree:

1 2 3 revision-id: monty@askmonty.org-20140222011156-i1pa6zm2iltb4usv revno: 4007 branch-nick: 10.0

Environment

None

Status

Assignee

Kristian Nielsen

Reporter

Elena Stepanova

Labels

External issue ID

None

External issue ID

None

Fix versions

Affects versions

10.0.8

Priority

Major