MYSQL C API Files handlgin
Posted by: Paul Chis
Date: November 09, 2005 02:01PM

Hello, can anybody help me, please?

I created an application in VC++ 6.0 and worked with a MYSQL server, using the C API. Everything went well until I wanted to add the facility to the application to store files in the database. So , I added a longblob field in my table and tried to put the file in in using the mysql_real_query. I read the content of the file binary with fread function and used the mysql_real_escape_string function to convert the content of the file (a .doc file) into a valid string. I appended the string to the "UPDATE table SET field = \'" string and at the end of it I appended the "\' WHERE ID = value" string.

I used the resulted string in the mysql_real_query(mysql,string, buffersize) function and the result it returned was 0 (ok).
My file has a 20436 length but in the database record is only placed a string of 8 characters.
Does anybody has an ideea what went wrong? Or does anybody have a better solution?
Thanks,
Paul.

Options: ReplyQuote


Subject
Views
Written By
Posted
MYSQL C API Files handlgin
708
November 09, 2005 02:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.