[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Newbie questions about dynamic query preparation in ABL

  • Thread starter Thread starter Jon Brock
  • Start date Start date
Status
Not open for further replies.
J

Jon Brock

Guest
I haven't seen this suggested yet, though I may have missed it: Put your 200 primary keys into a temp-table and add that to the dynamic query. DEFINE TEMP-TABLE ttTest NO-UNDO FIELD SomeKey AS CHARACTER. CREATE ttTest. ASSIGN ttTest.SomeKey = "xxx". CREATE ttTest. ASSIGN ttTest.SomeKey = "yyy". DEFINE VARIABLE hQuery AS HANDLE NO-UNDO. CREATE QUERY hQuery. hQuery:ADD-BUFFER(BUFFER ttTest:HANDLE). hQuery:ADD-BUFFER(BUFFER patron:HANDLE). hQuery:QUERY-PREPARE("for each ttTest, each patron no-lock where patron.patronid = ttTest.SomeKey and patron.deleted = 0"). hQuery:QUERY-OPEN(). REPEAT WHILE hQuery:GET-NEXT(): DISPLAY patron.patronid. END. BTW normally I do a DO WHILE, I used REPEAT just so the DISPLAY would show all the values instead of the last value. Also, watch out for the QUOTER function. It is incomplete. You need to sanitize user inputs for things like tilde and backslash. Also be sure to use it for all values, not just character values.

Continue reading...
 
Status
Not open for further replies.
Back
Top