UDR questions
Posted in 2000
Using the example code that was so nicely given to me on this list for basic a UDR, I was able to write a UDR that returns the count(*) of a table. Simple enough. (quite a bit of work above and beyond ESQL/C, but still nifty stuff all in all). I have a few basic questions that I can't seem to find answers to in the manual, or at least explained in the layman's terms that I'm looking for: 1. I want to write a UDR that returns multiple rows. The manual says I need to use the fparam structure to do that. Am I to understand that I can call the mi_fp_request function, passing fparam and it will tell me if the call is the first call, or subsequent calls? How does it know when the query has ended? I mean I'm stumbling here. My .c code will return(x) some value, and then the code will be done. I can understand that the fparam struct maintains information, but I'm having trouble making this leap somewhere. And I want to return ROWS of information, not several integer fields. I mean, I need to be able to return about 30 columns of data from n rows based on the parameters that I will receive. How can I do this? 2. The manual mentions an "ifx_reload_module" function that I can use to update the shared object file. This function doesn't exist in our database. I don't know if it's our fault, or what. We DO have a "reload_module" function which doesn't seem to do anything. I've resorted to using "ifx_replace_module". The catch here is that Informix seems to remember which paths specific versions where in, so I can never re-use a path. So I have a script which creates directories 1,2,3, etc in my directory and copies my .so into that, and replaces it with that new location. I'm up to directory 20 now. It's getting annoying. There has to be a better way. 3. Is there a way to return an integer from the mi_value function? I have mi_value(row_returned, i, (MI_DATUM *)&count, &col_len) ; which works well, and count is defined as a mi_char *count; If I define count as mi_integer, and remove the &, I get an error. Just curious here. 4. Should I call mi_close at the end of my UDR, right before my return() statement? Thanks for your help. I'm very appreciative! -- Curtis Bennett CIBER, INC Overland Park, KS Sent via Deja.com http://www.deja.com/ Before you buy.