Re: Possible Feature



Art S. Kagel wrote:
Paul Watson wrote:
I haven't checked the manuals but I don't believe we can do this :)
Just done a series of big DB changes and needed to recompile all the SPL
code. I use 'LIKE' for the input parameters and local variables but you
can not do a
RETURNING LIKE <tabname>.<colname> syntax

Would anyone else find that useful???

Paul,

You cannot do it and I would submit that you do not want to be able to do this. I'll explain.

Having internal variables within a routine that are defined LIKE table.column (oh, asside to Daniel Oracle's table.column%TYPE is the same as LIKE table.column in Informixese IB) is fine as these are used internally and if you modify the table the routine will be recompiled the next time it is run so no problems. HOWEVER, if you have return types that can vary you are opening a can of worms. Suppose you have written an application that expects the routine to return an integer. The routine is defined to return LIKE table.column as you suggest. One day you ALTER that column from INT to CHAR(20). Initially everything is fine, the routine recompiles and the ESQL/C or ODBC library makes the appropriate automatic conversion from CHAR(20) to INTEGER. Assuming that all of the values were initially integers as they must be, all is well. Now a month later you begin inserting values to that column (accidentally, on purpose, or maliciously) that are no longer numeric and cannot be converted or represent numeric values that do not fit into the 32bit integer host variable. Every call to the routine gets a -1213 or -1215 error and your application is hosed.

Nope, this would be a VERY bad idea indeed. My approach would be to leave the original routine mostly alone (adding code to handle numeric overflows and other problems, returning an expected error) for unconverted apps to call and write a new one that returns the column's new datatype to be recoded into converted and new applications. I make it a hard and fast rule for any API that if the interface changes (ie inputs of outputs), the name of the API function must change as well. Then when the older interface is no longer references we can get rid of it altogether. Makes conversions smoother.

Art S. Kagel

Everything you wrote is true but I would question your conclusion given
that this technology has existed for more than a decade in another
product and not caused that problem.
--
Daniel A. Morgan
University of Washington
damorgan@xxxxxxxxxxxxxxxx
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
.



Relevant Pages

  • Re: Possible Feature
    ... Just done a series of big DB changes and needed to recompile all the SPL ... I use 'LIKE' for the input parameters and local variables but you ... Having internal variables within a routine that are defined LIKE table.column is fine as these are used internally and if you modify the table the routine will be recompiled the next time it is run so no problems. ... the routine recompiles and the ESQL/C or ODBC library makes the appropriate automatic conversion from CHARto INTEGER. ...
    (comp.databases.informix)
  • Re: Problem using ForeignToRTF32
    ... There are issues with permissions on ... not DCOM. ... and the conversion always works without a problem. ... exactly the same arguments to the routine from both programs. ...
    (microsoft.public.word.conversions)
  • Re: Converting a bitmap from 24 bits format to 8 bits format
    ... First you need to create an empty folder somewhere and then unzip the contents of the zip file that you downloaded into that folder. ... So far the program has performed the conversion but it hasn't saved the result. ... bytes for the pixel data itself with the remaining thousand or so bytes being the header data and the palette data. ... buttons into the "Private Sub cmdConvert_Click" routine and you could hard code an output filename into the "Private Sub cmdSave_Click" routine and comment out the bits that show the save dialog. ...
    (microsoft.public.vb.general.discussion)
  • Re: Problem using ForeignToRTF32
    ... and the conversion always works without a problem. ... exactly the same arguments to the routine from both programs. ... I already tried adding an invisible window to my service, ... hidden dependency on having a window available from the calling program, ...
    (microsoft.public.word.conversions)
  • Re: Possible Feature
    ... Paul Watson wrote: ... choose to use it then I have the responsible for maintaining type ... Just done a series of big DB changes and needed to recompile all the ... Having internal variables within a routine that are defined LIKE ...
    (comp.databases.informix)