Question Nicola Sartore · Sep 16, 2022 Passing object to a function in objectscript Let's consider these two ways of passing an obj to a function: //var is a structured obj (1) do ..methodX(var) (2) do ..methodX(.var) In c++ if we pass an obj by reference like in (2) we save a lot in computation because we are not copying the whole object, and when the object is modified within the function it is modified also for everyone. In this case does (2) achieve any better performance than (1)? Is passing with the "." save any computation? the object is copied anyway? Is there a simple way of passing obj to a function? #ObjectScript #InterSystems IRIS 0 3 0 263
Question Nicola Sartore · Jun 21, 2022 Inline IF and assignment I'd like to to assign a value to a variable, depending on the results of a condition. The equivalent of what can be done in c++ with the following: (a>b) ? a=1:a=0; Or in python: a = 1 if a>b else 0 This makes the code much more readable and compact. In objectscript it would be: #ObjectScript #InterSystems IRIS #InterSystems IRIS for Health 0 4 0 450
Question Nicola Sartore · Dec 2, 2021 SNN Encryption I need to store an equivalent of the SNN (Social Security number). I need it to be encrypted and I'll have to be able to search for it once stored. For what I've seen my options are: - SHAHash from the %system.encryption library. Simple and easy to implement. My question is, might collisions be a problem? We are talking about a 10 millions entry. - AES encryption. In this case I'd like to know if there is a standard way for key management in the InterSystems environment. #Encryption #ObjectScript #Security #InterSystems IRIS 0 2 0 328
Question Nicola Sartore · Nov 9, 2021 Studio tips and tricks Any suggestion that can make programming with Studio easier and smarter is welcome. #Development Environment #Studio #InterSystems IRIS 0 10 1 454
Question Nicola Sartore · Nov 5, 2021 Iterate over an SQL result set I running a query and get the results inside a result set. Now I have to iterate through the result set many times. From the doc I've seen only the Next() method. Is there a way to reset the cursor? Otherwise what is a good data structure to save multiple rows of a table? My code in this case is something like this: set sql = "SELECT * FROM MY_TABLE WHERE X= '"_Y_"'" set status = ..Adapter.ExecuteQuery(.rs, sql) // somehow iterate the rs more than one time #SQL #InterSystems IRIS 0 6 1 1.6K
Question Nicola Sartore · Nov 4, 2021 How to get the insert ID in SQL? I want to INSERT a record in a database using JDBC in OBJECTSCRIPT. At the same time, I want to obtain the insert ID. Is there a way to achieve this using the SQL Outbound adapter? My code is something like this now: Property Adapter As EnsLib.SQL.OutboundAdapter; set sql = " INSERT INTO Prenotazioni_CUP "_ " (ID, cf " VALUES (SEQTAB.NextVal, ?) "set status = ..Adapter.ExecuteUpdate(.rs, sql, pRequest.cfAssistito) #JDBC #SQL #InterSystems IRIS 0 5 0 443