Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/AddOn/Interbase components    [ Add a report in this area ]  
Report #:  102367   Status: Closed
Error in Persisted Aliased Field Detection
Project:  Delphi Build #:  16.0.4316.44803
Version:    16.2 Submitted By:   Lee Danby
Report Type:  Issue Date Reported:  1/5/2012 4:01:22 AM
Severity:    Extreme corner case Last Updated: 9/15/2012 4:39:03 AM
Platform:    All platforms Internal Tracking #:  
Resolution: Test Case Error (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Delphi cannot detect numeric persisted fields if you use a sub-select or alias a field.

The error appears to be in IBCustomDataSet and got added when the column order bug was fixed. Sadly, this was added.

Line 3119

if (FieldCount > 0) and
  (Fields.FieldByName(String(sqlname)) is TFloatField) then
SQLName returns the underlying field name, in the example "QTY", but for a subselect it is completely blank.

Changing the code to the following, appeared to fix the issue, but there may be more instances of this.

if (FieldCount > 0) and Assigned(Fields.FindField(String(aliasname))) and
  (Fields.FieldByName(String(aliasname)) is TFloatField) then
Steps to Reproduce:
Make test database.

create table test (qty numeric(18,6))

Add TIBDatabase, TIBTransaction, TIBQuery to a VCL Form, point them at the database.
Double click the query and select Add Fields... then add the ALIASQTY field. Selecting Add All Fields also falls over with the error.
Add a button that runs IBQuery1.Open;

Error EDatabaseError IBQuery1: Field 'QTY' not found

This also happens when using sub-SELECTs in queries, so removing the aliases isn't a valid workaround.

Tomohiro Takahashi at 1/5/2012 5:54:22 AM -
What version of InterBase do you use, for example InterBase XE2 Update 3?
and, could you please attach sample project(including sample database file) to reproduce your issue?

> Version: 16.2
> Build No: 16.16?
What update version of Delphi XE2 do you use, for example Update 2 or Update 3?

Lee Danby at 1/5/2012 6:44:49 AM -
I can't add an attachment to this so I have uploaded it here.

Tomohiro Takahashi at 1/5/2012 5:54:09 PM -
Please use Windows Native QC client to attach a .zip file to your existing report.
The standalone client comes with Delphi.

Lee Danby at 1/6/2012 8:19:00 AM -
OK, done

Lee Danby at 1/5/2012 6:33:29 AM -
Firebird 2.1, rather than Interbase. This is quite a large project build on the IBX components, so there's no way we can move it to something else now.

It's on XE2 Update 2 at the moment, but I saw no info on this issue in the patch notes for Update 3.

Tomohiro Takahashi at 1/5/2012 5:55:07 PM -
> Firebird 2.1, rather than Interbase.
As you know, IBExpress does NOT support Firebird.

Does your issue occur with InterBase?

and, what update version of Delphi XE2 do you use, for example Update 2 or Update 3?

Lee Danby at 1/6/2012 8:20:47 AM -
Yes, I'm aware. We do not use Interbase and have no version available to test.

It is Update 2.

Server Response from: ETNACODE01