Consultor Eletrônico



Kbase P117592: Modfying an SDO query with addQueryWhere results errors 277, 247 and 7324.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/28/2006
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.1A

SYMPTOM(s):

Modifying an SDO query with addQueryWhere results errors 277, 247 and 7324.

Error 277, 247 and 7324 with addQueryWhere in OpenEdge 10.1A

** Phrase or option conflicts with previous phrase or option. (277)

** Unable to understand after -- "salesrep = BBB". (247)

PREPARE syntax is: {FOR | PRESELECT} EACH <buf> OF.. WHERE ... etc". (7324)

stack trace is:

icfstart.p (d:\progress\101A\gui\dynamics\icfstart.r) at line 519
initializeSession d:\progress\101A\gui\dynamics\af\app\afxmlcfgp.r
(d:\progress\101A\gui\dynamics\af\app\afxmlcfgp.r) at line 2569
startProcedure d:\progress\101A\gui\dynamics\af\app\afxmlcfgp.r
(d:\progress\101A\gui\dynamics\af\app\afxmlcfgp.r) at line 4404
D:\progress\101A\gui\_ab.r (D:\progress\101A\gui\_ab.r) at line 426
adeuib/_uibmain.p (adeuib/_uibmain.r) at line 17816
USER-INTERFACE-TRIGGER adeuib/_uibmain.p (adeuib/_uibmain.r) at line 5055
choose_run adeuib/_uibmain.p (adeuib/_uibmain.r) at line 8646
call_run adeuib/_uibmain.p (adeuib/_uibmain.r) at line 5712
launch_object adeuib/_uibmain.p (adeuib/_uibmain.r) at line 11875
processEventProcedure adm2/visual.p (D:\progress\101A\gui\adm2\visual.r) at line 4742
OpenChoose sports/super/joinviewvsupr.p (.\sports\super\joinviewvsupr.r) at line 1418
reOpen sports/super/joinviewvsupr.p (.\sports\super\joinviewvsupr.r) at line 1768
openQuery adm2/data.p (D:\progress\101A\gui\adm2\data.r) at line 30210
openQuery adm2/query.p (D:\progress\101A\gui\adm2\query.r) at line 16301
--> prepareQuery adm2/query.p (D:\progress\101A\gui\adm2\query.r) at line 16593

An SDO query is defined with a USE-INDEX statement before a WHERE clause. For example:


FOR EACH Order USE-INDEX salesrep WHERE order.salesrep = 'BBB',
EACH customer OF order,
EACH salesrep OF order".

The poroblem cannot be reproduced in OpenEdge 10.0B

CHANGE:

Upgrade from OpenEdge 10.0B to OpenEdge 10.1A

CAUSE:

This is a known issue being investigated by Development

The problem is in the bufferWhereClause function in dataview.p. There is a section of code that determines where the new clause is to be added. But the problem is this code assumes any USE-INDEX clause will be after any WHERE clause.

FIX:

The code in the bufferWhereClause function is:

ASSIGN
iByPos = INDEX(cFoundWhere," BY ":U)
iUseIdxPos = INDEX(cFoundWhere," USE-INDEX ":U)
iIdxRePos = INDEX(cFoundWhere + " ":U," INDEXED-REPOSITION ":U)
iOptionPos = MIN(IF iByPos > 0 THEN iByPos ELSE LENGTH(cFoundWhere),
IF iUseIdxPos > 0 THEN iUseIdxPos ELSE LENGTH(cFoundWhere),
IF iIdxRePos > 0 THEN iIdxRePos ELSE LENGTH(cFoundWhere)).

To work around the problem add a iWherePos integer variable and replace the code with:

ASSIGN
iByPos = INDEX(cFoundWhere," BY ":U).
iWherePos = INDEX(cFoundWhere," WHERE ":U).
iUseIdxPos = INDEX(cFoundWhere," USE-INDEX ":U).
iIdxRePos = INDEX(cFoundWhere + " ":U," INDEXED-REPOSITION ":U).
iOptionPos = MIN(IF iByPos > 0 THEN iByPos ELSE LENGTH(cFoundWhere),
IF (iUseIdxPos > 0 AND iUseIdxPos > iWherePos) THEN iUseIdxPos ELSE LENGTH(cFoundWhere),
IF iIdxRePos > 0 THEN iIdxRePos ELSE LENGTH(cFoundWhere)).