Bug #1487 mysql_send_long_data fails (embedded)
Submitted: 4 Oct 2003 23:36 Modified: 6 Oct 2003 3:57
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:4.1.1 OS:
Assigned to: Alexey Botchkov CPU Architecture:Any

[4 Oct 2003 23:36] Georg Richter
Description:
mysql_send_long_data doesn't work in embedded mysql. mysql_stmt_error reports no error, 
mysql_error reports wrong arguments for get_longdata. 
 
 

How to repeat:
#include <mysql.h> 
#include <stdio.h> 
 
 
int main() { 
	int		rc; 
	MYSQL 		*mysql; 
	MYSQL_BIND	bind[2];	 
	MYSQL_STMT	*stmt; 
	MYSQL_RES	*res; 
	MYSQL_ROW	row; 
	char		str1[100]; 
 
#ifdef EMBEDDED 
	mysql_server_init(0, NULL, NULL); 
#endif 
 
	mysql = mysql_init(NULL); 
#ifdef EMBEDDED 
	if (mysql_real_connect(mysql, NULL, NULL, NULL, "", 0, NULL, 0) == NULL) { 
#else 
	if (mysql_real_connect(mysql, "localhost", "root", "", "", 0, NULL, 0) == NULL) { 
#endif 
		printf("error\n"); 
	} 
 
 
	mysql_select_db(mysql, "test"); 
 
	mysql_query(mysql, "DROP TABLE testld"); 
 
	mysql_query(mysql,"CREATE TABLE testld(a int, b long varbinary)"); 
 
	stmt = mysql_prepare(mysql, "INSERT INTO testld (a, b) VALUES (1,?)", 100); 
 
	bind[0].buffer_type=FIELD_TYPE_STRING; 
	bind[0].is_null=0; 
	bind[0].buffer_length=0;		 
	bind[0].length=0;				 
 
	mysql_bind_param(stmt,bind); 
 
  	strcpy(str1, "This is a simple test"); 
	mysql_send_long_data(stmt,0,str1,strlen(str1)); 
 
	if (mysql_stmt_errno(stmt)) { 
		printf ("Error: %s\n", mysql_stmt_error(stmt)); 
	} 
 
	mysql_execute(stmt); 
 
	mysql_stmt_close(stmt); 
 
	mysql_query(mysql, "SELECT * FROM testld"); 
	res = mysql_store_result(mysql); 
	row = mysql_fetch_row(res); 
	printf ("A: %s B: %s\n", row[0], row[1]); 
	mysql_free_result(res); 
 
	mysql_close(mysql); 
#ifdef EMBEDDED 
	mysql_server_end(); 
#endif 
}
[6 Oct 2003 3:57] Alexey Botchkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

changeset 1.1615