Thi Cao writes: > All, > > I created a C++ class containing a variety of member variables of varying > types such as float, int, char *, etc. If I instantiate an object of this > class, how should I insert this object into my database table? I can > retrieve the individual members and insert them that way, but I feel it > would be more efficient to insert the object as a BLOB, but I don't exactly > know how to do that. Basically, I want to insert the object as is so that I > can retrieve it as is and not have to bother with calling the member setting > functions to populate the class members. I looked at the MySQL++ example > for loading a binary file, but am unsure how to apply that to my needs. I > also looked through the mail archives and was unsuccessful in finding a > solution, so any assistance would be much appreciated. Thanks in advance. > > Regards, > > Thi
Hi! Take a look in reset_db.cc and load_file.cc example files. In any case, you always have to escape a binary string prior to inserting it. As it is seen in cgi_image.cc example, you will always get back from MySQL your BLOB in en-escaped, original form. -- Regards, __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php