#Caché

1 Follower · 4.5K Posts

  

InterSystems Caché is a multi-model DBMS and application server. See more details here.

Documentation.

Article Gevorg Arutiunian · Dec 27, 2018 2m read

The following code walks a DOM using %XML.Node. It also prevents %XML.Writer to change whitespace. Run the code using the class method "test":


Class objectscript.walkDOM Extends %Persistent
{
	ClassMethod dfs(node As %XML.Node)
	{
	    s entrynode=node.NodeId
	    do {
	    //element nodes with one whitespacetyped child are the ones we want to change
	    if (node.NodeType=$$$xmlELEMENTNODE){
	        s snode=node.NodeId     
	        if (node.MoveToFirstChild())            
	            {
	                i ('node.MoveToNextSibling()){
	                    i (node.NodeType=$$$xmlWHITESPACENODE){
	                        s node.NodeType=$$$xmlTEXTNODE
	                        s node.NodeId=snode
	                    }
	                }
	        }
	        s node.NodeId=snode     
	    }   
	    if (node.HasChildNodes()){
	        d node.MoveToFirstChild()
	        d ..dfs(node)
	    }
	    } while (node.NodeType'="" && node.MoveToNextSibling())
	    s node.NodeId=entrynode
	     
	}
	 
	ClassMethod test()
	{
	  set xml = "abcdefg<![CDATA[   ]]>"
	 
	  s reader=##class(%XML.Reader).%New()
	  do reader.OpenString(xml)  
	  set writer = ##class(%XML.Writer).%New()
	  //do some magic
	  d ..dfs(reader.Document)
	   
	  w !,"with indent=1:",!
	  set writer.Indent = 1
	  do writer.OutputToString()
	  do writer.Document(reader.Document)
	  w writer.GetXMLString()
	  set writer.Indent = 0
	  w !,"with indent=0:",!
	  do writer.OutputToString()
	  do writer.Document(reader.Document)
	  w writer.GetXMLString()
	}
}

Here's a link to the code on GitHub: https://github.com/intersystems-community/code-snippets/blob/master/src/cls/objectscript/walkDOM.cls

0
0 397
Article Eduard Lebedyuk · Oct 8, 2018 5m read

InterSystems products (IRIS, Caché, Ensemble) already include a built-in Apache web server. But the built-in server is designed for the development and administration tasks and thus has certain limitations. Though you may find some useful workarounds for these limitations, the more common approach is to deploy a full-scale web server for your production environment. This article describes how to set up Apache to work with InterSystems products and how to provide HTTPS access. We will be using Ubuntu, but the configuration process is almost the same for all Linux distributions.

2
9 2930
Question Edmund White · Jan 24, 2018

I am trying to use Entity Framework with Visual Studio 2017. After following the Intersystems documentation ("Using the Caché Entity Framework Provider") I still cannot see the data source in Server Explorer.  Any ideas why?

9
1 1122
Question Karthikeyan G · Dec 20, 2018

How to configure Remotedatabase into our local instance. While connecting remote database i am getting "ERROR #463: Database C:\InterSystems\HealthShare2\mgr\Remote\ is not allowed for ECP Mirror Connection". so can anyone  help me to sort this out.

1
0 250
Question Sean Connelly · Dec 20, 2018

I've been looking at the idea of developing a Time Travel Debugger utility.

It would take a debug target and have a few options such as stack depth and disclude system code.

The debugger would either be started from an external tool, or triggered from a line of code inserted into a method that I want to record.

The debugger would execute the code from start to end and record the full stack on each step to the configured depth.

A visualisation tool would provide a set of controls to play the recording forwards and backwards and provide various ways to search and jump to points in the recording.

4
0 507
Question Pratik Mankar · Dec 19, 2018

In Persistent class, a data global is created which holds the data similar to the table created . Through terminal we can add more records to this table according to the structure of the table. How are the records reflected back into the table which has been set at global . In other words How are the global mapped to the SQL table?

2
0 674
Article Sergey Mikhailenko · Jan 23, 2018 20m read

This article was written as an attempt to share the experience of installing the InterSystems Caché DBMS for production environment. We all know that the development configuration of a DBMS is very different from real-life conditions. As a rule, development is carried out in “hothouse conditions” with a bare minimum of security measures, but when we publish our project online, we must ensure its reliable and uninterrupted operation in a very aggressive environment.

##The process of installing the InterSystems Caché DBMS with maximum security settings

OS security settings

2
5 1874
Question Sankar Manogaran · Dec 17, 2018

Hi,

We are using Cache 5.0,  we use Cache telnet and Other emulator (using telnet connection) to launch the applications.

Is there a way to identify the  type of device is used?.  Based on the emulator  I can few custom changes to be applied.

Thanks and Regards,

Sankar

1
1 282
Question Eduard Lebedyuk · Dec 16, 2018

I have a simple callout library:

#define ZF_DLL
#include 
#include 
#undef ERROR

int GetRandom(double* random) {
   // Py_Initialize();
   // Py_Finalize();
   *random = 1.0;
   return ZF_SUCCESS;
}

int main(int argc, char **argv)
{
   printf("Random: ");
   double random=0;
   GetRandom(&random);
   printf("%lf", random);
   return 0;
}

ZFBEGIN
    ZFENTRY("GetRandom","D",GetRandom)
ZFEND

I compile this code as a shared library and it works fine with:

set path = "library.dll"
write $ZF(-3, path, "GetRandom")

It also compiles and works as an executable.

4
0 583
Question Robert Osborne · Dec 13, 2018

Hello All,

Hoping someone can help with this odd error.

A vbscript file is being used to perform an update to cache.

The file has worked without an issue for well over a year.

Recently, the update has begun to throw an error.

(class references modified to remove client data)

UPDATE CACHE.UCI.Reg.Pat (Column1) VALUES ('USERNAME') WHERE ID = '2190284'

C:\Web\Config\SchedTasks\script1.VBS(73, 6)

Microsoft OLE DB Provider for ODBC Drivers: [Cache ODBC][State : S1000][Native Code 105]

[c:\Windows\SysWOW64\cscript.exe]

[SQLCODE: <-105>:<Field validation failed in UPDATE>]

[Location: <ServerLoop>]

3
0 656
Question Goran Stefanovic · Dec 12, 2018

A very simple SQL

SELECT field1 F1, count(field2) CntF2
FROM GCT.PA_Data
where field1 is not null
group by field1

gives an error back:

 [SQLCODE: <-461>:<Communication link failure>]

  [%msg: <Connection 'TRAKCARELIVE': Execute: SQLState: (HY000) NativeError: [10053] Message: [Cache ODBC][State : HY000][Native Code 10053] [c:\intersystems\ensemble\bin\cache.exe] Software caused connection abort> ]

It does work in another (test) environment, but not on live. Any idea why?

6
0 622
Question Jordi Gomez · Dec 10, 2018

Dear all,

In our application made in Caché object script, when we deploy some classes modified we have the option of calling "Purge queries" feature of Caché.

We only were doing this call when a %Persistent class definition (table) was modified, as we assume that no other changes affect the cached queries and we don't  want to purge them by default, as the first run of a query becomes slow.

We had a case where no table definition was changed but a purge queries was the solution.

Do you know if any other change could affect the cached queries and a purge queries is necessary? 

Regards,

3
0 293
Question Jimmy Ng · Nov 14, 2018

Hi. I have the following tables

User.Order [Parent][Primary Key : Year , Month, OrderNo]

 > User.OrderDetails [Child] [Primary Key : {%%PARENT}("ITM")(Running Number)]

 > User.OrderDetails2[Child] [Primary Key : {%%PARENT}("ITM2")(Running Number)]

  My question is there any problem if I use a composite key in User.Order?  I am using the composite key is because I have a lot of records each month(millions) and sometimes I will need to clear the records for a specific month for reloading, with those primary key removing the data would be easier (possibility faster too).

6
0 1821
Question John Kumpf · Dec 6, 2018

Hi guys,

I'm running a method on an instance of Cache 2010, which, when compiled, has $$$OK in it's .int code.  This line throws an error, telling me that "the OK macro isn't recognized". 

Some things I've tried;

- I looked it %occStatus, and the macro definition of OK is there.

- I changed $$$OK to 1 by hand in the .int code.  It compiled successfully, but each time I recompile the original class, it's going to put that $$$OK back

- I tried Include %occStatus at the top of the class.  The .int code was unchanged when I did this (is my syntax on that wrong?)

4
0 543
Article Sean Connelly · Nov 19, 2018 2m read

Here's a fun test to see how well you know ObjectScript.

What will each of the following statements output?

write 5 * 10 + 1

write 1 + 5 * 10

write 1 + 0 / 10

write 0 && 0 = 0

write 0 = 0 && 0

write 1 && 1 = 1

write 1 = 1 && 1

write 2 && 2 = 2

write 2 = 2 && 2

write "1 APPLE" + "2 BANANAS"

write "-1" + "1-2"

write +"+-+-+-5"

write "1D7P"-1

write "1E6F"-1

write 0 = "FOO"

write 0 = +"FOO"

write 0 = ''"FOO"

write "10X" - " 5" - "5"

write "10-5"

write +"10-5"

write @"10-5"

write 5_"1"-1

write "5"-1_"1"

write 10 + 10 > 21 + 1

13
2 1187
Question Gunwant Kapade · Dec 4, 2018

This is the class which I want to test.

Class GSK.MyTestUnit Extends %RegisteredObject {

ClassMethod Add(num1 As %Integer, num2 As %Integer) { s res=num1+num2 q res } }

This is my testing class.

Class GSK.TestingClass Extends %UnitTest.TestCase {

Method test() { Do $$$AssertEquals(##class(GSK.MyTestUnit).Add(3,8),41, "Test Add(2,2)=4 passed ") do $$$AssertNotEquals(##class(GSK.MyTestUnit).Add(3,8),11,"pass/fail") }

}

The test cases are passed even though they should fail.

s ^UnitTestRoot="C:\TestSuite1" d ##class(%UnitTest.Manager).RunTest("Test2")

1
1 353
Question David Foard · Dec 3, 2018

I am trying to use %INLIST in  SQL query using a cursor and the query fails to return results. It appears that the variable I use against %INLIST returns an empty string. All the examples I have seen use result sets and build the query as a string. Is it possible to use %INLIST in a cursor-based query? Below is a a snippet of the code I am using:

Property mylist as %String (MAXLEN="") [InitialExpression = "route1, route2, route3"];

set routeList = $LISTBUILD(mylist)

&sql(DECLARE MyReport CURSOR FOR

SELECT

      ProcessStartDate,

      ProcessCompleteDate,

      ProcessName,

     RouteName

FROM

3
0 731
Article Dmitry Maslennikov · Nov 5, 2018 13m read

I bet that not everyone familiar with InterSystems Caché knows about Studio extensions for working with the source code. You can actually use the Studio to create your own type of source code, compile it into interpretable (INT) and object code, and sometimes even add code completion support. That is, theoretically, you can make the Studio support any programming language that will be executed by the DBMS just as well as Caché ObjectScript. In this article, I will give you a simple example of writing programs in Caché Studio using a language that resembles JavaScript. If you are interested,

6
6 1290