Dear all,
I met a problem when i wanna insert binary to database. I've spent a lot of time to solve it but i still cannot find any solution......
My problem is, when i insert binary by binding it to statement and execute the query. The steps report no error. However, only NULL is inserted to database. (if i set the column to Not-NULL, 0 is inserted instead)\
Here is my work flow:
sprintf_s(query, 2048, "INSERT INTO Person(Name) VALUES(?)");
if (mysql_stmt_prepare(stmt, query, strlen(query)))
return -1;
MYSQL_BIND bind[1];
memset(bind, 0, sizeof(bind));
unsigned long size = strlen(personName);
bind[0].buffer_type = MYSQL_TYPE_VAR_STRING;
bind[0].buffer = (char *)personName;
bind[0].length = &size;
bind[0].is_null = (my_bool*)0;
if (mysql_stmt_bind_param(stmt, bind))
return -1;
if (mysql_stmt_execute(stmt))
return -1;
Have anyone met something like this?? Any suggestion is appreciated!!
Thanks!!!!!!!