How to determine which stored procedure called another procedure? - firebird

I have some procedures that calls another procedure with different parameters. Is there a way in that procedure to know who called it? Some kind of stacktrace...

I would recommend finding a cleaner way to solve what are you trying to solve, like passing extra parameter to identify what you need to.
Anyway you can use MON$CALL_STACK to get, probably, what you're looking for.

Related

Get the results of a flow into a global variable

I have a flow in my Talend job that returns just one value (one row with one column), and I want to store this value in a global variable. What is the best way to do it? So far I have been using tFlowToIterate in this scenario, but this seems like a hack - because I really do not need to iterate. I'm wondering if there are better alternatives.
there is different solutions personnaly I also use the tFlowToIterate method but you can also use the tJava components or juste use the tSetGlobalVar component which is the component use in this case (one row).
Here is how to use it :
I hope this answers your question :)

How do I specify the User-Defined Table Type for a property with Insight Database

I have a pretty simple stored procedure to just update the status value for a bunch of records. I send in an unknown value of record IDs and it works.
I love using Insight.Database and wouldn't want to use anything else if possible.
The problem is our DBA's created multiple User-Defined Table Types to handle situations. But their naming conventions are identical.
We have a [IntTable] with column [IntValue]
and another [TinyIntTable] with column [TinyIntValue]
Insight appears to inspect the type of UDT that could work. And sometimes it chooses [TinyIntTable] (I am guessing because the values in the array being sent are all small enough to fit into a tinyInt. But that [TinyIntTable] isn't compatible with the stored procedure. How do I force Insight.Database to always use the [IntTable]?
Is there an attribute I could use on my c# object definition?
If you’re using stored procedures, then insight will check the type of the parameter and use the correct one. i.e. it should just work.
So your problem is likely something else. Check out the table type section on the wiki, and if that doesn’t solve it for you, please post a simple example on github and we’ll help you out.

Calling a DB2 Stored Procedure in a DB2 function

Can we call a DB2 Stored procedure from a DB2 function. Also my stored procedure has parameters and it returns a table, so I have to pass these parameters to the stored procedure through the function only.
Can anyone let me know if its possible.
Thanks much
I don't see any reason why it wouldn't work. Nothing in the documentation is sticking out to me that says User Defined Functions are prevented from, or shouldn't be calling a Stored Procedure.
It seems like the easy answer would be to try it out by creating a small test scenario. Without knowing why you're looking to do this, I can't offer much more advice since I've never done it personally. However another option, if you can't get the UDF to process result sets from a stored procedure call is to have the UDF call a program (or service program procedure) and have that object call the stored procedure and return whatever info you need the UDF to return.

Finding "types" (reporter/command, and different contexts) of Procedures

I am trying to extract, and sort, a list of all procedures in a model. Basically I want only the procedures that can be run in the Observer context, and only commands, not reporters. Workspaces have a .getProcedures():Map<String, Procedure> method and I am accessing the Procedure objects from that.
This leads me to two related questions: 1. Is there a way for me to find out if a Procedure object is a reporter or a command? The NetLogo desktop version seems to be able to make this distinction, so I think the answer might be yes. And 2. is there a way for me to find out what the Context of a procedure is, i.e. whether it is a patch/turtle/link procedure or an observer procedure?
http://ccl.northwestern.edu/netlogo/docs/scaladoc/org/nlogo/nvm/Procedure.html shows that Procedure has a syntax method returning an api.Syntax object. The methods you need are there, namely ret (which will be Syntax.VoidType or Syntax.WildcardType according to whether it is a command or reporter procedure) and agentClassString (which might be e.g. "OTPL").
Oh actually I see also now that the first constructor parameter to Procedure is Type tyype (the extra y is because type is a keyword in Scala), so for the first part of your question, you could equally well check that and see whether it is COMMAND or REPORTER. There probably isn't any good reason the information is redundantly stored.

What is the best practice to create invite code?

I'm going to generate some invite code. I know a simple method: do n-times loop to get a n-length random string. But it seems that when i want to check the code, it will cost more to find if a code is in data table using a string.
So, what is the best practice to create invite code?
(Old question, but pertinent to some code I'm writing just now...)
Use a GUID, and put an index on the column in the table. No problem with that.