Re: [INTERFACES] pgaccess 0.86

From: "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it>
To: interfaces postgres <pgsql-interfaces(at)postgreSQL(dot)org>
Cc: Constantin Teodorescu <teo(at)flex(dot)ro>
Subject: Re: [INTERFACES] pgaccess 0.86
Date: 1998-05-26 17:00:23
Message-ID: Pine.LNX.3.96.980526163645.3157A-100000@proxy.bazzanese.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Mon, 25 May 1998, Jose' Soares Da Silva wrote:

> The size lenght is stored in field "attlen" for types other than VARCHAR
> and BPCHAR. In this case "attlen" = -1 and size lenght+4 is stored in
> field "atttypmod".
>
> Here a bug fix:
> -------------------------------------------------------------------------------
> 2423 proc {show_table_information} {tblname} {
> 2424 global dbc tiw activetab indexlist
> 2425 set tiw(tablename) $tblname
> 2426 if {$tiw(tablename)==""} return;
> 2427 Window show .tiw
> 2428 .tiw.lb delete 0 end vvvvvvvvvvvvvvvvvvvvvvvvvvv
> 2429 .tiw.ilb delete 0 end > field atttypmod >
> 2430 set tiw(isunique) {} > contains lenght >
> 2431 set tiw(isclustered) {} > for VARCHAR and BPCHAR >
> 2432 set tiw(indexfields) {} vvvvvvvvv
> 2433 pg_select $dbc "select attnum,attname,typname,attlen, atttypmod, usename,pg_class.oid from pg_class,pg_user,pg_attribute,pg_type where (pg_class.relname='$tiw(tablename)') and (pg_class.oid=pg_attribute.attrelid) and (pg_class.relowner=pg_user.uses
ys
> id) and (pg_attribute.atttypid=pg_type.oid) order by attnum" rec {
> 2434 set fsize $rec(attlen)
> 2435 set ftype $rec(typname)
> 2436 if {$fsize=="-1"} { <- if (attlen > 0) then
> 2437 set fsize $rec(atttypmod) <- LENGHT = attlen
> 2438 incr fsize -4 <- else
> 2439 } <- LENGHT = attypmod - 4
> 2440 if {$ftype=="text"} {
> 2441 set fsize ""
> 2442 }
> -----------------------------------------------------------------------------

I created a table with all data types to know the behavior of all data types
and I see there are some types with attlen and atttypmod both equal to -1
therefore for these types we don't have the size:
. text
. varchar (defined without size)
. bpchar (defined without size)
. bytea
. path
. polygon
I correct pgaccess.tcl as following:

<DELETED>
2423 pg_select $dbc "select attnum,attname,typname,attlen,atttypmod,usename,pg_class.oid from pg_class,pg_user,pg_attribute,pg_type where (pg_class.relname='$tiw(tablename)') and (pg_class.oid=pg_attribute.attrelid) and (pg_class.relowner=pg_user.usesysid
) and (pg_attribute.atttypid=pg_type.oid) order by attnum" rec {
2424 set fsize $rec(attlen)
2425 set fsize1 $rec(atttypmod)
2426 set ftype $rec(typname)
2427
2428 if { $fsize=="-1" && $fsize1!="-1" } {
2429 set fsize $rec(atttypmod)
2430 incr fsize -4
2431 }
2432
2433 if { $fsize1=="-1" && $fsize=="-1" } {
2434 set fsize ""
2435 }
2436
2437 if {$rec(attnum)>0} {.tiw.lb insert end [format "%-33s %-14s %-4s" $rec(attname) $ftype $fsize]}
2438 set tiw(owner) $rec(usename)
<DELETED>
-------------------------------------------------------------------------
...and now it pgaccess.tcl works with all PostgreSQL data types.
Jose'

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ken J. Wright 1998-05-26 17:59:22 Borland BDE / blank table names
Previous Message David Hartwig 1998-05-26 15:46:26 Re: [ADMIN] pgsql-interfaces ODBC???