Thread: Problems using Postgres-ODBC-Borland BDE

Problems using Postgres-ODBC-Borland BDE

From
"Robert Esser"
Date:

Hello,

first I hope this is the right place to post my question?!

I have developed a windows application with Borland Delphi 5 Enterprise
Edition, BDE 5.11 (Version from 2/2000) and store my date in a postgres
database on a SuSE linux 6.1 server. I got errors in my application when
trying to edit some single records from a big table while most of all where
editable. The BDE error message told me that "this record was used by
another user", but this was nonsense because I was the only user of the
system. Interstingly I could see that this message always was sent by
editing the same records, so it seemed to be a conflict with some data, not
with the table or any user.
Reducing my table to only one record and destroying more and more of the
fields in this table I found the reason. A field of type float8 using 7
decimals (0.51384715) caused the error. When I reduced this value to only 6
digits (manually by exporting, changing the textfile and importing this
record) everything works fine.
What's going wrong? May I not use values with more than 6 decimals or have I
to use another fieldtype or can I configure anything in the database or the
ODBC driver?

-------- My psqlodbc.log file ---------------
conn=60372704,
QLDriverConnect( in)='DSN=PostgreSQL;UID=i;PWD=;DATABASE=scitec;',
fDriverCompletion=0
DSN info:
DSN='PostgreSQL',server='192.168.1.250',port='5432',dbase='scitec',user='',p
asswd=''

readonly='0',protocol='6.4',showoid='0',fakeoidindex='1',showsystable='0'
          conn_settings=''
          translation_dll='',translation_option=''
Global Options: Version='06.40.0006', fetch=100, socket=4096,
unknown_sizes=0, max_varchar_size=254, max_longvarchar_size=8190
                disable_optimizer=1, ksqo=1, unique_index=0,
use_declarefetch=0
                text_as_longvarchar=1, unknowns_as_longvarchar=0,
bools_as_char=1
                extra_systable_prefixes='dd_;', conn_settings=''
conn=60372704, query=' '
conn=60372704, query='set DateStyle to 'ISO''
conn=60372704, query='set geqo to 'OFF''
conn=60372704, query='set ksqo to 'ON''
conn=60372704, query='select oid from pg_type where typname='lo''
    [ fetched 0 rows ]
conn=60372704,
SQLDriverConnect(out)='DSN=PostgreSQL;DATABASE=scitec;SERVER=192.168.1.250;P
ORT=5432;UID=;PWD=;READONLY=0;PROTOCOL=6.4;FAKEOIDINDEX=1;SHOWOIDCOLUMN=0;RO
WVERSIONING=0;SHOWSYSTEMTABLES=0;CONNSETTINGS='
conn=60372704, query='select relname, usename, relhasrules from pg_class,
pg_user where relkind = 'r' and relname !~ '^xinv[0-9]+' and
int4out(usesysid) = int4out(relowner)order by relname'
    [ fetched 70 rows ]
conn=60372704, query='select relname, usename, relhasrules from pg_class,
pg_user where relkind = 'r' and relname like 'angebote_aktiv' and relname !~
'^pg_|^dd_' and relname !~ '^xinv[0-9]+' and int4out(usesysid) =
int4out(relowner)order by relname'
    [ fetched 1 rows ]
conn=60372704, query='select u.usename, c.relname, a.attname,
a.atttypid,t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull from
pg_user u, pg_class c, pg_attribute a, pg_type t where int4out(u.usesysid) =
int4out(c.relowner) and c.oid= a.attrelid and a.atttypid = t.oid and
(a.attnum > 0) and c.relname like 'angebote_aktiv' order by attnum'
    [ fetched 2 rows ]
conn=60372704, query='select u.usename, c.relname, a.attname,
a.atttypid,t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull from
pg_user u, pg_class c, pg_attribute a, pg_type t where int4out(u.usesysid) =
int4out(c.relowner) and c.oid= a.attrelid and a.atttypid = t.oid and
(a.attnum > 0) and c.relname like 'angebote_aktiv' order by attnum'
    [ fetched 2 rows ]
conn=60372704, query='select c.relname, i.indkey, i.indisunique,
i.indisclustered from pg_index i, pg_class c, pg_class d where c.oid =
i.indexrelid and d.relname = 'angebote_aktiv' and d.oid = i.indrelid'
    [ fetched 1 rows ]
conn=60372704, query='SELECT "angebotsnummer" ,"unit_sales_price"  FROM
"angebote_aktiv" ORDER BY  "angebotsnummer" ASC '
    [ fetched 1 rows ]

------------- at this point I started editing the record and got the
errormessage from BDE that this record is used by another user----

conn=60372704, query='SELECT COUNT(*)  FROM "angebote_aktiv" WHERE
"angebotsnummer"=110675 AND "unit_sales_price"=0.513847'
    [ fetched 1 rows ]

-------------
The original and displayed value of "unit_sales_price" is 0.5138471 !
It seems that you loose a decimal by converting floats into strings!

conn=60372704, SQLDisconnect
-------- My psqlodbc.log file ---------------

Please send me some help about using the right fieldtype!
Best regards

Robert Esser
mit Consulting München
mit_consulting@gmx.de