Well, I came across this post in google groups. I did further research on my own desks and wanted to share a table of information that I created, inspired by the work already done.
Each query can occupy several rows in the table.
A string with attribute 0 is the beginning of the request.
A line with attribute 1 indicates the type of request.
- Flag value 1 = SELECT query.
- Flag value 2 = query SELECT ... INTO or query table make. Name1 will have the name of the created table.
- Flag value 3 = INSERT request; Name1 will have the name of the table to insert.
- Flag value 4 = UPDATE query
- Flag value 5 = DELETE request
- Flag value 6 = crosstab query (TRANSFORM)
- Flag value 9 = UNION request
Lines with attribute 2 (there may be several) are formal request parameters. The Flag column indicates the data type (ie, "10" for dbText), and the Name1 column indicates the parameter name. If there are no rows with attribute 2, the request has no formal parameters.
A line with attribute 3 indicates the presence of the keywords UNION or DISTINCT.
- Flag value 0 = nothing special
- Flag value 1 = UNION ALL
- Flag value 2 = SELECT DISTINCT
- Flag value 3 = UNION
- Flag value 8 = SELECT DISTINCTROW
- Flag value 9 = Queries by main fields and child fields
A row with attribute 4 indicates whether the query is coming from an external database. Name1 will contain the source if attribute 4 exists.
Rows with attribute 5 (maybe several) indicate each table found in the query. If the query is a UNION query, the Expression field is partitioned by the UNION keyword, and the Name2 field has a table alias generated by the system. For all other tables in the query, Name1 is the name of the table, and Name2 is the alias, if any.
Lines with attribute 6 (maybe several) indicate each individual field or expression in the query. If the request does not have attribute 6, it is assumed that all fields are included. The Expression field contains each field expression or name, and Name1 contains the alias of the field, if any.
- Flag value 0 = Field or expression value
- Flag value 1 = The field is the column heading in the crosstab query.
- Flag value 2 = Field is the row header in the crosstab query.
Lines with attribute 7 (maybe several) indicate each individual expression "ON". The Expression field contains the actual union expression. Name1 contains the first table in the join. Name2 contains the second table in the join.
- Flag Value 1 = Internal Connection
- Flag value 2 = left join
- Flag Value 3 = Right Connection
A line with attribute 8 contains the entire WHERE clause in the Expression field. If the where clause is missing, attribute 8 is not specified in the request.
Lines with attribute 9 (there may be several) indicate each individual Group By expression in the GROUP BY clause of the query. The Expression field contains each group by expression.
- Flag value 0 = Field or expression value
- Flag value 1 = The field is the column heading in the crosstab query.
- Flag value 2 = Field is the row header in the crosstab query.
Lines with attribute 11 (there may be several) indicate each Order By expression in the ORDER BY clause of the query. The Expression field contains each order by expression. Name1 has a "D" or "d" to indicate that sorting is performed in descending order.
The line with attribute 255 is the end of the request.
I'm not quite sure what the Order field does, but I found that it is not Null, and although sometimes it has an empty string value, it does not always have this value. Blank lines are found in attributes 5, 6, 7, and 9, but this is not always an empty string for these attributes.