title: Syntax error in MySQL prepare statement using C API
body: <p>I created a MySQL database, with some stored procedures. Using MySQL Workbench the SP forks fine, and now I need to launch them using a c program.</p>
  <p>I created the program, which connect successfully to my db, and I'm able to launch procedures which not requires parameters.</p>
  <p>To launch more complex procedure I need to use the prepare statement in c: in particular, I want to call the procedure <code>esame_cancella(IN code CHAR(5))</code> which deletes a selected row of the table 'esame'.</p>
  <pre><code>    int status;
      MYSQL_RES *result;
      MYSQL_ROW row;
      MYSQL_FIELD *field;
      MYSQL_RES *rs_metadata;
      MYSQL_STMT *stmt;
      MYSQL_BIND ps_params[6];
      unsigned long length[6];
      char cod[64];
  
      printf(&quot;Codice: &quot;);
      scanf (&quot;%s&quot;,cod);
      length[0] = strlen(cod);
      
      stmt = mysql_stmt_init(conn);
      if (stmt == NULL) {
          printf(&quot;Could not initialize statement\n&quot;);
          exit(1);
      }
      
      status = mysql_stmt_prepare(stmt, &quot;call esame_cancella(?) &quot;, 64);
      test_stmt_error(stmt, status); //line which gives me the syntax error 
  
      memset(ps_params, 0, sizeof(ps_params));
  
      ps_params[0].buffer_type = MYSQL_TYPE_VAR_STRING;
      ps_params[0].buffer = cod;
      ps_params[0].buffer_length = 64;
      ps_params[0].length = &amp;length[0];
      ps_params[0].is_null = 0;
  
  
      // bind parameters
      status = mysql_stmt_bind_param(stmt, ps_params); //muore qui
      test_stmt_error(stmt, status);
  
      // Run the stored procedure
      status = mysql_stmt_execute(stmt);
      test_stmt_error(stmt, status);
  
      }
  </code></pre>
  <p>I use <code>test_stmt_error</code> to see MySQL log calling procedures.</p>
  <pre><code>    static void test_stmt_error(MYSQL_STMT * stmt, int status)
      {
          if (status) {
              fprintf(stderr, &quot;Error: %s (errno: %d)\n&quot;,
              mysql_stmt_error(stmt), mysql_stmt_errno(stmt));
              exit(1);
          }
      }
  </code></pre>
  <p>when I compile, and launch my program, I have the following log:</p>
  <blockquote>
  <p>Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 (errno: 1064)</p>
  </blockquote>
  <p>Any help?</p>