ID:               28089
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tony at gigaday dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         PostgreSQL related
 Operating System: Gentoo Linux
 PHP Version:      4.3.4
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PQfsize returns  the  size  in  bytes of the field 
associated with the given field index. If the  size 
returned  is  -1,  the  field  is a variable length 
field.  
The PQfsize() is the underlying function behind  
pg_field_size(). 


Previous Comments:
------------------------------------------------------------------------

[2004-04-21 12:23:43] tony at gigaday dot com

Sorry, I got the actual and expect results in the wrong boxes in the
bug report.  :(

The incorrect value of -1 is the actual returned value.

------------------------------------------------------------------------

[2004-04-21 12:17:37] tony at gigaday dot com

Description:
------------
                                                                       
                             I am unable to get pg_field_size to return
the correct storage size of a field; I have pg_field_num and
pg_field_type working but not pg_field_size.

Reproduce code:
---------------
<?php
//  get fields sizes for currency file $dbconn_str = "host=localhost
port=5432 dbname=pacs user=YYY password=XXXX";
if ( $dbconn = pg_connect($dbconn_str) ) {
  if ( !$db_status = pg_connection_status($dbconn) ) {
    $res = pg_query($dbconn, "select * from ccy limit 1");    
$ccy_code_fnr = pg_field_num($res, "ccy_code");
    $ccy_code_type = pg_field_type($res, $ccy_code_fnr);
    $ccy_code_size = pg_field_size($res, $ccy_code_fnr);
    echo "res:", $res, " code:", $ccy_code_fnr, " type:",
$ccy_code_type, " size:", $ccy_code_size; 
?>

Expected result:
----------------
res:Resource id #3 code:0 type:bpchar size:-1

Actual result:
--------------
res:Resource id #3 code:0 type:bpchar size:6

since psql gives:-

pacs=# \d ccy
            Table "public.ccy"
    Column     |     Type      | Modifiers
---------------+---------------+-----------
 ccy_code      | character(6)  | not null
 ccy_desc      | character(20) |
 ccy_curr_rate | numeric(12,4) |
 ccy_std_rate  | numeric(12,4) |
 ccy_alt_rate  | numeric(12,4) |
Indexes: ccy_pkey primary key btree (ccy_code)
 
pacs=#



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28089&edit=1

Reply via email to