Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-400

error with sizeof("commit") in function mysql_commit

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.3.7
    • 3.1.3
    • None
    • None
    • linux ppc64/window10 x64

    Description

      Hi team,
      I want to connect a drds database with library mariadb-connector-c-2.3.7-src. when i use mysql_commit function ,i got an error like this:

       mysql_error:You have an error in you SQL syntax:Error occurs around this fragment : {COMMIT 
       mysql_errno:1064
      

      I found that the mysql_commit function uses the sizeof("commit") , the value is 7.

      3363 my_bool STDCALL mysql_commit(MYSQL *mysql)
      3364 {
      3365   DBUG_ENTER("mysql_commit");
      3366   DBUG_RETURN((my_bool)mysql_real_query(mysql, "COMMIT", sizeof("COMMIT")));
      3367 }
      3368 
      3369 my_bool STDCALL mysql_rollback(MYSQL *mysql)
      3370 {
      3371   DBUG_ENTER("mysql_rollback");
      3372   DBUG_RETURN((my_bool)mysql_real_query(mysql, "ROLLBACK", sizeof("ROLLBACK")));
      3373 }
      

      and the libmysql.c in library mysql-5.5.37/libmysql ,the implement is

       4745 my_bool STDCALL mysql_commit(MYSQL * mysql)
      4746 {
      4747   DBUG_ENTER("mysql_commit");
      4748   DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6));
      4749 }
      

      when i use libmysql, the error is fixed.

      the poco c++ library use length() function ,and the error is fixed too.

        sql = "commit";
          rc = mysql_real_query(hsession, sql.c_str(), static_cast<unsigned long>(sql.length()));
          if (rc != 0)
          {
              print_mysql_error();
          }
          assert(rc == 0);
      

      I'm not sure if it's a bug, so I want to get an answer.

      Attachments

        Activity

          People

            georg Georg Richter
            anklean anklean
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.