On 20 Jan 2005, Dmitry Karasik wrote:

> On 18 Jan 05 at 14:30, "Rudy" (Rudy Lippan) wrote:
> 
>  Rudy> Do a recursive traversial of the array and turn it into a string
>  Rudy> with elements surrounded with '"'s and separated by ','s, with
>  Rudy> dementions delimited by '{}' pairs and separated by ','s.  And of
>  Rudy> course, you have to escape " that are already in the string and then
>  Rudy> do a final pass with standard postgres string quoting -- but you can
>  Rudy> let the bind_param() call do this last pass.
> 
> Thank you, that worked. The only thing troubles me a bit is that you said
> it is a hack. So then, what whould you recommend as

I said that there was a patch/hack to the driver that caused DBD::Pg to try and
serialize arrays for you, which might be why your old DBD::Pg was able to
serialize the arrays, but that patch never made it into an official release
because it put the arrary serialization code in the wrong section of
bind_param(), and it made its decision based on seeing an arrayref (all well and
good, but how do you know that an array ref is a ref to a standard array and not
a polygon, for example).

> a non-hack (kind of a 'best practice') method here? If I understand
> correctly, after you release the new version, bind_param(":array_column")
> will be the preferred way to bind arrays, but what is it for now?

For now, the best way is to serialize the array yourself. Once the new version
comes out, you can do it either way, but I'd let the driver handle as much
quoting as I could.


Rudy

Reply via email to