Hey, more BDE hate!

[prev] [thread] [next] [lurker] [Date index for 2004/03/22]

From: Phil!Gregory
Subject: Hey, more BDE hate!
Date: 21:37 on 22 Mar 2004
So thoroughly fed up with Delphi and the BDE at the moment.  Possibly also
Client Access--I'm not sure where the hate truly belongs.

Programming in Delphi 5, using the BDE, accessing tables via the ODBC
driver in Client Access to get to an AS/400.  A little while back, the DBA
created a ten digit numeric field to use as a key on several tables.  The
most significant digit of the field indicates the source of the number (1
if site a generated it, 2 if site b did, and so on).  It worked when only
two locations were generating values.  (See where this is going?)

When we added a third site, everything broke.  3E9 is larger than 2^31.
I'd been using signed integers in Delphi to hold the value of the field.
I switched to using Int64s.  Everything broke again, but in different,
more subtle ways.

TTable.FindKey doesn't work if you hand it an Int64 value.  It's not a
type it looks for, so it causes an error.  TDataSet.Locate (and other,
similar methods) doesn't work, because Int64 is the *only* type that
cannot be put into a Variant.  Using SQL to find a record worked some of
the time, but sometimes spun the program off into a series of access
violations deep in the bowels of the BDE code.

I tried telling the program that the field was really a String, not an
Integer.  Didn't work.  Base field type is provided by the underlying
database driver.  Client Access said it was numeric, so it was numeric.

I tried Googling for information to see if this was a known problem, to
see if maybe it worked better in newer released of Delphi.  No
information.  As far as I can tell, no one has run into this problem
before (which is pretty unlikely).

The solution was to alter all of the tables that had the offending field,
fix the values of those fields to be 9 digits, change the Delphi program
back, recompile all of the programs on the AS/400 that used the affected
tables, and erase all thought of ever again using an Int64 for database
access in Delphi.  Simple, no?

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
PC: You don't need to see my identification.
GM: Which Force power were you using ?
PC: Er...optimism...
                       -- Famous Last Words, #860
---- --- --

Generated at 14:02 on 01 Jul 2004 by mariachi 0.52