Alexander Koblov · Aug 25, 2017 go to post

Notice, that in some cases it might produce different results:

USER>write ##class(%Library.Collate).SetLocalName("Cache standard"),!
1

USER>write "0.12345"]]$c(0)
1
USER>write ".12345"]]$c(0) 
0
USER>write ##class(%Library.Collate).SetLocalName("Cache standard string"),!
1

USER>write "0.12345"]]$c(0)                                                  
1
USER>write ".12345"]]$c(0)                                                   
1
Alexander Koblov · Aug 30, 2017 go to post

Have you looked at $IsValidNum?

ClassMethod AssertNumberEquals(v1, v2) As %Boolean
{
    if '$isvalidnum(v1) quit 0
    if '$isvalidnum(v2) quit 0
    //both are numbers -- let's compare them as numbers
    quit +v1=+v2
}
Alexander Koblov · Sep 4, 2017 go to post

To autofill password fields, Atelier (Eclipse) stores password that developer enters in different wizards. For example password for connection to Caché, password for connection to Git repository, etc. Atelier stores passwords in secure place called secure storage. Passwords are stored in encrypted form.

Access to the secure storage is protected by master password.

So, when you open some wizard with password field first time after Atelier lunch Atelier asks for master password in order to get password from secure storage and autofill corresponding field.

Let us know what exactly you don't understand and I (or maybe someone else) else will try to explain it.

Alexander Koblov · Sep 5, 2017 go to post

Notice that if you put space after ':' then it compiles OK:

Query T() As %SQLQuery [ SqlProc ]
{
SELECT TOP 3 JSON_OBJECT('lit': 'Employee from','t':%TABLENAME,'name':Name,'num':SSN) FROM Sample.Employee
}
Alexander Koblov · Oct 10, 2017 go to post

I would suggest you to run the query in terminal in $system.SQL.Shell() or using external tools via JDBC (DBVisualizer, Squirrel). By default Management Portal timeouts when query takes longer than 60 seconds.

Also, see Caché SQL Optimization Guide, especially section "Interpreting an SQL Query Plan". Maybe the chosen plan is not optimal.

Alexander Koblov · Nov 16, 2017 go to post

You might use $ZEOF to check for file end.

It should be enabled first:

do $system.Process.SetZEOF(1)

Then you can read file line-by-line as follows:

  do $system.Process.SetZEOF(1)
  set filename = "c:\temp\qq.txt"
  open filename:"R":2
  if '$Test {
  	write "cannot open file ", filename, !
  	quit
  }
  for  {
  	use filename read str
  	quit:$ZEOF=-1
  	use $Principal write str,!
  }
  close filename
Alexander Koblov · Jan 25, 2018 go to post

Generally, for long-running queries it makes sense to use external tools.

E.g. DBVisualizer or SQuirrel

Timeout for CSP Gateway to wait response from Caché is in Management Portal -> System Administration -> Configuration -> CSP Gateway Management.

Then Default Parameters -> Server Response Timeout.

Alexander Koblov · Feb 22, 2018 go to post

Thank you for sharing Mike.

Please notice that Dynamic SQL looks for the host variable in the global scope.

For example, consider following method:

Class Sample.Sqlbindtest [ Abstract ]
{

ClassMethod test()
{
	 set minage = 80
 set myquery = 3
 set tStatement = ##class(%SQL.Statement).%New()
 set myquery(1) = "SELECT top 10 %ID AS id, Age , Name, %ODBCOUT(DOB) DOB, Home_State"
 set myquery(2) = "FROM Sample.Person WHERE Age > :minage"
 set myquery(3) = "ORDER BY 2"
 set qStatus = tStatement.%Prepare(.myquery)
 set tResult = tStatement.%Execute()
 do tResult.%Display()
}

}

The query will refer to minage variable defined at the variable scope outside of method itself:

SAMPLES>d ##class(Sample.Sqlbindtest).test()
id      Age     Name    DOB     Home_State
 
0 Rows(s) Affected

SAMPLES>set minage=20 // now we define minage
 
SAMPLES>d ##class(Sample.Sqlbindtest).test()
id      Age     Name    DOB     Home_State
41      21      Beatty,Emily I. 1997-01-21      ID
163     21      Mastrolito,David X.     1996-04-14      AL
32      22      Adam,Sophia V.  1995-12-12      CO
33      22      Xiang,Laura L.  1995-03-02      MN
87      22      Paladino,Violet P.      1995-09-14      MN
139     22      Goncharuk,Stavros D.    1996-01-24      RI
173     22      Zucherro,Dmitry R.      1995-03-28      AK
56      23      Zubik,Quigley N.        1994-03-26      ID
46      24      Rogers,Mo D.    1994-02-16      OR
142     24      Orwell,Zelda M. 1993-07-12      AL
 
10 Rows(s) Affected
Alexander Koblov · Jun 29, 2018 go to post

I believe you can click Cancel on that "Communication link failure" error and then go to File -> Change namespace -> Connect -> choose the instance and then Studio will ask you for credentials

Alexander Koblov · Jun 29, 2018 go to post

If Audit is enabled and LoginFailure and Protect events are enabled and there is no audit event recorded when you enter username/password and see error after clicking OK.

then I would say that connection attempt from Studio does not reach HealthShare.

Can you do telnet on port 1972 from the computer where you have Studio? Instead of server specify IP-address of server with HealthShare

C:\temp>telnet server 1972
  Connecting To server...
Alexander Koblov · Jun 29, 2018 go to post

If you can’t telnet to that server/port from computer with Studio then something in the middle prevents this connection. This is question for network administrators.

Alexander Koblov · Aug 30, 2018 go to post

Unless you have list with $c(3,1,0) as element

USER>set list = $lb("stri,ng", $c(0), 2, $c(3,1,0), 3)
 
USER>set list = $replace(list, $lb($c(0)), $lb())
 
USER>zw list
list=$c(9,1)_"stri,ng"_$c(1,3,4,2,5,1,1,3,4,3)
 
USER>w $LL(list)
 
W $LL(list)
^
<LIST>
Alexander Koblov · Sep 7, 2018 go to post

These are credentials for CSP Gateway to use for connecting to Caché. If there is no such username/password pair in Caché or if corresponding user does not have enough privileges, then this username/password pair is not valid.

Alexander Koblov · Sep 18, 2018 go to post

Hi Xiao.

Many people here know Caché. Not so many know Oracle.

If you would explain what is Oracle CDC. What it does, and what features do you need, then we would be able to answer how you can do this in Caché.

Thank you, Alexander.

Alexander Koblov · Nov 15, 2018 go to post

I'm also talking about %SYS level.

For example, stop JDBC Gateway server. Then go to SQL Gateway Connections. Choose any JDBC connection, click "Test Connection". You should receive "Connection successful".

Now go back to JDBC Gateway Server and notice that its process is running. It was started automatically when you clicked "Test Connection"

Alexander Koblov · Nov 16, 2018 go to post

No, Ed indeed means number of unique values for indexed column.

E.g. our docs advises no more than 10'000-20'000 distinct values for bitmap indices.

Alexander Koblov · Nov 16, 2018 go to post

I think I would run tests and publish the results.

I think this test proves nothing.

Interesting to know underlying reasoning of saying: "Use bitmap index if there are less than X distinct values in common" or "Use bitmap index if selectivity of column is less than Y".

Why X, why Y? Where is this 6400 and 2% come from? What is it in bitmap indices that makes them slower, once these thresholds are reached?

There are two many variables to take into account in this test, so it's much more interesting to see formula than test results.

Alexander Koblov · Nov 16, 2018 go to post

Hm, I thought that length of values would also have impact, but provided how globals are stored maybe this does not matter.

Also I wonder if blocksize matters.

Alexander Koblov · Nov 20, 2018 go to post

while this test is indeed fun, the most important phrase in your post is of course:

best stay away from doing anything too clever as it leads to unreadable code

Alexander Koblov · Mar 1, 2019 go to post

No, indirection does not introduce additional stack, as far as I know. It works with variables that are visible in public (global) scope, not in private scope of procedure.

Alexander Koblov · Jul 1, 2019 go to post

Hi Fab!

Changes to globals mapped to non-journaled databases are still journaled inside transactions. Unless globals are mapped to IRISTEMP or journaling is completely stopped at the system.

Quoting the docs: "While updates to non-journaled databases that are part of transactions are journaled, these journal records are used only to roll back transactions during normal operation. These journal records do not provide a means to roll back transactions at startup, nor can they be used to recover data at startup or following a backup restore."

https://irisdocs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GCDI_journal#GCDI_journal_disabling