Gary P
Active Member
Hello Listers,
One of my frustrations with JDE is how difficult it is to do a complex SQL command. By complex, I mean it involves the use of an OR statement or uses the same field more than once. Rather than use the built-in method of writing lots of code, I am looking at ways to use an external DLL to communicate directly with the database.
My plan is to create a function that takes in a pointer to a string, and a void pointer that will point to a data structure. The function will take the string (which will be a SQL string our server can interpret) and execute the command. If that string happens to be a select string, the fields from the result record can be saved in the data structure. You cane then call the function again to fetch the next record. It will be the programmer's job to make sure the string has the correct syntax and the data structure can hold all the returned fields in the correct order.
An example of this would be as follows:
-You create a data structure that holds two math numerics.
-You create a SQL string that says "select sdoco, sdlnid from f4211 where doco=12345" (I'm simplifying the SQL statement).
-You call the function and send a void pointer to the data structure as well as a pointer to the string, and any additional parameters to show you're performing the initial call
-The function executes the string, grabs the first record and writes the doco and lnid to the data structure, and fills a pointer to the recordset as well as sending back a success.
-The business function does any processing, and calls the function again with the parameters mentioned above.
-This repeats while the function processes the records obtained
I want to see if this can be done, but I also don't want to reinvent the wheel. Have any of you worked on something like this, and if so, what advice/help can you provide?
Thanks in advance,
Gary Pollock
One of my frustrations with JDE is how difficult it is to do a complex SQL command. By complex, I mean it involves the use of an OR statement or uses the same field more than once. Rather than use the built-in method of writing lots of code, I am looking at ways to use an external DLL to communicate directly with the database.
My plan is to create a function that takes in a pointer to a string, and a void pointer that will point to a data structure. The function will take the string (which will be a SQL string our server can interpret) and execute the command. If that string happens to be a select string, the fields from the result record can be saved in the data structure. You cane then call the function again to fetch the next record. It will be the programmer's job to make sure the string has the correct syntax and the data structure can hold all the returned fields in the correct order.
An example of this would be as follows:
-You create a data structure that holds two math numerics.
-You create a SQL string that says "select sdoco, sdlnid from f4211 where doco=12345" (I'm simplifying the SQL statement).
-You call the function and send a void pointer to the data structure as well as a pointer to the string, and any additional parameters to show you're performing the initial call
-The function executes the string, grabs the first record and writes the doco and lnid to the data structure, and fills a pointer to the recordset as well as sending back a success.
-The business function does any processing, and calls the function again with the parameters mentioned above.
-This repeats while the function processes the records obtained
I want to see if this can be done, but I also don't want to reinvent the wheel. Have any of you worked on something like this, and if so, what advice/help can you provide?
Thanks in advance,
Gary Pollock