I am hoping to use Groovy more as a functional language than I can with Java, but one area that seems to be a problem is when I call to a stored procedure, as I am passing perhaps 40 parameters in a single call, but, I also need to do some prep work, at the moment before I even call.
So, for example, I need a time stamp, so I will have something similar to (so there may be errors, but it is the concept I am going for)
def timestamp = (int) (Calendar.instance.timeInMillis/1000)
def ismanager = input.isManager ? 1 : 0
sql.call("{call myfunction($timestamp, ..., $ismanager, ..."})
It would be helpful if I could do these type of calls inside the query, as it would make more sense what is going on, since there are so many parameters in the stored procedure, so having to look around for what went into initializing ise manager
can be problematic.
Is there a way to have these functions executed within the call gstring?