Menu

#32 BCD Fields in Postgres

open
nobody
None
5
2008-10-22
2008-10-22
No

I have querys that get FMTBCD (like numeric(11,2)) fields that look like this:

SELECT NumericField
FROM Table
WHERE KeyField = :Value

When I execute this type of query some times (usually more than 1) *and* the result set is not
empty, I randomly start getting Access Violations everywhere in my code.
When all BCD fields are removed from the query, it works perfectly.
Other weird thing that apparently makes the problem disappear is to do something like this:

SELECT Cast('dummy' as varchar(20)) as dummy1,
NumericField,
Cast('dummy' as varchar(20)) as dummy2
FROM Table
WHERE KeyField = :Value

I´m using a Postgres 8.3.4 server with a UTF8 database with ODBC driver psqlodbc_08_03_0200. I'm connecting to it using Delphi 2007. My ODBC DataSource is configured to PostgreSQL Unicode as shown in the attachment.
Other connection options:

DriverName=PostgresODBC
GetDriverFunc=getSQLDriverODBCW
LibraryName=dbxoodbc.dll
VendorLib=psqlodbc35w.dll
DriverUnit=DBXDynalink
DriverPackageLoader=TDBXDynalinkDriverLoader
DriverPackage=DBXCommonDriver110.bpl
DbxWOterroRBase TransIsolation=ReadCommited
RowsetSize=1
BlobSize=-1
Trim Char=True
Custom String=coLockMode=-1;coCatalog=0;coMapInt64ToBcd=1;coMapCharAsBDE=1

Discussion

  • Mozart Hasse

    Mozart Hasse - 2008-10-22

    ODBC configuration

     
  • Vadim V.Lopushanskiy

    Need debug "function TSqlCursorOdbc.getBcd".
    For debug need added to project DbxOpenOdbcStatic.pas

     
  • kurisu810

    kurisu810 - 2009-08-10

    Can you try using the "coEnableBCD=0" custom option. This will disable usage of BCD fields and it will instead use TFloatField.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.