progress 4gl - Static vs dynamic queries in OpenEdge -
question common, let's see pros , cons of each in openedge in terms of code readability, flexibility , performance off course.
static queries:
+ readability: convenient `buffer.field` notation + performance: higher (supposedly, need comments) -/+ "global scope" allows handle used buffers, lead ambiguousness, you'll have clarify table name (table.field instead of field) - flexibility: cannot alternate predicate-expression much, if function not recommended (can affect performance)
dynamic queries:
+ flexibility: can build predicate-expression runtime + flexibility: can work each field not specifying name, f.e. can process fields of record in cycle + flexibility: reusable (need comments on point) +/- "local scope" allows use buffers specified in `set-buffers` method - readability: little more code write - performance: slower (not sure)
additions , corrections welcome. links related read.
a static query's filter condition can changed "on fly" so:
define query q-name table-name. define variable h-qry handle no-undo. h-qry = query q-name:handle. h-qry:query-prepare("for each table-name table-name.field-name = 1").
from here query treated same normal static query.
readability: "buffer-handle:buffer-field("field-name"):buffer-value" construct refers dynamic buffers - it's acceptable use static buffers in dynamic queries (via buffer table-name:handle), dynamic query buffers can used w/static buffers , it's not necessary de-reference field using it's handle.
performance: last time did comparison, dynamic queries slower static queries same query condition. upside they're more flexible static queries.
reusability: once dynamic query's buffer structure has been set, afaik, can't changed. can re-opened new filter condition same static query though.
Comments
Post a Comment