Skip site navigation (1) Skip section navigation (2)

How to parse data type array columns?

From: Janning Vygen <vygen(at)gmx(dot)de>
To: pgsql-php(at)postgresql(dot)org
Subject: How to parse data type array columns?
Date: 2005-08-16 08:04:07
Message-ID: 200508161004.07400.vygen@gmx.de (view raw or flat)
Thread:
Lists: pgsql-php
Hi,

if you use array data type in your database design and query your tables with 
PHP you get a string which represents the array. It can look something like 
this:

[1:2]{{"Hallo", "Te\"st},"},{"Hallo", "Test"}}

It can even have another delimiter than "," if you change the type delimiter.

Has anybody already written a function to parse this array into an php array 
structure? A simple explode doesn't work of course. The list offers a too 
simple explode(",", ereg_replace("{[-]}", $string)). this works only with one 
level and numeric types.

Has anybody already written a recursive function to parse the array string?

kind regards,
Janning

Responses

pgsql-php by date

Next:From: Christopher Kings-LynneDate: 2005-08-16 08:42:53
Subject: Re: How to parse data type array columns?
Previous:From: operationsengineer1Date: 2005-08-16 02:19:02
Subject: Re: Problem about connecting PostgreSQL through TCP/IP

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group