Ejemplo n.º 1
0
static jobject coerceTupleDatum(UDT udt, Datum arg)
{
	jobject result = JNI_newObject(Type_getJavaClass((Type)udt), udt->init);
	jobject inputStream = SQLInputFromTuple_create(DatumGetHeapTupleHeader(arg), udt->tupleDesc);
	JNI_callVoidMethod(result, udt->readSQL, inputStream, udt->sqlTypeName);
	JNI_deleteLocalRef(inputStream);
	return result;
}
Ejemplo n.º 2
0
static jobject coerceTupleDatum(UDT udt, Datum arg)
{
	jobject result = JNI_newObject(Type_getJavaClass((Type)udt), udt->init);
	Oid typeId = ((Type)udt)->typeId;
	TupleDesc tupleDesc = lookup_rowtype_tupdesc_noerror(typeId, -1, true);
	jobject inputStream =
		SQLInputFromTuple_create(DatumGetHeapTupleHeader(arg), tupleDesc);
	ReleaseTupleDesc(tupleDesc);
	JNI_callVoidMethod(result, udt->readSQL, inputStream, udt->sqlTypeName);
	JNI_deleteLocalRef(inputStream);
	return result;
}