pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_field_size
2+ messages / 2 participants
[nested] [flat]
* pg_field_size
@ 2003-01-04 03:05 Kevin Gordon <kgordon@paradise.net.nz>
2003-01-06 18:18 ` Re: pg_field_size David Busby <busby@pnts.com>
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Gordon @ 2003-01-04 03:05 UTC (permalink / raw)
To: pgsql-php
Hi,
I wish to set on screen field sizes by using pg_field_size().
I have been successful with odbc_field_len() connected to Postgres but
wish to convert to pg_ functions.
Problem: all of these fields return -1 (indicating variable length):
CREATE TABLE menu_lines (
systemcode char (2) ,
menuname char (32) ,
menuline char (2) ,
description varchar (32) ,
accesscode char (1) ,
accesstype char (1) ,
programname varchar (32) ,
formatfile varchar (32) ,
With char(2) should pg_field_size() return 2?
odbc_field_len() does return 2!
I am using PHP 4.2.3.
Any comments please.
Kevin Gordon.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pg_field_size
2003-01-04 03:05 pg_field_size Kevin Gordon <kgordon@paradise.net.nz>
@ 2003-01-06 18:18 ` David Busby <busby@pnts.com>
0 siblings, 0 replies; 2+ messages in thread
From: David Busby @ 2003-01-06 18:18 UTC (permalink / raw)
To: Kevin Gordon <kgordon@paradise.net.nz>; pgsql-php
I didn't see any responses so...here goes. I should state that I don't
think this is the most elegant solution. In the PHP script that needs that
size info, query the database first for the table definition, that will give
you field sizes, then use that data to write the field size.
fake code:
$rs = pg_exec($db, "somehow get table definition");
$td = package_rs_into_easy_object($rs);
$td->systemcode // should evaluate to 2
$td->menuname // should evaluate to 32
$rs2 = pg_exec($db, "get the data set");
while (...)
{
...
} //while
/B
----- Original Message -----
From: "Kevin Gordon" <kgordon@paradise.net.nz>
To: <pgsql-php@postgresql.org>
Sent: Friday, January 03, 2003 19:05
Subject: [PHP] pg_field_size
> Hi,
> I wish to set on screen field sizes by using pg_field_size().
> I have been successful with odbc_field_len() connected to Postgres but
> wish to convert to pg_ functions.
> Problem: all of these fields return -1 (indicating variable length):
> CREATE TABLE menu_lines (
> systemcode char (2) ,
> menuname char (32) ,
> menuline char (2) ,
> description varchar (32) ,
> accesscode char (1) ,
> accesstype char (1) ,
> programname varchar (32) ,
> formatfile varchar (32) ,
> With char(2) should pg_field_size() return 2?
> odbc_field_len() does return 2!
> I am using PHP 4.2.3.
> Any comments please.
> Kevin Gordon.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-01-06 18:18 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-04 03:05 pg_field_size Kevin Gordon <kgordon@paradise.net.nz>
2003-01-06 18:18 ` David Busby <busby@pnts.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox