toraclescript data to a datasource

wftjeremy

Member
I want to be able to have a memo that it's lines are assigned to a toraclescript, then executed. The none select commands work fine and I am happy with the output, but if there is a select statement in there I want the data to come into a dataset and then into a DBgrid. The only thing I can think of doing is parsing the commands, looking for a select statement then skipping that in the oraclescript and moving it to an oracledataset. And I am not sure how to do that.

Help?
 
Maybe you can use the TOracleScript.OnData event to access the data of each record (through the Query poroperty) and pass it to a memory dataset?

Declaration
property OnData: procedure(Sender: TOracleScript) of object;

Description
This event fires for each row that is fetched for a select statement. You can use the CurrentCommand property to access the properties of the current command. You can use the Query property to access the field data of the current record.

------------------
Marco Kalter
Allround Automations
 
I did that, kind of. I used the ONCOMMAND event instead. I was hoping to avoid the following:

I pass the query off to a toracledataset and run and am able to get all everything I want. BUT the toraclescript is still processing the SQL, therefor the query is running twice when it doesn't need to be.
The documentation says "If you set the Handled parameter to True, you indicate that you have handled this command. As a result, the command will subsequently not be processed internally."

But, it still executes. The snippet of code

FirstWord := UpperCase(Sender.CurrentCommand.Words[0]);
if FIRSTWORD = 'SELECT' THEN HANDLED := TRUE;

Basically I see if it uses SELECT, if it does I don't want the toraclescript to process the query, I set handled then continue on with pushing it out to toracledataset. Which works... if I could only stop the toraclescript from running the query my little app would be done.

Originally posted by mkalter:
Maybe you can use the TOracleScript.OnData event to access the data of each record (through the Query poroperty) and pass it to a memory dataset?

 
For my OnData alternative you would let the TOracleScript execute the query, passing the resulting data to a memory dataset. This would lead to just 1 query execution.

Your alternative should also work though, and is probably better. I did a little test, and it seems to work just fine. The query is not executed by the TOracleScript. Note that there was a fix in 3.4.4 for a bug that could cause this problem. If you are using 3.4.3 or earlier, you should upgrade.

------------------
Marco Kalter
Allround Automations
 
Back
Top