From your output it's not clear if you're in the SQL Shell. You need to be in the Shell to execute the EXPLAIN command

Warlin Garcia · Jul 25, 2025 go to post

a) Haven't seen this issue before so not sure what might be trying to stop/interrupt the process

b) The %sqlcq.{namespace}.cls375.1 is the INT version. If you can't find it then your system is not configured to keep generated source. 

One way to see the code in this situation, assuming you can make code changes in that environment, is to create a routine with the target SQL using embedded SQL and you'll see in most cases the same code that should be in the *.cls### routines. 

c) One way to get it according to documentation https://docs.intersystems.com/iris20252/csp/docbook/Doc.View.cls?KEY=GW…

Warlin Garcia · May 2, 2025 go to post

Since you're using Cache, the options are "limited" compared to those in IRIS. Out of the box you can't call routines with the provided APIs, so you have the following options (can be combined depending on your needs):

- Create SQL mappings (classes)

- Expose the routines you want to call as stored procedure

- Create an "API" class in your system that expose the routines you want to call 

- Create an "API" class that exposes a generic method where you can pass the routine name and parameters (similar to what IRIS does)

- Create a REST API similar to the APIs in before points

- There may be other options

For the REST API, apart from making the Cache changes you won't need any other Cache libraries in your Java code. For the other options you'd need one of the libraries/options provided by cache https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls

Warlin Garcia · May 1, 2025 go to post

This is what I was trying to communicate but did very poorly. Thank you for clarifying!

Warlin Garcia · Apr 30, 2025 go to post

1) "Internal" tools such as Studio and System Explorer support these comments since they're valid in objectscript. However, the recommended way for classes is using the /// notation since that's what documentation and other things are generated. VS Code, I'm guessing, went for the "expected" notation rather than going for backward compatibility.

2) That would be my guess too.

3) Most likely someone modified the class to comment the property.

4) See #1

5) Assuming you don't want manually modify the class definition, you can always find the offending properties and modify(using %Dictionary classes) then compile the class definitions to change to proper notation. Then export/serialize with the changes. 

Warlin Garcia · Mar 3, 2025 go to post

Annotation concept you describe here is not present in IRIS/Cache. The closest you could  get on this would be macros but they don't behave the same as Java Annotations. 

As others have mentioned, this is something the language itself (IRIS in this case) would have to provide support for first and then developers can extend by adding their own/custom annotations. 

Warlin Garcia · Feb 21, 2025 go to post

Hi Omer, would your solution consider a trigger? Haven't tried this but you could have a trigger that executes after insert/update that would launch an update on the affected row that basically would "add" the new value in the counter to the old one:
Your queries should change to something like this 

INSERT OR UPDATE myTable SET name='Omer', counter = 1

INSERT OR UPDATE myTable SET name='Omer', counter = -1

.....

The logic in the trigger would grab old value (handle NULL as 0) and add the new value only in cases where both are different or whatever your business logic might be.

To prevent infinite loops on updates your after update trigger can be defined to only be executed after any of the other columns in the table are updated with the exception of counter.

Warlin Garcia · Jan 1, 2024 go to post

The "only" way to do this via SQL would be using stored procedures.  You can pass your object tree using either XML or JSON string and process them (using object logic) inside your SP. Standard SQL as intended won't support what you want to achieve. 

Warlin Garcia · Dec 21, 2023 go to post

$LISTBUILD (IDs of referenced objects) should do the trick. The "parent" table here is only storing the corresponding IDs not the entire objects. You need to save each object individually and then link them.

While the object counterpart takes care of saving/inserting both objects in memory, the same is not true for SQL. You need to treat each object as individual rows on different tables.

Warlin Garcia · Jul 1, 2022 go to post

It is a best data management practice to add restrictions to fields if they have them. So adding the maxlen is "recommended"

Adding the maxlen won't result in wasted storage since storage is not reserved based on field definitions. If that were the case, in your particular scenario, you'd be actually saving storage since all string fields are defaulted to maxlen = 50 if you don't specify a value. 

Warlin Garcia · Jun 29, 2022 go to post

Maybe I'm missing something, but, beyond how nulls are treated, if you want parent to be unique within this definition you must define a unique index on parent (alone). The index you have defined only guarantees that the combination (parent, name) will be unique.

Even if you declare the property as required it wouldn't still solve the uniqueness requirement. 

Warlin Garcia · Apr 6, 2022 go to post

You need to use HyperEvents to accomplish what you want. Use #server or #call. Although if I'm following your use case #server is the right one. In the corresponding javascript function you'll have code similar to

myfunction() {

...

var myvar = #server(mycachemethod());

//check myvar value

// return true or false based value

}

Warlin Garcia · Apr 6, 2022 go to post

Guessing a typo(copy paste from SetQualifiers?) in the documentation. It should say "...otherwise it gets the default qualifiers for this namespace."

Warlin Garcia · Mar 14, 2022 go to post

Journal files are also exposed as SQL (readonly) tables. In theory, you could write SQL statements to search/filter. 

Warlin Garcia · Mar 9, 2022 go to post

Few options without knowing much about current setup and the use case (eg. how much involvement you want to have in the process)

  • Synchronizing(shadow) between the 2 instances - Global export/import
  • Global mapping from one instance to another
    • You could merge global from source to target
  •  File transfer (traditional ETL) and manipulating the global directly (risky but doable) 
Warlin Garcia · Aug 5, 2021 go to post

Also, any indices on such field would need to be rebuild. Indices on %String properties are expected to start with an empty space thus your queries using these indices won't return any existing (non-updated) rows.

Warlin Garcia · Aug 4, 2021 go to post

Is the question how to write a trigger or how to send a SMS from within Cache/IRIS? 

You should be able to find how to do both things in the Intersystems documentation (link not working for me right now).

Warlin Garcia · Aug 4, 2021 go to post

We may need more clarity to answer the specific question you have but here are some answers to things I could pull from your post:

- The reason relationships are not showing in ERD is because adding an object reference from one class to another doesn't generate a ForeignKey (only relationships do this automatically) thus no relationship is defined in the generated ERD. If a FK is required then it should be defined manually.

- The primary keys for the tables in the ERD diagram are listed in your posted image. The fields listed there are the ones that correspond to the primary key of each of the tables displayed. If you're looking for a programmatically way to see the primary (assuming you don't have access to the code) then you could check information_schema.key_column_usage for constraint_type = "PRIMARY KEY". You may need to look deeper depending on whether table correspond to a global mapped (legacy) table or a "pure" SQL table. 

- As for the different results, it may be you're passing the wrong value to the query (eg. ID for one table being used to query another) or indices are out of sync or corrupted (rebuilding indices should fix this).

Warlin Garcia · Jul 1, 2021 go to post

Sorry I misread the SET statement...

Have you tried running the same update (capture exact values being passed) from a JDBC client such as DBeaver? 

The generated tSQL looks good by just glancing at it.

Warlin Garcia · Jun 30, 2021 go to post

Have you tried removing the comma(",patient_id")= from the sqlcolumns and sqlvalues?

Warlin Garcia · May 25, 2021 go to post

How old are you talking about? In any case, you could use old stored procedures provided by Cache to pull the data. There will be under %SQL.Manager.Catalog, eg. %SQL.Manager.Catalog.Procedures()

Warlin Garcia · Mar 11, 2021 go to post

To expand on David's answer, you'd have to do something like

S query = "query 1"

S query2 = " UNION query 2"

I doUnion S query = query_query2

S rs = ##class(%ResultSet).%New(query)

.....

Warlin Garcia · Feb 4, 2021 go to post

Flyway (and Liquibase) allows migrations to be written in SQL so you don't need a fully integration to be able to use them with Cache/IRIS. Fully integrating (e.g. extending Flyway) would provide access to other automations and features that otherwise are not available with just SQL e.g. using the same script in different DBMS. In the case of Liquibase, automated rollback generation, etc.

Warlin Garcia · Feb 3, 2021 go to post

You should be able to use the $SYSTEM.SQL.DATEADD("hh",1,$H)

It returns a timestamp you'd need to convert back to $H format if that's what you need.

Warlin Garcia · Jan 8, 2021 go to post

Can you show the query plan? Usually this issue "shows" when indices are out of sync. Maybe try rebuilding indices.

Warlin Garcia · Jun 18, 2020 go to post

The list of steps depend on how is your current application built (e.g. are you using direct global access vs. SQL). Depending on which direction you want to go you could simply wrap your existing objectscript code in either stored procs or services and access them from Java or rewrite all your existing logic in Java.

Again, the steps would depend on what exactly you're trying to accomplish and your current app makings.

Warlin Garcia · Mar 19, 2020 go to post

The "||" is used to concatenate. So that's why it makes sense those are the ones used in the SQL you pasted instead of "!!".