mysql_field_name equivalent

Поиск
Список
Период
Сортировка
Искать

mysql_field_name equivalent

От:
"Mace, Richard" <richard.mace@Lorien.co.uk>
Дата:
Is there a PostgreSQL equivalent command to the mysql_field_name command above?

I am running a select query (7.2) and would like to get the name of the columns I am selecting
too, in order to output a header line to an external file, with the result of the select.

Has anyone done this or similar?

Thank you.

Richard Mace



**********************************************************************
The information contained in this email is confidential and is intended for the recipient only. If you have received it in error, please notify us immediately by reply email and then delete it from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person or store or copy this information in any medium. The views contained in this email are those of the author and not necessarily those of Lorien plc.

Thank you for your co-operation.
**********************************************************************

Re: mysql_field_name equivalent

От:
Michael Glaesemann <grzm@myrealbox.com>
Дата:

On Dec 31, 2003, at 5:59 AM, Mace, Richard wrote:
> I am running a select query (7.2) and would like to get the name of 
> the columns I am selecting
> too, in order to output a header line to an external file, with the 
> result of the select.

I'm not familiar with the mysql command mentioned, but just using \o 
and specifying a file in psql does what it sounds like you want. 
Specify the file using:
\o /path/to/results.txt

The result of every query entered through psql will appear in the file 
just as it would otherwise in psql, complete with column headings. 
There are ways to specify the delimiter (e.g., tabs rather than 
spaces), or the border (and other options as well) using /pset

Does this help?

Michael Glaesemann
grzm myrealbox com

Re: mysql_field_name equivalent

От:
CoL <col@mportal.hu>
Дата:
Hi,

Mace, Richard wrote, On 12/31/2003 12:59 PM:

> Is there a PostgreSQL equivalent command to the mysql_field_name command above?
> 
> I am running a select query (7.2) and would like to get the name of the columns I am selecting
> too, in order to output a header line to an external file, with the result of the select.
> 
> Has anyone done this or similar?

you probably want this from php. Better to use, ask at 
comp.databases.postgresql.interfaces.php for php related questions.

try the php documentation and check: pg_field_name

C.
FAQ