Bug #37475 c example code for mysql_stmt_execute() and mysql_stmt_fetch()
Submitted: 18 Jun 2008 11:21 Modified: 14 Dec 2008 20:51
Reporter: Robert Grabein Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:mysql 5.0.51b-win32 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[18 Jun 2008 11:21] Robert Grabein
Description:
The given examples work fine for int and short,
but cause an error for
	bind[1].buffer_type= MYSQL_TYPE_STRING; // == 254

How to repeat:
using vc++, connecting to the db and just running the example code..

output for the my_sql_stmt_execute() example:

prepare, INSERT successfull
total parameters in INSERT: 3
mysql_stmt_bind_param() failed
Using unsupported buffer type: 0 (parameter: 1)

the same problem is caused reading a self-made table
conaining VARCHAR fields with the example for mysql_stmt_fetch().

Any idea ?
[18 Jun 2008 11:25] Susanne Ebrecht
Many thanks for writing a bug report.

Please can you provide a short test here.
[14 Nov 2008 20:51] MySQL Verification Team
Thank you for the bug report. I tried the sample code with the below changes:

/*
#include "stdafx.h"
#include <cstdio>
#include <conio.h>
#include <string.h>
#include <winsock.h>
#include "mysql.h"
#pragma comment(lib,"libmysql")
*/
#include <my_global.h>
#include <m_string.h>
#include <conio.h>
#include <ctype.h>
#include "mysql.h"

//using namespace System;

int main()
{
	MYSQL *mysql;
	mysql = mysql_init(NULL);
	mysql_real_connect(mysql, "localhost", "root", "", "test", 3500, NULL, 0);

I linked against the static client library mysqlclient.lib and I got the below output:

C:\temp>MySQLbug37475
 prepare, INSERT successful
 total parameters in INSERT: 3
 total affected rows(insert 1): 1
 total affected rows(insert 2): 1

and how if (mysql_stmt_close(stmt)) is called again in the exitpoint:
I got a crash on your sample. I compiled with VS2003 and with source server
5.0.72.

So I don't have idea what it was wrong on your side. Any clues?. Thanks
[15 Dec 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".