You need to sign in to do that
Don't have an account?
THuston
SOQL From Syntax BNF question
I'm writing a parser that will extract Fields and Sobjects from a SOQL query.
I have a question about the syntax.
The BNF lists:
'FROM' UNQUALIFIEDNAME ('AS' ? UNQUALIFIEDNAME)? ('USING' UNQUALIFIEDNAME)? (PARENT_ALIAS_EXPR)*
What does the optional USING do, and look like in a query?
I can't find it in any SQL or SOQL docs and I need to be able to resolve any alias names back to the true SObject so I can get the Field's Type.
Not sure where you got that BNF; the API docs on SELECT has the following pseudo-BNF:
Sorry, should have put up the link to the BNF over in Integration - API
The API doc is equally confusing as it does not show a full description of the syntax.
I think the BNF was from an earlier API version or was modified from some other SQL's BNF.
This valid SOQL query cannot be generated from the posted BNF:
SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Opportunity )
I also think the API doc was made by someone who didn't care.
wtf is that? It is certainly not a description of valid syntax.
I've found this to be valid for the 'objectType' clause:
SELECT act.name, act.id, status, ccon.lastname FROM case as cs, case.account act, cs.contact ccon
I've never found the 'AS' modifier used anywhere in the API doc. But it is valid, so I have to account for it.
I'm being forced to parse SOQL text and I can't find a description or examples of all the possible variations.