PDA

View Full Version : problem with read blob from postgres db



zlatko
2nd November 2006, 16:50
HI all !
Hm i'll try explain its strange problem....have Linux Suse , postgresql 7.3.4, db with client_encoding = unicode. Blobs saved in db in field with type bytea. When i try get blob from db i get bad image(hex is not correct, IMHO something that have relation to unicode :o )



*** conect to database simple without setting something conection options

QByteArray pixPhoto = query.value(0).toByteArray();

wysota
4th November 2006, 08:25
The problem probably is that your binary data gets converted according to the codec (either by the database or by the driver). Is the data stored correctly? Try dumping it to the console or bypassing the Qt sql driver or even peek at the database through php.

zlatko
4th November 2006, 08:40
Its strange problem was cleaning after reinstall Linux...ok thx for your attention :)

wysota
4th November 2006, 08:42
You probably had an incorrect codec in the database and the data was getting corrupted, During reinstall probably the correct codec was installed and the problem disappeared.

zlatko
5th November 2006, 08:30
Hm maiby you are right.. but before reinstall Linux i tryed reinstall postgres and that had no effect...