Create row type value objects without an open connection
The process consists of two steps:
- Create the ITTypeInfo object for the row type.
- Instantiate the row type value object by using the ITFactoryList::DatumToValue() method and pass to it an ITMVDesc structure whose members are populated appropriately.
The row type object returned this way is a null row, which can be modified by using ITRow::FromPrintable(). Because the row type object has been created without an open connection, the underlying data of the row type value object cannot be modified with ITDatum::SetData() or retrieved with ITDatum::Data() (where ITDatum is an interface exposed by a row type value object). However, the remaining ITRow methods are not affected.
The following example illustrates how to create a row type value
object without an open connection:
#include <iostream.h>
#include <it.h>
int
main()
{
ITConnection conn;
ITMVDesc desc;
ITTypeInfo colType(conn,"integer", 4,-1,-1,-1,1);
ITTypeInfo *ptrcolType = &colType;
ITString colName = "int_val";
ITTypeInfo newti(conn,"row(int_val integer)", 1,
&ptrcolType, &colName, NULL );
desc.vf_origtypeinfo = (ITTypeInfo *) &newti;
desc.vf_connection = &conn;
desc.vf_typedesc = NULL;
desc.vf_preservedata = NULL;
desc.vf_outerunknown = NULL;
desc.vf_datalength = newti.Size();
desc.vf_libmivaluetype = MI_NULL_VALUE;
desc.vf_data = NULL;
ITValue *val = ITFactoryList::DatumToValue (desc);
val->FromPrintable("row(1)");
cout << val->Printable() << endl;
val->Release();
}