× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Sun, Mar 18, 2018 at 8:22 AM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

Well, SQL inside the JS.
It's how I'd do it with RPG too.


I'll restate that the context for my question was Aaron Bartell's advise to
move away from RPG and implement foreign-key validation in Node.js, using
JavaScript. Given that RPG is off the table in this context, the JavaScript
would obviously invoke SQL statements to check for the existence of
foreign-key relationships.

If I understand the Node event loop and db2 interface correctly, then each
invocation of an SQL statement in Node.js would register a callback to
another JavaScript function, which would be invoked in a later cycle of the
event loop, perhaps 1 to 3 event-loop cycles later, after the results of
the SQL statement have been returned from the database.

I envision an iterative process flow in Node.js that would flow much
differently than how a comparable RPG procedure would work. Correct me if
I'm mistaken, but I envision a Node.js process-flow like the following:

step 1: check foreign-key relationship #1 and callback step 2.
step 2: check foreign-key relationship #2 and callback step 3.
step 3: check foreign-key relationship #3 and callback step 4.
step 4: check foreign-key relationship #4 and callback step 5.
step 5: check foreign-key relationship #5 and callback step 6.
step 6: check foreign-key relationship #6 and callback step 7.
step 7: check foreign-key relationship #7 and callback step 8.
step 8: check foreign-key relationship #8 and callback step 9.
step 9: return success message to client.

Each step might return an error message instead of invoking the next step.

Depending on number of events that might occur in the event loop, Node.js
might require from 9 to some larger number event cycles before returning a
message to a client. Am I the only one here who sees advantages to calling
an RPG procedure to perform the validation? Just consider the overhead of
repetitive db2 connect=>run SQL=>disconnect cycles.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.