On Fri, August 10, 2007 17:52, Jacob Rief wrote:

> I checked the HEAD of the repository-trunk, but did not find any evedence
> for array support. Did you ever commit the work you have done so far?

Nope.  Wasn't ready.


> First I create a pure C function which does nothing else than copying the
> raw array-data into a Postgres bytea-object. This function must be part of
> a Postgres shared object, which has to be loaded into the server-side-part
> of Postgres, ie. SPI-functions.

Ouch.  Exactly as you say: I can see that it makes sense as a solution for
your problem, but I don't think we can take this approach in libpqxx!


> While my solution works fine for me, I am not sure, that this can be a
> general approach. However, I did not find any other solution to transfer
> array data, unless one is willing to perform a
> binary-to-ascii-to-binray-conversion.

The conversion between text and binary (of the contents of the array)
isn't all that big a deal.  We do those conversions all the time anyway. 
The problem is that I need to add a parser that can unravel the text
representation of the array itself.  Which isn't _very_ hard, but consider
strings in multibyte encodings where a multibyte character may contain a
byte that looks just like an ASCII quote or string...  :-/


> If there is a better concept, please let me know. If you think my solution
> is of generic usage, I will work on my conversion-class to make it more
> pqxx-like.

For what you need, this is a very neat trick and I think it'd be worth
publishing somewhere as an independent add-on.  For libpqxx, I'm afraid
I'll have to plod on with text parsing.

On the bright side, there have been some noises about adding a bit of
support for that to libpq.  That'd save me the trouble.


Jeroen


_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to