Traders courses in binary options forum14 comments
Trading brokers in hyderabad the great wall
We were trying to get rid of this problem for 3 days now with no success. The problem is that we can't read that array back AFTER we load the bytearray to the database, it's either corrupted or I don't know what else happens there, but we cannot read it correctly anymore. But if we store the array to the blob by our program not directly from phpmyadmin - we cannot read it for some reason.
We just get "QPixmap null ". We tried a loooot of ways, reinstalling the program, the database, recompiling the MySQL drivers, a lot of different ways of reading the image QImage, File, with buffer and without, etc and no success. Looks like it doesn't store the array into blob properly Would be very thankful for help! Code snippets in attachment.
Windows 10 Added after 1 45 minutes: Take a look at the screenshot please. To the left you can see the image that we tried to upload through our program, to the right - through the DB.
As you can see, the database doesn't also recognize our array as an image. What might be the problem? This were two exact the same images. The problem might be that you are trying to insert binary data into a text string. IMO you should encode it in e. Going via QPixmap may result in the image being stored with different metadata or compressed differently when saved to the buffer Given that you already have the image in a file and you only wish to store it there really is no need to go via QPixmap and QBuffer at all.
This code works with a Mysql mediumblob. This code worked out for us , though we have already tried working through the file, but I guess we didn't read it through the file! Will try implementing this in our program, Biggest Thanks to you! Will keep you informed Added after 32 minutes: Damn, for some reason it doesn't work in our program. The same problem occurs I think the only way to understand what happens is to upload our project here so you can see the whole process.
Added after 34 minutes: Would be VERY thankful if someone could take a look and say what is the problem I ran your code in my environment using Qt 5.
Both produced the issue you complain of: As wysota suggested, it appears the binary data has been treated as character data at some point: The original PNG file starts with the standard 8 byte header: That code point is used to substitute for a part of string that is invalid in the encoding being used to interpret it.
The database you are connected to is set by the QSqlDatabase connection you use and need not be specified again. Removing the "USE test;" from both statements makes the code behave. I can only think that the switch of connection caused by "USE", or the compound statement itself confused the Qt bindValue or Mysql, or both.
Thank you, this is what fixed our problem now You are a Man among men ;.