これについて同僚に尋ねたところ、これが彼の答えでした。それは私の手仕事ではないので、私は「コミュニティ Wiki」という回答を作成しました。
質問に答えるために... 次のプログラムは、Common Informix Provider (DRDA 通信プロトコルを使用する IBM.Data.Informix.dll) を使用して作成されました...「IBM Data Server Driver for CLI、ODBC」で取得できます。 、および .NET" パッケージ)。従来の Informix プロバイダ (SQLI 通信プロトコルを使用する IBM.Data.Informix.dll...「Informix Client SDK」パッケージで入手できます) を使用すると、非常によく似たことができるはずです。
プログラムの例を次に示します。
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using IBM.Data.Informix;
namespace InformixClob
{
class Program
{
static void Main(string[] args)
{
try
{
IfxConnection tConn = new IfxConnection("database=idsdb;server=my-system:9089;uid=informix;pwd=********");
tConn.Open();
IfxCommand tCmd = tConn.CreateCommand();
// create table mytesttab (col1 integer, col2 clob)
tCmd.CommandText = "select * from mytesttab";
IfxDataReader tRdr = tCmd.ExecuteReader();
while (tRdr.Read())
{
Console.WriteLine("Col1 is a {0}", tRdr.GetValue(0).GetType());
Console.WriteLine("Col2(GetValue) is a {0}", tRdr.GetValue(1).GetType());
Console.WriteLine("Col2(GetIfxValue) is a {0}", tRdr.GetIfxValue(1).GetType());
Console.WriteLine("Col2(GetIfxClob) is a {0}", tRdr.GetIfxClob(1).GetType());
}
tRdr.Close();
tConn.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
finally
{
Console.Write("Press ENTER"); Console.ReadLine();
}
}
}
}
そして、生成される出力は次のとおりです。
Col1 is a System.Int32
Col2(GetValue) is a System.String
Col2(GetIfxValue) is a IBM.Data.Informix.IfxClob
Col2(GetIfxClob) is a IBM.Data.Informix.IfxClob
Press ENTER
このIfxDataReader.GetValue(int)
メソッドは、列の値をネイティブの .NET Framework データ型で返します。Informix 型として返される列値を取得するには、GetIfxValue(int)
メソッドを呼び出すか、より具体的に指定できる場合はメソッドによって、その値が返されるように要求する必要がありますGetIfxClob(int)
。