ADO.NET Provider for FHIR

Build 23.0.8839

DataReader を使用したクエリ

CData ADO.NET Provider for FHIR では、次の2つのネイティブ.NET インターフェースを使用して、FHIR からデータを取得できます。FHIRDataAdapter オブジェクトおよびFHIRDataReader オブジェクト。各オブジェクトは同じタスク(データの取得)を実行しますが、実行方法が異なります。FHIRDataAdapter オブジェクトはクエリに一致するすべてのデータを取得しますが、FHIRDataReader オブジェクトは必要に応じてインクリメントしながら一部のデータだけをフェッチします。

FHIRDataReader の使用

FHIRDataReader はページ単位でデータを取得できるため、FHIRDataAdapter よりもデータの取得が高速です。FHIRDataReader からデータを読み取っていくと、必要に応じて一定の間隔で、データソースからの結果の次のページが要求されます。このため、結果が高速に返されます。 次の例は、Patient テーブルからすべてのカラムを選択します。

C#

string connectionString = "URL=http://test.fhir.org/r4b/;ConnectionType=Generic;ContentType=JSON;AuthScheme=None;";

using (FHIRConnection connection = new FHIRConnection(connectionString)) {
  FHIRCommand cmd = new FHIRCommand("SELECT * FROM Patient", connection);
  
  FHIRDataReader rdr = cmd.ExecuteReader();

  while (rdr.Read()) {
    Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["Id"], rdr["[address-city]"]));
  }
}

VB.NET

Dim connectionString As String = "URL=http://test.fhir.org/r4b/;ConnectionType=Generic;ContentType=JSON;AuthScheme=None;"

Using connection As New FHIRConnection(connectionString)
  Dim cmd As New FHIRCommand("SELECT * FROM Patient", connection)

  Dim rdr As FHIRDataReader = cmd.ExecuteReader()

  While rdr.Read()
    Console.WriteLine([String].Format(vbTab & "{0} --> " & vbTab & vbTab & "{1}", rdr("Id"), rdr("[address-city]")))
  End While
End Using

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839