Re: Handling Blobs with libpq

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: "Reid Thompson" <Reid(dot)Thompson(at)ateb(dot)com>, "PostgreSQL-general" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: Handling Blobs with libpq
Date: 2003-03-20 20:10:04
Message-ID: 200303202010.04372.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 20 March 2003 17:03, Reid Thompson wrote:
> I'd be appreciative if someone could give or point me to a working example
> of storing/retrieving images via bytea.

I don not understand the question, "bytea" is the data type that can hold any
binary data, so the "picture" is just a way to interpret that data.

If you are asking for sample how to read and write "bytea", there are
attached files from postgres sql driver for QT library. It is not the
original QT driver, because it does not know how to handle "bytea", and
"blobs", and have some serious errors in code, so I made my own plugin. From
the source you can see how "bytea" and "blobs" are read and written.

Based on this sql plugin I wrote set of database objects, and one of those
objects is "PgPicture".
PgPicture simply takes "QByteArray" from driver, does some work on it and
shows the picture on the screen.

For postgres version 7.3 it is working fine, but in previous releases
PQEscabeBytea had errors, and some pictures that I was using to test the
library could not be saved.

Attachment Content-Type Size
qpsql_driver.cpp text/x-c++src 29.8 KB
qpsql_driver.h text/x-chdr 4.8 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2003-03-20 20:19:44 Re: psql 7.3 encoding problems
Previous Message Dennis Gearon 2003-03-20 20:06:10 Re: don't understand something about backslashes