Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » MySql data types
MySql data types [message #7076] Mon, 11 December 2006 22:20 Go to next message
dmcgeoch is currently offline  dmcgeoch
Messages: 52
Registered: November 2006
Location: New Jersey
Member
Hello,

I noticed that there are several data types not included in the definitions for MySql. In particular, the BLOB data type. Is there a reason for this, or just an oversight? I want to save an image as part of a record and I believe that a BLOB is the proper data structure for this. Please let me know if there is a better way to handle images.

Thank you for your assistance,

Dave
Re: MySql data types [message #7101 is a reply to message #7076] Wed, 13 December 2006 23:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, the most likely reason is that nobody needed it yet Smile

What about storing it as text?

Mirek
Re: MySql data types [message #7106 is a reply to message #7101] Thu, 14 December 2006 01:03 Go to previous messageGo to next message
dmcgeoch is currently offline  dmcgeoch
Messages: 52
Registered: November 2006
Location: New Jersey
Member
Storing it as text was my next attempt Smile

I am having trouble determing the size of the image for the .sch file. I wrote code to open an image and place it in a label, but I can't figure out how to determmine the size and convert the image to a string that can be saved and restored. I've been looking through the examples and reference code without any luck. I've also be searching the forums, but I haven't come across anyone else attempting to save an image as part of another file.

Thank you,

Dave
Re: MySql data types [message #7177 is a reply to message #7106] Sun, 17 December 2006 17:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
dmcgeoch wrote on Wed, 13 December 2006 19:03


convert the image to a string that can be saved and restored.



String StoreImageAsString(const Image& img);
Image  LoadImageFromString(const String& s);
Size   GetImageStringSize(const String& src);
Size   GetImageStringDots(const String& src);


that will store it in "U++ format". If you want your database to be more transparent, you can e.g. use PNG:

PNGEncoder png;
String s = png.SaveString(image);


Mirek
Re: MySql data types [message #7208 is a reply to message #7177] Mon, 18 December 2006 14:46 Go to previous message
dmcgeoch is currently offline  dmcgeoch
Messages: 52
Registered: November 2006
Location: New Jersey
Member
Mirek,

The functions

String StoreImageAsString(const Image& img);
Image LoadImageFromString(const String& s);

Did the trick after I used the Encode64() function prior to storing the image and the Decode64() function after fetching the image.

I used the GetLength() function to determine an approximate size for the image in the record. The GetImageStringSize() and the GetImageStringDots() functions appear to give an area value, but not the amount of memory required to store the image.

Thank you for all of your assistance and keep up the great work. Ultimate++ is by far the best environment I've used.

Dave
Previous Topic: Compiling OLEDB using MINGW
Next Topic: SqlArray::Join when a foreign key has more than one field
Goto Forum:
  


Current Time: Mon Apr 29 08:33:28 CEST 2024

Total time taken to generate the page: 0.03820 seconds