查找

问题
· 九月 16, 2024

What is the best way to do a silent install of an IRIS application?

We have an ObjectScript application that runs in Cache' and IRIS. Our typical installation involves a .zip file containing several files necessary for the installation and operation of the application. Steps are: expand the .zip file to a folder that will not be used by the application. Do ^%RI for the installation routines in the production namespace. Do the Installation routine. We have a customer that is trying to do a silent installation. He does not want to have to respond to any prompts on the installation. We do have a silent option for the Installation routine and that is working well. But he also does not want to have to respond to prompts for the Do ^%RI step. Currently we are doing set sc=$System.OBJ.Export(routineString,destinationPath.xml). And then we can do a set sc=$System.OBJ.Load(destinationPath.xml,"cuk",.errlog) in the installation script.

Is there a better way to do this?

3 Comments
讨论 (3)2
登录或注册以继续
文章
· 九月 15, 2024 阅读大约需 3 分钟

Comment trouver mon texte spécifique en ObjectScript

Vous connaissez probablement cette situation :
il y a quelque temps, vous avez trouvé une fonction $ZU très spéciale pour
un type de problème spécifique. Une sorte de formule mystique.
Elle est devenue populaire et a été utilisée par de nombreux programmeurs
dans tout votre code et toutes vos installations .

Plusieurs versions et updates plus tard, vous êtes informé par ISC que
votre $ZU mystique est déprécié et n'est plus supporté. Et on vous conseille
de le remplacer par un nouveau $something(). 

Alors, comment trouver et documenter l'utilisation de votre code mystère ?
Il pourrait se trouver dans les classes, dans le code MAC,  INT, INC.
Et il peut être distribué dans plusieurs namespaces.
Dans le passé, Studio n'était encore completé et peu adapté, mais lent et peu précis.

J'ai rencontré cette situation plus d'une fois dans différentes installations.
Source Control n'était pas disponible à l'époque
et n'a été que rarement utilisé lorsqu'il a été ajouté.

ObjectScript étant le seul choix possible pour relever ce défi, j'ai écrit mon propre outility.
Ma solution s'est développée au fil des ans et une fois que la migration vers IRIS a été planifiée,
j'ai vérifié une fois de plus à quel point elle était utile.
Et comme elle était écrite en ObjectScript pur, elle fonctionnait dans IRIS sans qu'aucun
caractère n'ait été modifié. Comme vous le savez peut-être, le problème de la recherche
d'un morceau de texte spécifique en ObjectScript n'a pas changé. 

Mon objectif personnel pour mon outility était

  • uniquement l'ObjectScript
  • pas de constructions fantaisistes, miraculeuses ou délicates
  • le moins possible de fonctions $advanced
  • préférer la lisibilité à l'élégance en faveur de la maintenance future
  • présenter le nombre d'occurrences comptées par espace de noms et par élément de code
  • pour les classes, diviser également 
    • parameter,
    • properties (si calculated)
    • methods
    • indices
  • une option pour montrer la ligne qui les contient
  • ne se soucient pas de la liste.
    • N'importe quel programme de terminal peut écrire un journal
    •  bash a son STDOUT à cet effet

Ce utility est donc disponible pour vous sur Open Exchange et GitHub
J'ai également créé une vidéo pour démontrer le péage en action.
Et il est également disponible sur Demo Server

Il vous suffit de démarrer depuis le terminal
user>DO ^rcc.find 

Et vous obtenez quelques questions

  •  quel est le texte que vous recherchez ?
  • verbose » ?
    • voulez-vous voir chaque ligne complète contenant votre texte ?
    • Attention, cela peut devenir une liste assez énorme
    • Un test récent a trouvé plus de 90000 résultats.
    • Avec verbose=1, on obtient plus de 90000 lignes.
  • Uniquement en majuscules ?
    • Cela résout le problème selon lequel une fonction peut être écrite
    • en majuscules, minuscules ou mixtes.
    • "Uppercase=1" garantit que vous ne manquez aucune occurrence
  • Quel type de code voulez-vous vérifier ? (CLS,MAC,INT,INC,ALL)
  • Quel namespace voulez-vous rechercher ?
    • Un namespace spécifique de votre liste ou ALL
    • pour ALL vous obtenez une liste condensée d'espaces de noms et de types
    • (non visible dans la vidéo)

La sélection de namespace lance la recherche.
Alors on danse !

USER>do ^rcc.find
----------------
 
enter search string [$ZU] <blank> to exit: RCC
          Verbose? (0,1) [0]:
          Force UpperCase? (1,0) [1]:
 
enter code type (CLS,MAC,INT,INC,ALL) [ALL]: CLS
 
select namespace (ALL,%SYS,DOCBOOK,ENSDEMO,ENSEMBLE,SAMPLES,USER) [USER]:
 
** Scan Namespace: USER **
 
** CLS **
** 2      User.ConLoad
** 15     User.Main
** 3      csp.form
** 3      csp.winner
** 2      dc.rcc.Contest
** 37     dc.rcc.Main
** 1      dc.rcc.Prize
** 63 CLS **
----------------

 

J'espère que vous avez apprécié mon histoire.
J'ai essayé d'éviter les séquences de code ennuyeuses. Il y a OpenExchange et Github pour cela.

Et s'il vous plaît, excusez mon français rouillé.
Je l'ai appris à l'école il y a 65 ans et il n'y était pas question de technologie
mais de Molière, Sartre, Queffélec, Anouilh, Ionesco, ... 

讨论 (0)1
登录或注册以继续
问题
· 九月 15, 2024

Have you tried the THROUGH command in IRIS 2024.2? How does it work?

Has anyone successfully tested the new THROUGH command in IRIS 2024.2 with a FOREIGN SERVER?https://docs.intersystems.com/iris20242/csp/docbook/Doc.View.cls?KEY=RSQ...

I have connected from a Docker instance to a VM. I was able to successfully set up the JDBC connection through the UI.

I then configured a foreign server with this connection:

But I am unable to send a SQL 'THROUGH' to the DB. I always get a:

I've get the same message if i try it via Management Portal.

I've also tried this:

and this

Always with the same error. According to the documentation, the syntax without ‘ and " should be correct.

Also a simple  

gives this error...

Any idea how this works?

Andreas

11 Comments
讨论 (11)2
登录或注册以继续
文章
· 九月 12, 2024 阅读大约需 2 分钟

Code Scanner - enhanced

During testing the added Multi-Namespace feature I met a challenge
that required intervention. This simple request created 1000 lines of output.

USER>do ^rcc.find
----------------
 
enter search string [$ZU] <blank> to exit:
          Verbose? (0,1) [0]:
          Force UpperCase? (1,0) [1]:
 
enter code type (CLS,MAC,INT,INC,ALL) [ALL]:
 
select namespace (ALL,%SYS,DOCBOOK,ENSDEMO,ENSEMBLE,SAMPLES,USER) [USER]: all
  • As for the verbose variant you my run a log on your terminal to keep the result in details
  • though a real summary was still missing.

So I decided to append a very condensed statistic to the summary line

;;; skipping ~1000 lines of output
** 0 INC in Namespace USER**
 
** 1206 ** ALL total in Namespace USER
 
** 90120 ** total in ALL Namespaces
sub("%SYS")=10975
sub("%SYS","CLS")=2631
sub("%SYS","INC")=1433
sub("%SYS","INT")=6911
sub("%SYS","MAC")=0
sub("DOCBOOK")=27
sub("DOCBOOK","CLS")=27
sub("DOCBOOK","INC")=0
sub("DOCBOOK","INT")=0
sub("DOCBOOK","MAC")=0
sub("ENSDEMO")=45924
sub("ENSDEMO","CLS")=172
sub("ENSDEMO","INC")=10
sub("ENSDEMO","INT")=45687
sub("ENSDEMO","MAC")=55
sub("ENSEMBLE")=31504
sub("ENSEMBLE","CLS")=172
sub("ENSEMBLE","INC")=10
sub("ENSEMBLE","INT")=31280
sub("ENSEMBLE","MAC")=42
sub("SAMPLES")=484
sub("SAMPLES","CLS")=475
sub("SAMPLES","INC")=0
sub("SAMPLES","INT")=6
sub("SAMPLES","MAC")=3
sub("USER")=1206
sub("USER","CLS")=11
sub("USER","INC")=0
sub("USER","INT")=1192
sub("USER","MAC")=3
----------------

This summary I attached to the end show how and where the
90000+ hits are distributed. 

It works with the ALL namespace selection also for single code types

enter search string [$ZU] <blank> to exit:
          Verbose? (0,1) [0]:
          Force UpperCase? (1,0) [1]:
 
enter code type (CLS,MAC,INT,INC,ALL) [ALL]: mac
 
select namespace (ALL,%SYS,DOCBOOK,ENSDEMO,ENSEMBLE,SAMPLES,USER) [USER]: all
 
** Scan Namespace: %SYS **
 
** MAC **
 
** 0 MAC in Namespace %SYS**
 
** Scan Namespace: DOCBOOK **
 
** MAC **
 
** 0 MAC in Namespace DOCBOOK**
 
** Scan Namespace: ENSDEMO **
 
** MAC **
** 1      Ens.BusinessMetric.G1
** 41     EnsMONLBL
** 13     build
 
** 55 MAC in Namespace ENSDEMO**
 
** Scan Namespace: ENSEMBLE **
 
** MAC **
** 1      Ens.BusinessMetric.G1
** 41     EnsMONLBL
 
** 42 MAC in Namespace ENSEMBLE**
 
** Scan Namespace: SAMPLES **
 
** MAC **
** 3      rcc.find
 
** 3 MAC in Namespace SAMPLES**
 
** Scan Namespace: USER **
 
** MAC **
** 3      rcc.find
 
** 3 MAC in Namespace USER**
 
** 103 ** total in ALL Namespaces
sub("%SYS","MAC")=0
sub("DOCBOOK","MAC")=0
sub("ENSDEMO","MAC")=55
sub("ENSEMBLE","MAC")=42
sub("SAMPLES","MAC")=3
sub("USER","MAC")=3
----------------

try on Demo Server

Demo Server SMP
Demo Server WebTerminal
 

讨论 (0)2
登录或注册以继续
文章
· 九月 12, 2024 阅读大约需 3 分钟

PythonからIRISルーチンに引数を渡すサンプル

これは InterSystems FAQ サイトの記事です。
 

PythonからObjectScriptのルーチンを直接呼び出すことはできませんが、クラスメソッドを経由して間接的に呼び出すことができます。

しかし、Pythonの変数とObjectScriptのローカル変数は内部構造が異なるため、情報の交換には少し工夫が必要です。

簡単なサンプルでその方法について説明します。

まず、2つの変数を足し算する簡単なルーチン ^testを作ります。 

 

TEST    ;
    set sum = a + b

 

次にこの^testを呼び出すPythonのメソッドを含んだUser.testというクラスを作ります。

そしてpyという名前のPythonのメソッドを作成します。

先述の通りPythonからObjectScriptのルーチンを直接呼び出すことはできないので、ルーチンを間接的に呼び出すObjectScriptのメソッドを作成する必要があり、そのメソッドをPythonメソッドから呼び出すようにします。

渡したいデータが複数個ある場合、その数分引数を用意するのは面倒なため、Pythonの場合、情報をまとめて交換する際にdictionary(辞書)やlistという構造を使用することができます。

ここでは、dictionaryを使用する例を紹介します。

ClassMethod py() [ Language = python ]

{

   import iris

   rtn = "^test"
#  変数argのdictionary構造にa = 10, b = 20を設定
   arg = {"a":10, "b":20}

   ret = iris.cls('User.test').callrtn(rtn, arg)

# 戻り値のdictionary変数retにローカル変数sumの値が設定されている   
   print (ret.get("sum"))

}

 

次にルーチンを呼び出すためのクラスメソッドを定義します。

PythonのDictionary構造をObjectScriptで操作するためには、少し特別な処理が必要です。

ClassMethod callrtn(rtnname As %String, plist As %String) As %Integer [ ProcedureBlock = 0 ]

{
    // python dictから変数を取得
    set a = plist."get"("a")
    set b = plist."get"("b")
    
   // 2. ルーチンを実行する
   do @rtnname

   // 3. ローカル変数 ==> 戻り値 (python dict)
   kill rtnname,plist

   set ret = ##class(%SYS.Python).Builtins().dict()

   // 存在するローカル変数からdictionaryを生成する    set %="%"
   for {
       // ローカル変数を順番に取得
       set %=$Order(@%)

       quit:%=""        
       //変数retは除く
       continue:%="ret"
       do ret.setdefault(%, @%)

   }

   quit ret

}

 

2023.2以降のバージョンではarrayrefのサポートが追加されており、より直感的な処理が可能になりました。

 

ClassMethod py() [ Language = python ]
{
    import iris
    rtn = "^test"
    arg = {"a":10, "b":20}
    ar = iris.arrayref(arg)
    ret = iris.cls('Test.pytest').callrtn(rtn,ar)

    print (ret.get("sum"))
}

 

ClassMethod callrtn(rtnname As %String, plist As %String) As %Integer [ ProcedureBlock = 0 ]
{

    set a = plist("a")
    set b = plist("b")

    // ルーチン実行
    do @rtnname

    //ローカル変数 ==> 戻り値(python dict)
    kill rtnname, plist
    set ret = ##class(%SYS.Python).Builtins().dict()
    set % = "%"
    for {
        set %=$order(@%)
        quit:%=""
        continue:%="ret"
        do ret.setdefault(%, @%)
    }
    quit ret
}
讨论 (0)1
登录或注册以继续