I think I totally screwed something up because I don't have a test092.cxx.
I have up to test090.cxx and that is it.


-----Original Message-----
From: Jeroen T. Vermeulen [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 08, 2006 1:37 AM
To: DEV
Cc: [email protected]
Subject: Re: [libpqxx-general] PGSTD::string pqxx::transaction_base::esc (
const PGSTD::string & )

On Thu, September 7, 2006 20:23, DEV wrote:


> Does anyone out here have an example of using PGSTD::string
> pqxx::transaction_base::esc  (  const PGSTD::string &    ) to store and
> pull
> an image out of a table field and display it in a vc++.NET application?

Don't do that!

The esc() functions are for text fields, not for binary data.  "Text" does
not mean an arbitrary series of bytes.  Zero bytes inside your string, for
instance, are not allowed in text and so esc() does not support them.

Use fields of the binary "bytea" type instead.  Escape your data with
esc_raw(), and un-escape with the binarystring class.

Or, if you expect some of your images to be very large, you can use the
large-object API which works much more like regular files.

I can't help you with how to display images in a Visual C++.NET
application, but for the parts that have something to do with libpqxx,
take a look at test062.cxx.  If you want to insert your images using
prepared statements, test092.cxx has the examples you need.


Jeroen





_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to