Subject Re: [ib-support] InterBase and PHP
Author Helen Borrie
At 11:25 AM 10-10-01 +0200, you wrote:
>I have some tables which are connected via foreign keys (at least somehow).
>The Query looks like so:
>SELECT DISTINCT inhalt.Bezeichnung AS bez1, body.bezeichnung AS bez2
>FROM Feldinhalt, namen, inhalt, body WHERE
>namen.GID=1 AND
>Feldinhalt.maschine=namen.nummer AND
>inhalt.InhaltsID=feldinhalt.inhalt AND
>ORDER BY body <----
>It looks for all entries in table namen where GID=1 that are listed in table Feldinhalt. The problem is I'm not interested in the content of the tables name or feldinhalt but in the content of the tables inhalt and body.
>Surely, it's strange but when I enter this query in the InteractiveSQL-Window of the IBConsole I get an acceptable result. When I query using PHP I get an error from the operating system (WinNT, IIS). It somehow tries to access a false memory address and crashes. It interestingly only happens with this query. (I luckyly only noticed it with this query)
>Has someone experienced something like this?
>I wonder why to reformulate the query if it works in the console window? (btw. how to reformulate?)
The thing to note is that there is no identifier for this order-by criterion ~~ ambiguous (if a field name) or invalid (if referring to the table name body).

What kind of a "crash" do you see? Does the same thing happen if you omit the ORDER BY clause?

I don't know why IBConsole is more tolerant of the ambiguity - perhaps its parser is somehow laundering your statement before passing it to the API. If you are using a Borland distribution of IB 6 or an older Firebird build, the ambiguity is tolerated (a bug that has been fixed in the latest FB builds) but perhaps the PHP driver won't tolerate it...


All for Open and Open for All
InterBase Developer Initiative ยท