I am writing the plperl script function for my trigger execution. When INSERT / UPDATE happens ,my plperl script will run , in that I am dynamically forming some query based on event I receive. I wanted to print it in terminal when I do insert/update. But it does not happen. Tell me which way i can print it.?
Use the elog function to raise notices. You can also use it to raise full errors.
Related
I want to find the target branch when a pull request is submitted on GitHub, in my Jenkins pipeline. To achieve this I am doing the following:
I am invoking a windows batch file from my Jenkinsfile, which in turn invokes a nodejs script. This script internally invokes GitHub APIs to get the target branch which is to be set on some variable in Jenkinsfile(code snippet given below):
Jenkinsfile
env.TARGET_BRANCH = bat "GetTargetBranchFromGit.bat ${env.BRANCH_NAME}"
BatchFile:
node getTargetBranchForPR.js %1
But unfortunately, the variable env.TARGET_BRANCH is not getting set to the target branch even though the nodejs script gets the right value. I am in fact not able to return the value from the batch file. Could someone please help me here?
#npocmaka mention is the right way: How to do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?
Accodring to Jenkins' documentation.
returnStdout (optional) If checked, standard output from the task is
returned as the step value as a String, rather than being printed to
the build log. (Standard error, if any, will still be printed to the
log.) You will often want to call .trim() on the result to strip off a
trailing newline.
So your code should look like
env.TARGET_BRANCH = bat( script: "GetTargetBranchFromGit.bat ${env.BRANCH_NAME}",
returnStdout: true
).trim()
If you get back more than expected you probably need to parse it.
I've created Oracle trigger which execute external python file through DBMS_SCHEDULER.RUN_JOB() but it executes python file first then insert row into table.I want exactly opposite operation.
CREATE OR REPLACE TRIGGER sample
AFTER INSERT ON client
BEGIN
EXEC DBMS_SCHEDULER.RUN_JOB("JOB CONTAN PYTHON FILE");
END;
Tell me right way to do this
There's a difference between the row(s) being inserted into the table and those rows being visible to another session. Until the data is committed then those inserted rows cannot be seen by any other transaction. If your python code tries to connect to the database to look at those rows, it won't see them.
Equally, your transaction can't report back to the client (in your case SQL Developer) that the insert succeeded until the trigger has completed. In this case it needs to wait until the python call has completed before returning.
Generally triggers are considered 'bad practice', though they do have some good applications. Having a session wait on an external task is also something to avoid. I'd recommend you rethink your approach to whatever you are trying to achieve.
How do you know that?
Think!
you have a table
there's a trigger on that table
trigger fires when you insert data into the table and ...
... calls the Python script
So, how can that script run before inserting a row, if exactly that action - a row being inserted - triggers & runs the Python script?
Unless you prove me wrong, everything should be OK.
1.Validate Line Function
Does this script fire at field level of Line Items OR fire at the record level?
2.Scheduled Script
How to test Performance of a Script? Would debug help or are there any other logs to check on bottlenecks (delays)?
Validate Line fires at the line level, i.e. not until you click "Done" or moving to the next line. Your event handler function can return false to stop the line addition/update from happening, or true to continue normally.
As far as I know, currently the debugger can only be used on User Event scripts. You could do some simple time measurements and log timings throughout your script. Your most likely points of bottlenecks will be anything that goes back to the database (e.g. creating/loading/submitting records, complex searches, etc).
when I try to create arrays in my script I get errors.
id[1]=string2; would generate error id[1]=string2: not found
I'm guessing it has something to do with the fact that im in a if statement or while loop since the use []? I'm running a VM so attached is a pic of the script thus far the array at top a[1]=string; generates no errors but the one in the logic id[1]=string2; does.
Posting as an answer so this question can be marked as resolved:
Your script is being executed by sh, not bash. Add a correct shebang line as the first line of the script file:
#!/bin/bash
On writing to the display with:
::TextOutW( pDC->m_hDC, x, y, &Out, 1 );
It only shows on the screen after every 15 calls (15 characters).
For debugging purposes only, I would like to see the new character on the display after each call. I have tried ::flushall() and a few other things but no change.
TIA
GDI function calls are accumulated and called in batches for performance reasons.
You can call GdiFlush after the TextOut call to perform the drawing immediately. Alternatively, call GdiSetBatchLimit(1) before outputting the text to disable batching completely.
::flushall() is for iostreams, so it won't affect Windows screen output at all. I've never tried it, but based on the docs, I believe GDIFlush() might be what you want. You should also be able to use GDISetBatchLimit(1); to force each call to run immediately upon being called.