Results 1 to 5 of 5

Thread: problem with read blob from postgres db

  1. #1
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default problem with read blob from postgres db

    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 )

    Qt Code:
    1. *** conect to database simple without setting something conection options
    2.  
    3. QByteArray pixPhoto = query.value(0).toByteArray();
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem with read blob from postgres db

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: problem with read blob from postgres db

    Its strange problem was cleaning after reinstall Linux...ok thx for your attention
    a life without programming is like an empty bottle

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem with read blob from postgres db

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: problem with read blob from postgres db

    Hm maiby you are right.. but before reinstall Linux i tryed reinstall postgres and that had no effect...
    a life without programming is like an empty bottle

Similar Threads

  1. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.