Nueva publicación

Encontrar

Artículo
· 17 ene, 2025 Lectura de 1 min

SQLクエリでStreamのデータを扱う方法

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

SQLでのストリームフィールドの取得についてはこちらのドキュメントに記載されております。

ストリーム・フィールド・データのクエリ


例: キャラクターストリームデータの50文字取得する

select substring(field1,1,50) from sample.streamtable

%SQL.Statement を使用したクエリでそのストリームオブジェクトのOREF値を取得して、ストリームデータにアクセスすることもできます。

 set stmt=##class(%SQL.Statement).%New()
 set status = stmt.%Prepare("select field1 from sample.streamtable")
 set rs=stmt.%Execute()
 write rs.%Next()
 set clob=rs.%GetData(1)
 write clob.Read(50)

埋め込みSQLを使用する場合は、そのストリームオブジェクトのOREFではなくストリームIDが返ってくるので、以下のようにストリームをオープンする処理を追加する必要があります。
 

&sql(select field1 into :outpic from sample.streamtable where ID=1)

 set clob=##class(%Stream.Object).%Open(outpic)

 write clob.Read(50)
Comentarios (0)1
Inicie sesión o regístrese para continuar
Artículo
· 17 ene, 2025 Lectura de 1 min

【Caché, Ensemble】サーバーを移行する際にコピーが必要な設定情報

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

何らかの理由でサーバー移行が必要になった際に、移行前の環境から移行後の環境に設定情報をコピーすることで設定作業を軽減できます。

以下の設定情報を移行できます。

  • cache.cpf
  • SQLゲートウェイ設定
  • CSPゲートウェイ設定 *注1
  • CAHCESYSデータベースに保存しているユーザー作成ルーチンなど *注2
  • セキュリティ設定
  • タスク設定

注1 パスワードを設定している場合には、パスワードのみ手動で再設定が必要です。
注2 ^%ZSTART, ^ZMIRRORルーチンなど 優先接続サーバー設定に関しても、物理的には移行可能ですが、Windowsのレジストリー情報をコピーする必要があります。
レジストリー情報をコピーして他システムに移行する方法は通常推奨される方法ではありません。

Comentarios (0)1
Inicie sesión o regístrese para continuar
Artículo
· 17 ene, 2025 Lectura de 1 min

実行中のプログラムをコンパイルして保存することによるその実行中のプロセスへの影響

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

Question:

使用中のプログラムをコンパイルして保存すると、現在そのプログラムを実行中のプロセスに影響しますか?

Answer:

実行中のルーチンはその旧バージョンをメモリー上に保持しているため、コンパイルして新しいルーチンが保存されても影響なく実行を継続できます。

クラスのメソッドについても同様です。 再度そのルーチンが呼び出された時点でコンパイルされた新しいルーチンが使用されるようになります。

Comentarios (0)1
Inicie sesión o regístrese para continuar
Pregunta
· 17 ene, 2025

Are package names case sensitive?

The documentation at https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.UI...

Case-sensitive: variable names (other than the system variables) are case-sensitive. Names of classes and their members, names of routines and their entry points, names of include files and macros are all case sensitive.

Consider "fully qualified" class name: Package.subpackage.ClassName

What is the class name mentioned in the documentation? Package.subpackage.ClassName  or ClassName ?

It's unclear to me if in InterSystems/ObjectScript parlance class name includes also the packages or not.

In the other (non-related as my example has no SQL/%Persistent involved) documentation at https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

Schema and table names are not case-sensitive; package and class names are case-sensitive.

But if I try to have both Package.subpackage.ClassName  and package.subpackage.ClassName I'll get:

ERROR #5092: Name conflict on class 'package.subpackage.ClassName' because class 'Package.subpackage.ClassName' has the same name but differs in case.

Or trying to have both Package.subpackage.ClassName and package.subpackage.ClassNameTwo gives me:

ERROR #5093: Name conflict on class 'package.subpackage.ClassNameTwo' because package 'Package' has the same name but differs in case.

So it looks to me the package names are case in-sensitive. To me this is an inaccuracy/bug in the documentation and I'll report that if no-one else objects :)

This is related to "IPM modularization"-effort where I'm trying to apply de-facto naming conventions but the package name case in-sensitivity prevents us to mix the new IPM code with old code (mapped from other namespaces).

9 comentarios
Comentarios (9)3
Inicie sesión o regístrese para continuar
Artículo
· 17 ene, 2025 Lectura de 2 min

Mac IRISでEmbedded Python利用に関する相性問題

Mac版IRISでは、現状Pythonのバージョンが固定(3.11)なのですが、これに付随する他製品との相性問題に遭遇しましたので報告します。

今までEmbedded Pythonは調子よく動作していたのですが、ある時から急に動作しなくなりました。

原因を調べてみると、Python3.13がインストールされ、それがデフォルトとして上書きされたため、irispythonコマンドを発行すると、それが内部で3.13を呼ぶ様になってしまったためでした。

ちなみにiris session でログインし、そこからEmbedded Pythonを実行する場合は、問題ありません。

あくまでもirispythonコマンドで直接.pyファイルを実行する場合に発生する問題です。

そしてとりあえずの対処法は、python3をpython3.11で置き換える方法です。

以下のような感じです。(どのMacでもbrewコマンドでインストールした場合、ディレクトリ構造は同じだと思いますが、違う可能性もゼロではありません)

cp /opt/homebrew/bin/python3.11 /opt/homebrew/bin/python3

さて、ところで何で3.13がインストールされていたのかというと、

IRIS SQLのLOADコマンドを動作させるためには、JDKまたはJREが必要なのでそれをインストールしました。

そしてOpenJDKのインストールの際に、勝手にPythonもインストールすることが原因でした。

何故Javaのインストールでpythonをインストールする必要があるかは不明ですが、LOAD DATAコマンドはJava経由でpythonを使用することもなさそうなので、上記の応急処置で問題なさそうですが、

根本的な対処法は、

MAC版IRISがフレキシブルpythonをサポートするか、

irispythonコマンドが自分が呼ぶべき正しいpythonバージョンを選択するか

またはわざわざirispythonを呼ばなくても通常のpythonコマンドから普通の.pyファイルを実行してembedded pythonを呼び出せる様にするか

個人的には最後が一番望ましいのですが、何か技術的な困難があるのかもしれません。

Comentarios (0)1
Inicie sesión o regístrese para continuar