Uploaded image for project: 'MariaDB Server'
  1. MDEV-5728

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.8
    • Fix Version/s: 10.0.9
    • Component/s: None
    • Labels:

      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:

      #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:

      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

      Here should be an error: 
      

      Current tree:

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

        Attachments

          Activity

            People

            • Assignee:
              knielsen Kristian Nielsen
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: