Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PyQt4: Reading binary data from Postgresql fails under Windows
QtWS25 Last Chance

PyQt4: Reading binary data from Postgresql fails under Windows

Scheduled Pinned Locked Moved Language Bindings
11 Posts 2 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    It rather looks like your software doesn't find the PostgreSQL client libraries. Check with something like Dependency Walker

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leonidas
      wrote on last edited by
      #3

      I can connect to Postgresql and execute other queries but that one has a problem.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Sorry, I've misunderstood your original problem. Saving a byte array in a file named something.pdf doesn't make it a valid pdf file. If you want to create a PDF you should create one using e.g. QPdfWriter

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • L Offline
          L Offline
          leonidas
          wrote on last edited by
          #5

          Ok, the file can be any file format in the database i.e. zip, pdf,doc,jpg etc. Is there any generic way to exctract from database and write to disk?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            A text file works great

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • L Offline
              L Offline
              leonidas
              wrote on last edited by
              #7

              Thank you. I 'll check it. I have already checked a pdf and an xml

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                QFile doesn't know how to write pdf or xml just because you put that extension on the file name. It's your job to provide the right data.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  leonidas
                  wrote on last edited by
                  #9

                  Is that an OS specific issue? It works under Linux and not under Windows?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    It's not OS nor Qt specific. A file extension doesn't do anything magic when writing programmatically to a file

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      leonidas
                      wrote on last edited by
                      #11

                      How is it explained that the code works under Linux?
                      With the same code I can write pdf and zip.
                      Thanks for your patience!

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved