Re: record copy function
Posted in 1995
>From: "Watje, Paul" <watjep@emspo01.hasting.com> >Date: Tue, 20 Jun 95 14:45:00 PDT >X-Informix-List-Id: <list.6659> > >Who ever posted the source for the record comparision >function, THANKS, it really came in handy. I know i4gl, >has that function in a library(unsupported :^(, but >with the source I could also use it under RDS. It does? I don't think it does, and, with all due respect, I think I know the I4GL soruce code better than you do. That's why the C-code is necessary. There is no built-in record comparison available in I4GL because the language does not support the operation. Incidentally, what does the C code you are using do if the records differ in size by an even number of elements? >Does anyone have a C function that can be used to to assign/copy one >record to another? Well, for identically defined records, this is a built-in: LET record1.* = record2.* If you have variant record types, then you have problems, but a piece of C could be used to achieve the required effect, no doubt, but I have some (major) reservations about the wisdom of doing it, but... You could write a I4GL function: FUNCTION transfer_record(rec.*) DEFINE rec LIKE Record2.* -- Table which record2 is defined like... RETURN rec.* END FUNCTION and use it as: CALL transfer_record(record2.*) RETURNING record1.* This is likely to be as quick as anything you can code in C, and will perform the conversions you might require. The only C way to write the C function would have the same interface, and would do the same validation during the return, so it probably isn't worth trying to code it in C, unless you want some non-orthodox assignment characteristics (such as set field to null if it won't convert). >I realize the record values have to be returned to be assigned, but that >is fine by me. I'm not a C person, so I am hoping that someone else has >written this function. Not me. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>