Subject Re: [IBO] TIBOTable and field names that require quoting.
Author mspencewasunavailable
--- In IBObjects@yahoogroups.com, "mspencewasunavailable"
<firebird@...> wrote:
>
> --- In IBObjects@yahoogroups.com, Geoff Worboys <geoff@> wrote:
> >
> > Hi Michael,
> >
> > ...
> > > But the SQL generated doesn't account for the quoting on
> > > the fields
> > ...
> > > SELECT ALL SCHED$.*
> > > FROM SCHED$
> > > WHERE SCHED$."Acc ID" = ? /* Acc */ ID
> > > AND SCHED$."Serv ID" = ? /* Serv */ ID
> > > ORDER BY SCHED$."Acc ID" ASC
> > > , SCHED$."Serv ID" ASC
> >
> > What release of IBObjects?
> >
> > I hit a similar problem and Jason has fixed it in the 4.6A
> > release of IBO. So I am wondering whether that fix will have
> > solved your problem or not. I have some quite similar
> > queries in my apps (using TIB_* components, not TIBO*
> > components) and have not hit the problem again since 4.6A.
> >
> > --
> > Geoff Worboys
> > Telesis Computing
> >
>
> D'OH!
>
> 4.6.B, according to the Object Inspector, but now that you mention
> it, this isn't a pristine version. There were a host of other
> problems which were solved by some patches I got from another
poster
> (Ramil [khabibr@...]) who said he'd sent them directly to Jason,
> but that Jason was away at the time. See this message: "Re[2]:
> [IBO] Quoted fields seem to be broken in TIBODataset when
they're
> involved in indexing" around 7/31/2006. I had to apply these to
get
> anywhere at all. While they look like fairly extensive patches, a
> diff shows that they're actually only a couple of lines in a
couple
> of places. If it's helpful, I can produce a diff for you between
> the released source and what I'm using.
>
> I'd be surprised if these patches had any affect on the SQL that
> gets generated when a master dataset is used (although I've
> certainly been surprised before). I do have to apologize for the
> fact that I'd forgotten that I was using a patched version but
> without the patches, most of my code won't run at all. I was
really
> hoping they'd be included in a future version. Tomorrow, I'll try
> to make time to see if I can get a little more info and maybe work
> up a patch for the problem instead of just working around it. I'm
> betting it's not a big deal.
>
> Michael D. Spence
> Mockingbird Data Systems, Inc.
>

Here are the differences:

In IBODataset.pas:
132c132
< IBODataset_orig;
---
> IBODataset;
4664c4664,4667
< Result := FindField( tmpCol.FieldName );
---
> // Orig
> // Result := FindField( tmpCol.FieldName );
> // My change
> Result := FindField( tmpCol.BDEFieldName );
5511c5514,5519
< Result := InternalDataset.SQLOrderLinks.LinkIndex[
Field.FieldName ] >= 0;
---
> // Orig
> // Result := InternalDataset.SQLOrderLinks.LinkIndex[
Field.FieldName ] >= 0;
> // Ramil's change
> Result := InternalDataset.SQLOrderLinks.LinkIndex[
> InternalDataset.Fields[Field.FieldNo - 1].FieldName ] >= 0
>

In IB_Components.pas

124c124
< IB_Components_orig;
---
> IB_Components;
30194c30194,30203
< tmpItem := Trim( GetCharValues( BDataset.SysFieldNames
[tmpCol.FieldNo] ))
---
> // Orig
> // tmpItem := BDataset.SysFieldNames[tmpCol.FieldNo];
> // Ramil's Change
> begin
> tmpItem := BDataset.SysFieldNames[tmpCol.FieldNo];
> if not IsLitCriteria( tmpItem, '"' ) then
> tmpItem := GetCharValues( tmpItem );
> tmpItem := Trim( tmpItem );
> end
> // End Ramil's Change


As you can see, they're fairly minor.