Re: [INTERFACES] pgaccess 0.86
От | Jose' Soares Da Silva |
---|---|
Тема | Re: [INTERFACES] pgaccess 0.86 |
Дата | |
Msg-id | Pine.LNX.3.96.980526163645.3157A-100000@proxy.bazzanese.com обсуждение исходный текст |
Ответ на | Re: [INTERFACES] pgaccess 0.86 ("Jose' Soares Da Silva" <sferac@bo.nettuno.it>) |
Список | 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_typewhere (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_typewhere (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'
В списке pgsql-interfaces по дате отправления: