Results 1 to 3 of 3

Thread: psql large object and pixmap

  1. #1
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default psql large object and pixmap

    I need and example for getting jpg file which stored as large object in postgresql and setting as pixmap.

    Normally i write to a file and set pixmap. Is it possible on the fly?

  2. #2
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: psql large object and pixmap

    You can pass a byte array to QPixmap, as such you must not load an image from file in order to use it.
    "If you lie to the compiler, it will get its revenge." - Henry Spencer

  3. #3
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: psql large object and pixmap

    QPixmap image;
    QSqlQuery query;
    PGresult* res = PQexec(conn, "begin");
    Oid objID = query.value(0).toInt();
    int descriptor = lo_open(conn, objID, INV_READ);

    Now my problem is conn parameter. What must i use?
    I connected to database like this.

    QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
    db.setHostName(HOST);
    db.setDatabaseName(DBNAME);
    db.setUserName(USER);
    db.setPassword(PASSWORD);

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
  •  
Qt is a trademark of The Qt Company.