I have a background in electrical engineering ad have been active as software engineer and architect for the past 35 years. Since 2010 I am active in healthcare interoperability, for VitalHealth and Philips. In June 2022 I joined InterSystems.
Thanks @David Hockenbroch!
I strongly discourage the use of embedded sql, it has many disadvantages. For complex queries you can use the following construct (a bit overkill for this example):
set query = 0
set args = 0
set query($Increment(query)) = "SELECT Name, Age"
set query($Increment(query)) = "FROM Patient"
set query($Increment(query)) = "WHERE Age >= ?"
set args($Increment(args)) = age
set result = ##class(%SQL.Statement).%ExecDirect(, .query, args...)
if result.%SQLCODE < 0
{
// Your error handling here
throw ##class(%Exception.SQL).CreateFromSQLCODE(result.%SQLCODE,result.%Message)
}
while result.%Next()
{
write result.Name," ",result.Age,!
}
Hi Edmara,
Yesterday I found we are having the same issue. This issue surfaced after we upgraded to 2023.1.5 (Build 697U).
In our case the issue is caused by a different Client Redirect URL. It is set to https://host/api/v1/xxx/csp/sys/oauth2/OAuth2.Response.cls
via the Prefix /api/v1/xxx in the Client Configuration page.
We could work around the issue by patching class OAuth.Response and changing the cookie path from %request.Application to "/" in line 134, so from
Do %response.SetCookie(..#CSRFCookieName, state,,%request.Application,,%request.Secure,1,sameSite)
to
Do %response.SetCookie(..#CSRFCookieName, state,,"/",,%request.Secure,1,sameSite)
I have logged a WRC for this unexpected behavior change.
I am curious to hear from you!







Hi @Enrico Parisi ,
I did have warnings from the objectscriptQuality for VSCode plugin on the embedded SQL for side effects but now I re-check that warning no longer seems to be there.
I never liked the different behavior of embedded sql, like when you have no result, you have no easy way to find that out. More importantly, when you have multiple rows as result, you need to start using a cursor and the code becomes complicated.
With ##class(%SQL.Statement).%ExecDirect(), the code is identical whether there is one or there are many results and that way maintainability is better.
But as @Benjamin De Boe already said: It is probably more of a style preference.